CSCI 160 Lab exercise 1: part 1

For each lab, there are several key syntax elements you'll need to be familiar with. The core part 1 syntax elements can be found here.

NOTE THAT I'LL BE DISTRIBUTING YOUR CSCI LOGIN IDS IN THIS LAB
you will be unable to connect to our linux servers to work on your labs until you have this information

The objectives for this lab are to master some basic linux skills, learn how to obtain and submit labs, and learn how to edit, compile, and run C++ programs in a linux environment,

The layout of instructions for this part of lab exercise 1 will be quite different than for the remaining labs. In this lab, instructions are laid out in a very step-by-step fashion to walk you through an introduction to our linux labs, your accounts, and the use of C++.

Be sure to go through each of the steps carefully, and in the order given, successfully completing each step before moving on to the next one.

    Phase I: intro to the labs/linux

    Get logged in to your CSCI account
    (you'll do this every time you want to work on one of your CSCI labs)

  1. Using your account id ( available from the course instructor), follow the instructions below login to the windows machine using your regular VIU login credentials, open a web browser, and open the course lab page csci.viu.ca/~wesselsd/courses/csci160/labs.html

    Follow the link to lab exercise 1, read the notes for today's exercise, and follow the link for part 1.

  2. Open the windows powershell either by right clicking the Windows icon in the lower left or by using the keyboard shortcut Windows Key + X

    This will open a new text window through which we'll connect to the CSCI department linux servers.
    Most of the remaining instructions below will be carried out through this new text window

    Feel free to customize the properties of the powershell window, the defaults aren't pretty!

  3. The program we'll use to connect to the linux server is called ssh (secure shell).

    Using the linux username provided for your account, use the following command to connect to our server (the -l is a lowercase L, not a 1)

    ssh -l yourusername csci.viu.ca

    You may be asked if you trust the RSA key for this server, reply yes.

    You will then be prompted to enter your password, enter the one provided on your account sheet.
    Nothing will appear on screen as you type, keep typing anyway and hit enter when finished.

    (Simply try again if the password was mistyped.)

    Once connected, you'll see the message of the day for the server, and you may be prompted to pick a new password. Pick something secure that you can remember, and follow the instructions given.

    Instructions on how to change your password later, or how to deal with a forgotten password, are provided on the technotes page.

    Through the ssh connection we have established, we can now issue linux instructions to the csci server and run programs on that server. For the moment, all our interaction with the server will be through text commands and the text responses the server provides.

    (Later in the term we'll discuss the use of X2Go to allow you to run graphical programs on the linux server and have the results display on your Windows lab machine, details can be found through the technotes page, along with instructions for other platforms.)

  4. Starting with some basic linux:

  5. Copy a special makefile from the instructor's account to your home directory.

    Makefiles allow us to bundle up sets of linux commands, and run them through a program called make. This semester I'll be providing a variety of makefiles to simplify the process of obtaining, compiling, and submitting your lab exercises.

    The first makefile belongs in your home directory and will be named make160. Instructions for obtaining using it are as follows:


    Extra step if you have time

    Let's try quickly running through the cycle one more time, to demonstrate that the labex0 files will still be present on the linux server the next time you log in. An abbreviated list of steps is given here, refer to the instructions above if you can't remember the command for a specific step


    Note that you must be in the correct directory, e.g. csci160/labex0, whenever you are working on a lab exercise, otherwise the necessary makefile and source code files are not present.

    If you're unsure which directory you are in, enter the command
    pwd
    If you find you are in an incorrect directory then you can jump directly to the labex0 directory using the following command:
    cd ~/csci160/lab0