Project 0: Linux basics

  • This project is due at 11:59.59pm on Friday, January 17, 2020.

Description and Deliverables

This class has projects that require the use of the command line. Since different OS’s have different command line environments, we will use Ubuntu 19.10 OS as a concrete example for the whole class. When we provide examples in the future, or when students ask us to help debug problems, we will assume that everything is being done on Ubuntu 19.10. See Basic VM setup for how to set this up.

Even if you already have a bash command line (e.g. you use Linux, own a Mac, or have installed WSL on Windows 10) for this project we ask that everyone complete the following steps in full. Later on, if you want to use your own command line, so be it.

Steps to Complete The Project

To receive full credit for this project, complete the following steps. Ultimately, you will create a git project for your course files, and submit three files that you produce during these steps as a commit to your repository.

  1. If you don’t already have an account on Gitlab, you will need to get one. You can sign-up for one at Gitlab. Additionally, you will need to register on this form in order to make our course staff aware of your gitlab username.

  2. We will now create a git repository in your Gitlab account that will hold all of your cy2550 Project files.

    1. Click on Create a Project in your gitlab account, in Project Name, use cy2550, select Visibility level Private and select “Initialize repository with README.” Click “Create project”. You should see a gitlab project page now.

    2. You now need to invite me abhvious to your project so that the course staff can access your repository. Click Settings and Members and add abhvious as a Maintainer to your repo.

  3. Install VirtualBox (or VMWare if you want) on your own computer and create an Ubuntu 19.10 machine; you can follow the instructions on Basic VM setup. Make sure to allocate at least 2GB of RAM (preferably 4GB) and 10–20GB of disk space to the new VM. Another useful tutorial can be found here.

  4. Once Ubuntu is installed, reboot the VM, wait for Ubuntu to load, and log-in to your new Ubuntu installation using the credentials you provided during setup.

  5. Open a command line (also known as a terminal) and install the git and the screenfetch program using the apt tool. You can think of “apt” as the app store for Ubuntu: it lets you install new programs from the command line. Of course, to do this you need administrator privileges, so you also need to use the sudo command. Putting it all together, execute the following command:

      $ sudo apt install screenfetch git
    
  6. Now checkout your newly created git project. To do this, go back to the gitlab project page, and click the “Clone” button. Under Clone with HTTPS, copy the URL and then run these commands:

      $ git clone <copeid url, e.g. https://gitlab.com/wefwfe111/cy2550.git>
    

    The prompt will ask you for your gitlab credentials.

  7. Make a new directory for project0, and then enter this directory

      $ mkdir -p ~/cy2550/project0
      $ cd ~/cy2550/project0
    

    mkdir is a program that makes directories (i.e. folders) on the hard drive. The tilde character is a shortcut that always refers to your home directory (typically /home/your_username/).

  8. If you run the screenfetch program, it will print out useful information about Ubuntu and your system. Run screenfetch again, but redirect the output (using the > operator) to a file on disk named sf-output.txt. Make sure you remember where you saved this file, you will need it again!

  9. Run the ps -ef program, and redirect the output to a file named ps-output.txt.

  10. Create a file named ~/cy2550/project0/hello.txt on your Linux machine (using a text editor of your choosing, such as Emacs, VIM, or Nano). This file must contain your full name and gitlab username. For example, this file might say:

    Hi, my name is abhi shelat and my gitlab user name is abhvious.
    
  11. At this point, your ~/cy2550/project0 directory should contain three files. You can use the ls program to list the files in this directory to make sure.

  12. You are now ready to commit and push your files to your gitlab repository.

Throughout these steps, you will be using various Linux command line programs. Most programs have built-in help messages if you run them with “–help” or “-?” as the command line argument. Furthermore, all programs have helpful Manual Pages that you can access by running:

$ man <program_name>

These various sources of help text may be useful if you get stuck during the project.

Learning the Linux Command Line

Martin Petrauskas has put together a helpful guide that explains how to setup VirtualBox (including how to change several important settings). This guide also has several chapters on basic Linux command line usage that may prove useful throughout this course if you are unfamiliar with the Linux command line. The guide is a work-in-progress, and the latest version is: Learning the Linux Command Line

Submit Your Project

  1. We first need to do some setup to tell git who we are:

      $ git config --global user.name "abhi"
      $ git config --global user.email "abhi@neu.edu"
    
  2. Then we can prepare our commit. If you are already in the ~/cy2550/project0 directory, then you can do the following

     $ git add sf-output.txt ps-output.txt hello.txt
     $ git commit -m "Initial commit to project 0"
    

    The first command tells git that the three files listed should be part of a “commit.” A commit represents a change to the state of the repository. It can include new files, modified files, or deleting of files from the state of the repository. In this case, we are adding 3 new files to the repository.

    The second command formalizes the change of the state your local git repository. The -m flag gives a short informative message that describes this commit.

    You can make as many changes as you like to your local repository in this way. When you edit larger pieces of software, it is important to make incremental commits as you develop a solution. For example, if you decide to edit the hello.txt file, and want to not reflect the new state:

       $ git add hello.txt
       $ git commit -m "Edit to hello.txt"
    
  3. Finally, when you are ready, you need to push this local commit to gitlab:

      $ git push
    

    This command will ask for your gitlab credentials. Pushing the local commit shares it with us. We can now see this change. This is how some large software projects manage collaboration across thousands of developers working on different parts of the system, while keeping a consistent view of the “latest” changes.

  4. You can now return to your gitlab project webpage to check that your files are now there.

To turn-in your project, you must submit exactly three files in a commit:

  • sf-output.txt
  • ps-output.txt
  • hello.txt

the format and specification of which are described above. All files should be placed in a directory (such as cy2550/project0).

Adding me to your repo

In order for me to access your private git repo, you will need to add me as a “Maintainer” of your repo. To do this:

  1. Click on the “Settings” –> “Members” link in the left-hand navigation menu on your gitlab project page for cy2550

  2. Under the “Invite Members” tab, search for “abhvious” in the “GitLab member or Email address” window. Under “Choose a role permission,” select “Maintainer” and then click “Add to Project.”

After these steps, you should see me in your “Existing members and groups”

Grading

This project is worth 4% of your final grade, broken down as follows (out of 100):

  • 33.33 points - producing a sf-output.txt file that gives your OS as Ubuntu 19.10.
  • 33.33 points - producing a correct ps-output.txt file.
  • 33.33 points - submitting a hello.txt file that contains your name and gitlab username.
Points can be lost for turning in files in incorrect formats (e.g. not ASCII) or failing to follow specified formatting or naming conventions.