Week 1 Lab Introduction To Linux

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Department of Computer Science

Faculty of Computing
International Islamic University Islamabad

Week # 1
Lab Manual

System and Network Administration (IT371)

Undergraduate Program of BSIT

Spring 2024
Table of Contents

Sr # Topic
1 Introduction to Linux
2 Linux Distributions
3 Introduction to Ubuntu desktop
4 Installation guide of VM Ware and Ubuntu
5 GUI of Ubuntu
6 Introduction to Command Line Interpreter
7 Basic commands of BASH
8 Exercise

Department of Computer Science


Faculty of Computing, IIUI
Introduction to Linux
Linux is a popular open-source operating system kernel that powers a wide range
of computing devices, from personal computers to servers, mobile devices, and
embedded systems. It is based on Unix, an earlier operating system developed in
the 1970s. Linux is renowned for its stability, security, and flexibility, making it a
favorite among developers, system administrators, and enthusiasts alike.

Founder:
 The Linux kernel was created by Finnish-American software engineer Linus
Torvalds in 1991 while he was a student at the University of Helsinki.
 Torvalds initially developed Linux as a hobby project, inspired by his
interest in Unix-like operating systems.
 Over time, with contributions from thousands of developers worldwide,
Linux evolved into a robust and feature-rich operating system.

History:
 Linux's history traces back to the Unix operating system, which was
developed by AT&T Bell Laboratories in the late 1960s and early 1970s.
 Unix became widely adopted in academic and commercial environments due
to its portability, multitasking capabilities, and powerful utilities.
 In 1983, Richard Stallman launched the GNU Project, an initiative to create
a free and open-source Unix-like operating system.
 GNU Project developed many essential components of a Unix-like system,
such as compilers, libraries, and utilities.
 In 1991, Linus Torvalds released the first version of the Linux kernel, which
he combined with GNU software to create a complete operating system.

Department of Computer Science


Faculty of Computing, IIUI
 This combination of the Linux kernel and GNU software like (GCC, BASH,
etc) formed the basis of what is now known as the GNU/Linux operating
system.
Unix vs. Linux:
 Unix and Linux are related but distinct operating systems.
 Unix is an operating system family that originated in the 1970s at AT&T
Bell Laboratories.
 It encompasses various proprietary and open-source implementations,
including original Unix variants like BSD (Berkeley Software Distribution)
and commercial Unix versions like Solaris and AIX.
 Linux, on the other hand, is a Unix-like operating system kernel initially
developed by Linus Torvalds in 1991.

Linux Distributions
 Linux distributions, often referred to as "distros," are complete operating
system packages built around the Linux kernel.
 While the Linux kernel provides the core functionality of the operating
system, distributions include additional software packages, configuration
tools, and package management systems to create a usable and customizable
environment for users.

Distribution Description

A user-friendly distribution known for its ease of use, stability, and


extensive software repositories. It's popular among beginners and

Ubuntu experienced users alike.

Developed by the Fedora Project, sponsored by Red Hat, Fedora focuses


Fedora on innovation, integration of new technologies, and providing a cutting-

Department of Computer Science


Faculty of Computing, IIUI
Distribution Description

edge Linux experience.

A community-driven distribution known for its stability, reliability, and


commitment to free software principles. Debian serves as the foundation

Debian for many other distributions.

Derived from the sources of Red Hat Enterprise Linux (RHEL), CentOS was
CentOS (now known for its stability, long-term support, and popularity in server

CentOS environments. Recently, CentOS shifted focus to CentOS Stream, a rolling

Stream) release distribution.

Red Hat A commercial distribution offering enterprise-level support, security, and


Enterprise stability, suitable for mission-critical applications and large-scale

Linux (RHEL) deployments.

A minimalist and lightweight distribution designed for experienced users


who prefer to build their systems from the ground up, allowing for

Arch Linux maximum customization.

Sponsored by SUSE Linux GmbH, openSUSE offers a stable and flexible

distribution suitable for both desktop and server environments, with a


openSUSE focus on user choice.

Based on Ubuntu, Linux Mint provides an intuitive and familiar desktop

environment with additional multimedia codecs and proprietary software


Linux Mint support out of the box.

Based on Arch Linux, Manjaro aims to provide a user-friendly experience

with easy installation and pre-configured desktop environments, suitable

Manjaro Linux for both beginners and advanced users.

Department of Computer Science


Faculty of Computing, IIUI
Introduction to Ubuntu:

 Ubuntu is a popular Linux distribution known for its user-friendly interface,


extensive software repositories, and strong community support.
 It is developed and maintained by Canonical Ltd., a company founded by
South African entrepreneur Mark Shuttleworth.
 Ubuntu is based on Debian, another well-known Linux distribution, and it
inherits many of Debian's strengths while adding its own features and
improvements.
 Ubuntu is widely used in cloud computing environments.
 Popular cloud platforms such as Amazon Web Services (AWS), Microsoft
Azure, and Google Cloud Platform (GCP).
 Ubuntu Server editions offer robust features for server deployment,
administration, and management
List of common alternatives of windows software for Ubuntu

Here's a list of common Windows software and their alternative counterparts


available for Ubuntu:

Windows Software Ubuntu Alternative


Microsoft Office (Word, Excel,
PowerPoint) LibreOffice (Writer, Calc, Impress)

Adobe Photoshop GIMP (GNU Image Manipulation Program)

Adobe Illustrator Inkscape

Adobe Premiere Pro Kdenlive, OpenShot

Department of Computer Science


Faculty of Computing, IIUI
Windows Software Ubuntu Alternative
Adobe After Effects Blender, Natron
AutoCAD FreeCAD, LibreCAD

Visual Studio Code, JetBrains IntelliJ IDEA,


Microsoft Visual Studio Eclipse

Internet Explorer Mozilla Firefox, Google Chrome

Microsoft Edge Mozilla Firefox, Google Chrome, Chromium

Windows Media Player VLC media player, Rhythmbox


WinRAR File Roller (built-in), 7-Zip

Notepad++ Visual Studio Code, Sublime Text, Geany


Skype Skype for Linux, Zoom

iTunes Clementine, Rhythmbox, Lollypop

Microsoft Outlook Thunderbird, Evolution


Adobe Acrobat Reader Evince, Okular

Microsoft OneNote Joplin, Simplenote

Paint.NET Pinta, KolourPaint

Microsoft Paint Pinta, KolourPaint

Guide to Install VM Ware and Ubuntu


The minimum system requirements for VMware Workstation Pro 14.13 and
Ubuntu 18.04 64-bit are as follows:

VMware Workstation Pro 14.13:

Department of Computer Science


Faculty of Computing, IIUI
 A compatible 64-bit x86 Intel or AMD processor with support for Intel VT-x
or AMD-V virtualization extensions. Hardware virtualization support is
necessary for running virtual machines.
 1.3 GHz or faster core speed.
 2 GB RAM (memory) minimum. However, 4 GB or more is recommended
for better performance when running multiple virtual machines or resource-
intensive applications.
 1.5 GB of available hard disk space for the VMware Workstation Pro
installation. Additional space will be required for virtual machines and other
files.
 DirectX 10 or later graphics support for host systems. This is necessary for
running virtual machines with 3D graphics acceleration.
 A compatible host operating system, such as Windows 7/8/10 or Linux
distributions.

Ubuntu 18.04 64-bit:


 A 64-bit x86 processor (such as Intel Core 2 Duo or later, or AMD Athlon
64 or later).
 2 GHz dual-core processor or better.
 2 GB RAM (memory) minimum. However, Ubuntu recommends 4 GB or
more for optimal performance, especially when using graphical applications
or multitasking.
 25 GB of available hard disk space for installation. Additional space may be
required for user data and software installations.
 A graphics card capable of 1024x768 resolution or higher.
 A network or internet connection for downloading updates and additional
software during installation.
Department of Computer Science
Faculty of Computing, IIUI
 USB ports for installation from a USB flash drive
 Optionally, a DVD drive or USB port for installation from a CD/DVD or
USB drive

Steps to download Ubuntu:

Download the ISO of Ubuntu 18.04 LTS from the link https://old-
releases.ubuntu.com/releases/18.04.2/ubuntu-18.04-desktop-amd64.iso

After downloading the ISO file save it on your folder of your hard disk.

Steps to download and install the VM-Ware Workstation

Download the setup of VMWare Workstation Pro from the link


https://getintopc.com/softwares/virtualization/vmware-workstation-pro-14-x64-
free-download/?id=002070586062

1 - You can see the downloaded file of the installer in the screenshot below.

2 - Now, right click on the file above and choose "Run as Administrator" to launch
the installer window. You will see the welcome page as shown in the image below.

Department of Computer Science


Faculty of Computing, IIUI
3 - Once the welcome screen is loaded select "Next" to go to the next window.

4 - The next screen will ask you to accept the license agreement for this software.
Click on the check box given for accepting the license terms then select "Next".

Department of Computer Science


Faculty of Computing, IIUI
5 - The next window will allow you to select the installation location for this
software. You can change the location by clicking "Change" as shown in the
screenshot below

6 - The next screen will ask you to enable the product updates for this software. If
you choose this option, the software will be updated automatically by the system if
any updated version of the software is released in the future. You can opt out, to
manually apply the update by deselecting this option as shown below.

Department of Computer Science


Faculty of Computing, IIUI
An option is given to participate in the VMware Customer Experience
Improvement program by selecting the checkbox. If you don’t want this, deselect
the checkbox.

8 - The last screen of the configuration asks you to click "Install" to start the
installation. If you have already chosen all options correctly, go ahead and hit the
"Install" button to start the installation.

9 - Once you click "Install", installation will be started and the progress bar will be
displayed.

10 - Once installation is complete, you will see a window.

Department of Computer Science


Faculty of Computing, IIUI
If you have the License key of this software, click "License" and enter the license
key. If you do not have a license key, click "Finish" to complete this installation.
Without a license key, you will be able to use this software for 30 days.

11 - After entering the license key, select "Finish" to proceed.

12 - This installation will require a system restart. Select "yes" if you want to
reboot immediately or click "No" if you’d prefer to restart later.

13 - You can see the VMware Workstation shortcut on your desktop or start menu.
Double click on any of these shortcuts to launch the software. Below is the first
look at the software post installation. Here you can create your virtual machine
where you can install any operating systems and compatible applications on the

Department of Computer Science


Faculty of Computing, IIUI
operating systems. This tool is very user friendly to create, drop, or manage
anything on virtual machines that will be created using this software.

Steps to install Ubuntu on VMWARE Workstation

After you have downloaded the ISO of UBUNTU and you have installed the
VMWARE, now it’s the time to install UBUNTU on VMWARE. Follow the
below steps.

1. Open VMware Workstation: Launch VMware Workstation Pro on your


computer.
2. Create a New Virtual Machine: Click on "File" in the menu bar, then
select "New Virtual Machine..." This will open the New Virtual Machine
Wizard.

Department of Computer Science


Faculty of Computing, IIUI
3. Select Installation Method: Choose "Installer disk image file (iso)" and
click "Next."
4. Browse for Ubuntu ISO: Click "Browse" and navigate to the location
where you downloaded the Ubuntu ISO file. Select the ISO file and click
"Open."
5. Choose Guest Operating System: VMware Workstation should
automatically detect the guest operating system as "Linux" and the version
as "Ubuntu." If not, select "Linux" and "Ubuntu 64-bit" from the dropdown
menus. Click "Next."
6. Name the Virtual Machine: Enter a name for your virtual machine and
choose a location to save it. Click "Next."
7. Specify Disk Capacity: Specify the disk capacity for your Ubuntu virtual
machine. The default value is usually sufficient, but you can adjust it if
needed. Click "Next."

Finish Setup: Review the summary of your virtual machine settings and click
"Finish" to create the virtual machine.

Department of Computer Science


Faculty of Computing, IIUI
Install Ubuntu: With the virtual machine created, select it from the VMware
Workstation library and click "Play virtual machine" to start it. The virtual
machine will boot from the Ubuntu ISO image. Follow the on-screen instructions
to install Ubuntu on the virtual machine, including selecting language, keyboard
layout, disk partitioning, user account setup, etc.

Introduction to Command Line Interpreter (CLI)

 The command-line interpreter in Ubuntu, as in many other Linux


distributions, is known as the "shell."
 The default shell in Ubuntu is called "Bash" (Bourne Again SHell).
 The command-line interface (CLI) provides users with direct access to the
operating system's functionality through textual commands.
 You can open a terminal by searching for "Terminal" in the application
menu or by using the keyboard shortcut Ctrl+Alt+T.

Different type of CLI’s

 There are quite a few Linux shells available to use on a Linux


system. Different shells have different characteristics, some being
more useful for creating scripts and some being more useful for
managing processes.
 The default shell used in all Linux distributions is the bash shell. The
bash shell was developed by the GNU project as a replacement for
the standard Unix shell, called the Bourne shell (after its creator).
The bash shell means ‘‘Bourne again shell’’. Besides the bash shell
, there are several other popular shell as mentioned below :

Department of Computer Science


Faculty of Computing, IIUI
ash A simple, lightweight shell that runs in low-memory environments but has full compatibility

with the bash shell


korn A programming shell compatible with the Bourne shell but supporting advanced programming

features like associative arrays and floating-point arithmetic


tcsh A shell that incorporates elements from the C programming language into shell scripts
zsh An advanced shell that incorporates features from bash, tcsh, and korn, providing advanced

programming features, shared history files, and themed prompts

Purpose and Usage of CLI:


Automation:

 The CLI is well-suited for automation and scripting.


 Users can write scripts to automate repetitive tasks, schedule tasks to run at
specific times, or create complex workflows involving multiple commands
and conditions.

Remote Access:

 The CLI is often used for remote administration of systems.


 Allowing users to access and manage servers and other remote machines
over a network connection.
 Tools like SSH (Secure Shell) enable secure remote access to command-line
interfaces on remote systems.

System Administration:

 Many system administration tasks are more easily and efficiently performed
from the command line.

Department of Computer Science


Faculty of Computing, IIUI
 System administrators can use the CLI to manage users and permissions,
monitor system resources, install and update software packages, configure
network settings, troubleshoot issues, and more.

Resource Efficiency:

 The CLI consumes fewer system resources compared to graphical user


interfaces (GUIs), making it suitable for use on systems with limited
resources or in environments where resource usage needs to be minimized.

Access to Advanced Features:

 The CLI provides access to advanced features and capabilities that may not
be available or easily accessible through graphical interfaces.
 Users can interact directly with the underlying operating system and
applications, allowing for greater control and customization.

Learning and Education:

 Using the CLI can be a valuable learning experience for users who want to
develop a deeper understanding of how the operating system works and how
commands and utilities interact with system components.

Basic Commands of BASH

Right click the desktop and choose open in Terminal or use the shortcut Ctrl-Alt-T

cp copy files and directories

ls Show the contents of directory

pwd Tells your current path

mv move or rename files and directories


rm remove files and directories

Department of Computer Science


Faculty of Computing, IIUI
mkdir create directories
chmod modify file access rights
su temporarily become the superuser
chown change file ownership
chgrp change a file's group ownership
Ps list the processes running on the system
Kill send a signal to one or more processes (usually to "kill" a process)
Jobs an alternate way of listing your own processes
Bg put a process in the background
Fg put a process in the foreground

Here are example snippets for each of the commands you mentioned, along with a
brief description of what each command does:

cd (change directory):

 Command: cd [directory]
 Example: cd /home/user/Documents
 Description: Changes the current working directory to
/home/user/Documents.

cp (copy):

 Command: cp source_file destination_file


 Example: cp file1.txt /home/user/Documents/file1_backup.txt
 Description: Copies the file file1.txt to the /home/user/Documents directory
and renames it to file1_backup.txt.

ls (list):

 Command: ls [options] [directory]


Department of Computer Science
Faculty of Computing, IIUI
 Example: ls -l /home/user/Documents
 Description: Lists the contents of the /home/user/Documents directory in
long format, showing detailed information about each file and directory.

pwd (print working directory):

 Command: pwd
 Example: pwd
 Description: Prints the current working directory, which is the directory that
the user is currently in.

mv (move):

 Command: mv source_file destination


 Example: mv file1.txt /home/user/Documents/file1.txt
 Description: Moves the file file1.txt to the /home/user/Documents directory.
It can also be used to rename files.

rm (remove):

 Command: rm [options] file


 Example: rm file_to_delete.txt
 Description: Removes (deletes) the file file_to_delete.txt from the current
directory.

rmdir (remove directory):

 Command: rmdir directory_name


 Example: rmdir empty_directory
 Description: Removes the empty directory named empty_directory from the
current directory.

Department of Computer Science


Faculty of Computing, IIUI
mkdir (make directory):

 Command: mkdir directory_name


 Example: mkdir new_directory
 Description: Creates a new directory named new_directory in the current
directory.

Exercise:
Please solve the following lab exercise questions and submit them.

Command Line Navigation:

 What command would you use to navigate to your home directory?


 How would you list all files and directories in the current directory,
including hidden ones?
 Explain the purpose of the .. and . symbols in the context of directory
navigation.

File Management:

 How would you copy a file named file1.txt from the current directory to a
directory named backup within the same directory?
 Describe the difference between the cp and mv commands.
 What command would you use to delete a file named old_file.txt from the
current directory?

Directory Management:

 How do you create a new directory named new_dir within the current
directory?

Department of Computer Science


Faculty of Computing, IIUI
 Explain the difference between rmdir and rm -r. When would you use each
command?
 What command would you use to delete a directory named temp and all its
contents recursively?

Department of Computer Science


Faculty of Computing, IIUI

You might also like