File: Steve/Courses/2014/s2/its332/linux.tex, r3463
Linux is an operating system based on Unix, one of the earlier multi-user operating systems developed in the 1970’s and 1980’s. Unix was originally a single operating system, but over time several commercial variants were developed. These Unix operating systems were particularly popular in the 1980’s and 1990’s, especially within academic and technology organisations. Some of the Internet applications and protocols were first developed on Unix, and hence Unix-based computer systems have a strong link with computer networking.
Today Unix operating systems are still used, mainly in servers and high-end workstations. In the 1990’s Linux appeared, a free operating system with Unix-like functionality (or at least a kernel for an operating system). In the 2000’s, Linux also became popular in typical Unix domains of servers and workstations, and also has been growing in the desktop field (however, in quantity of installs, Linux still does not compare with Microsoft Windows). As with the original Unix, there are many variants, or distributions of Linux, differing in the applications and graphical environments they provide (e.g. RedHat, Debian, Fedora, Ubuntu, Xandros). We will be using the Ubuntu Linux distribution.
Ubuntu Linux is a free, open-source Unix-based operating system, that has been developed mainly for desktop (and laptop) installations. The aim is to make a user-friendly Linux distribution. It is now one of the more popular Linux distributions. Ubuntu is installed on the Network Lab computers, and will be used extensively to demonstrate computer network operations in ITS 332. This document aims to give a quick introduction to some of the most common operations that you will need during the course.
Why use Ubuntu Linux, and not Microsoft Windows, especially since Windows is by far the most popular desktop operating system, and hence very popular with server systems? There are several reasons we will use be using Linux instead of Windows:
When the computer boots, within the first several seconds a program gives you the option to start Windows or Ubuntu. You should select Ubuntu, which will boot Ubuntu Linux.
Once Ubuntu has started you are presented with a login screen. You should login with the username/password provided in the class.
Different users in Ubuntu have different privileges (e.g. ability to view or edit system files, view or edits other peoples files, change important operating system parameters). The user with the most privileges (that is, can do everything!) is called root (sometimes also called super-user). The problem with logging in as root is that a simple typing mistake may delete the entire hard drive!
The user you login as is just a normal user—lets refer to them as student. The user student has the ability to view and edit their own files in the directory /home/student, view most system files (that is almost all files on the hard disk, except those of other users) and view configuration options (such as IP address). You must always login as this normal user, and perform most operations as this normal user.
However, sometimes during the lab classes it will be necessary to perform tasks that require more priveleges than the student user. For example, you require root privileges to install new software, change IP addresses and modify system files (such as configuration parameters for the web server). The student user has been configured to allow them to temporarily gain the privileges of the root user for these tasks. You do this using the sudo command.
Lets assume there is a command you need to execute in the command line shell (see Section 2.2.4). The command is:
However, you must execute this as root user (since as the normal user, you are not allowed). So you would actually run the command by preceding it with sudo:
On the first use of sudo you will be prompted for a password—it is the password you logged in as student with. Then the command will execute. If you do not use sudo (and the command is privileged), the the command will not execute (usually returning an error like Permission denied).
Note that sudo should only be used for running command line applications as root. To run graphical applications as root (such as gedit or wireshark) use gksudo. The method is the same as with sudo, except the password will be prompted via a graphical window.
A final note on the root user. As we said before, you can potentially delete the entire hard drive. As we give you the access to perform operations as root user, you must act responsibly. Anyone caught using these privilelges incorrectly will be punished. This includes deleting system or other users files, copying other users files, changing parameters of the operating system and installing software which is not needed for the class. Punishment may range from loss of marks for the lab class, to more severe punishment in line with that for cheating (e.g. zero for the course).
Ubuntu has a graphical windows system like most other operating systems. It is quite intuitive once you know the basics. The main functions can be obtained by clicking on the Dash Home on the left dock and then either searching or browsing for applications.
Although many of the networking operations can be performed using the graphical tools, almost all have a command line interface.
Like almost all Unix-based systems, operations can be performed via a command line shell or terminal. In Ubuntu, to start a new terminal select Accessories and then Terminal from the Applications menu1 .
Some of the more common operations you will use include:
An example of using some of these commands is shown below.
We will introduce network-specific operations during the labs. For reference, some networking commands are listed in Appendix C.
Although everyone has their own preferences about text and source code editors, two standard editors in Ubuntu that are recommended are:
Some of the applications that we may use during the labs include:
Although it should not be required during the labs, (and you must not install any software unless asked to by the instructor!), Ubuntu has a simple command line interface to installing software, using apt-get:
where NAME is the name of the software package you want to install. Of course, you need administrator privileges to install software (hint: sudo).
You can use the GNU C Compiler to compile C code:
while compile FILE.c and create the executable program named EXECUTABLE.
Task 2.2. Find the Linux Reference Sheet on the course website; make sure it is easily accessible in each lab.
Task 2.3. Install (Ubuntu) Linux on your own computer and practice the command line at home. The easiest way is to install inside a virtual machine, e.g. using VirtualBox or VMWare.