Islamic University – Gaza Engineering Faculty Department of Computer Engineering ECOM 4010: Operating Systems Lab Lab # 1 Introduction to Linux Eng. Eman R. Habib September, 2013 2 Operating Systems Lab What is an Operating System? A program that manages the computer hardware. It also provides a basis for application programs and acts as an intermediary between the computer user and the computer hardware. OS is a resource allocator: Manages all resources and decides between conflicting requests for efficient and fair resource use. OS is a control program: Controls execution of programs to prevent errors and improper use of the computer. The One program running at all times on the computer (usually called the kernel). System Calls Programming interface to the services provided by the OS Interface between the process and the operating system. Typically written in a high-level language (C or C++) 3 Operating Systems Lab Linux Linux is a generic term referring to Unix-like computer operating systems based on the Linux kernel. The development of Linux is one of the most prominent examples of free and open source software collaboration; typically all the underlying source code can be used, freely modified, and redistributed by anyone. Because Linux takes the UNIX system as its inspiration, Linux and UNIX programs are very similar. In fact, almost all programs written for UNIX can be compiled and run under Linux. Also, many commercial applications sold for commercial versions of UNIX can run unchanged in binary form on Linux systems. The problem with UNIX is that is has always been expensive and taken large computers to use. Some versions of UNIX have been available for personal computer-type hardware, but the cost has been very prohibitive and the support by multiple vendors has been lacking. These problems are what led to the development of Linux. Linux was developed by "Linus Torvalds" at the University of Helsinki, with the help of UNIX programmers from across the Internet. Linux Architecture The Linux architecture comprises two main sections: the kernel space and user space. Kernel space The kernel space is where all of the system level processes happen. These processes are things that affect the entire system and have to be very stable and well maintained. A problem in kernel space can cause the system to crash. The main resident in kernel space is, of course, the kernel. The kernel is the piece of software that manages memory allocation for processes and divides up the CPU’s time appropriately. The kernel also contains the drivers for the hardware devices installed in the system. The kernel is the core of the Linux operating system. User space The user space manages the user processes run by people working on the system. User processes are things such as your e-mail client, Web browser, or word processor. These processes work with the kernel to handle low level functions such as printing to the screen or talking to storage hardware. But, since these functions are not handled in kernel space, a corrupted user application will not bring the entire system down. Tip: Kernel space and user space provide an important separation. Drivers and other things that affect system stability run in kernel space. 4 Operating Systems Lab Directory Structure File system: The way the files of an operating system are organized on the disk. All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally called root (written as a slash /). Linux sorts directories descending from the root directory according to their importance to the boot process. File systems from other hard drive partitions mount to directories beneath the root directory, providing access to a single directory structure. The File system hierarchy standard (FHS) governs the unified file system for Linux by defining a standard set of directories, sub-directories and files. Linux is case sensitive operating system. Directory / Description The root directory, all directories are below the / (root directory) of the system. /bin Contains binary commands available to all users. /boot Contains kernel and boot loader files. /dev Contains device files. /etc Contains system configuration files. /home Contains by default the user home directories. /lib Contains shared programs libraries and kernel modules. /root Home directory for the root user. /media Mount point for removable media. /mnt Mount point for mounting a file system temporarily. /opt Add-on application software packages. /sbin Contains system binary commands. /proc Contains information about system state and processes. /srv Contains the files for services like FTP and Web servers. /tmp Contains temporary files. /usr Contains system commands and utilities. /var Contains data files that are changed constantly. 5 Operating Systems Lab Linux Distributions Linux is actually just a kernel, so to create a complete Linux system you have to install the source code of kernel and many other freely distributed software programs. Usually distributions are put on CD that contains the kernel and programming tools and utilities. These distributions usually come with a setup program on CD to install a Linux system, they have the same kernel but with different interfaces. Some Linux distributions : Ubuntu Slackware SuSE Debain RedHat Fedora Turbo Linux Ubuntu Canonical started sending out free compact discs with Ubuntu Linux in 2004 and quickly became popular for home users (many switching from Microsoft Windows). Canonical wants Ubuntu to be an easy to use graphical Linux desktop without need to ever see a command line. Of course they also want to make a profit by selling support for Ubuntu. 6 Operating Systems Lab Download Ubuntu Go to the Official Ubuntu Download Page . Choose Ubuntu 13.04, you can choose 32 bit or 64 bit then Click 'Ubuntu 13.04'. 1 2 Click 'Not now, take me to the download ›'. 7 Operating Systems Lab Your download should start now. After finishing download, you have the ISO image of Ubuntu. To run Ubuntu from a USB stick, the first thing you need to do is insert a USB stick with at least 2GB of free space into your PC. The easiest way to put Ubuntu onto your stick is to use the USB installer provided at pendrivelinux.com. You’ll need to download and install it as follow: 8 Operating Systems Lab Click 'I Agree'. Select Ubuntu Desktop Edition from the dropdown list. 9 Operating Systems Lab Click 'Browse' and open the downloaded ISO file. 10 Operating Systems Lab Choose the USB drive and click 'Create'. 11 Operating Systems Lab Click ‘Yes’. Start installing Ubuntu on USB drive. 12 Operating Systems Lab Installation complete, click ‘close’. Install Ubuntu 13.04: Most newer computers can start up from a USB stick. You should see a welcome screen prompting you to choose your language and giving you the option to either install Ubuntu or try it from the USB as follow: Choose ‘Install Ubuntu’. 13 Operating Systems Lab If your computer does not automatically do this, you might need to change the device from which the computer starts up to the USB. You can usually do this by watching for a message appearing before Windows starts. You should be invited to change the boot device. Once you’ve selected that option, follow the instructions on screen. Tip: You might be able to press ‘F12’ or ‘Escape’ while your computer is starting up to change your boot device order. Depending on your computer and how your USB key was formatted, you should see an entry for ‘removable drive’ or ‘USB media’. Move this to the top of the list to force the computer to start from USB rather than the hard disk. Save your changes and continue. Prepare to install Ubuntu It’s recommended to plug your computer into a power source. You should also make sure you have enough space on your computer to install Ubuntu. Select Download updates while installing and Install this third-party software now. You should also stay connected to the internet so you can get the latest updates while you install Ubuntu. 14 Operating Systems Lab Set up wireless If you are not connected to the internet, you will be asked to select a wireless network, if available. Allocate drive space Choose Install Ubuntu alongside another operating system. 15 Operating Systems Lab Begin the installation Ubuntu needs about 4.5 GB to install, so add a few extra GB to allow for your files. The installation process will begin when you click the Install Now button. Select your location If you are connected to the internet, this should be done automatically. Check your location is correct and click ’continue’ to proceed. 16 Operating Systems Lab Select your preferred keyboard layout Click on the language option you need. Enter your login and password details 17 Operating Systems Lab Learn more about Ubuntu while the system installs… That’s it. All that’s left is to restart your computer and start enjoying Ubuntu! 18 Operating Systems Lab Another way to install Ubuntu: If you have any problem in installing Ubuntu from USB drive, you can try Windows installer, which will install and uninstall Ubuntu in the same way as any other Windows application. It’s simpler and completely safe. Once the Windows installer has been downloaded, you need to open it to install Ubuntu. To install Ubuntu, all you need to do is choose your user name and password. Do note that you need to enter your password twice to make sure you typed it correctly. After choosing your password, click 'Install'. The files will be downloaded and installed automatically. 19 Operating Systems Lab Wait until Ubuntu is downloaded and installed. This can take quite a while - the downloaded file size is around 500MB - but you can keep using your computer throughout. When the installation is complete, you’ll be prompted to restart your computer. Click 'Finish' to restart. 20 Operating Systems Lab After your computer restarts, choose 'Ubuntu' from the boot menu. Best Wishes