Linux Unit - 1

 Unit -1 

Introduction to Linux Operating System 

Linux is a community of open-source Unix like operating systems that are based on the Linux Kernel.  It was initially released by Linus Torvalds on September 17, 1991. It is a free and open-source  operating system and the source code can be modified and distributed to anyone commercially or  noncommercially under the GNU General Public License. Initially, Linux was created for personal  computers and gradually it was used in other machines like servers, mainframe  computers, supercomputers, etc. Nowadays, Linux is also used in embedded systems like  routers, automation controls, televisions, digital video recorders, video game consoles,  smartwatches, etc. The biggest success of Linux is Android(operating system) it is based  on the Linux kernel that is running on smartphones and tablets. Due to android Linux has  the largest installed base of all general-purpose operating systems. Linux is generally  packaged in a Linux distribution. 

Architecture of Linux 

Linux architecture has the following components: 

1. Kernel: Kernel is the core of the Linux based operating system. It virtualizes the common  hardware resources of the computer to provide each process with its virtual resources. This  makes the process seem as if it is the sole process running on the machine. The kernel is also  responsible for preventing and mitigating conflicts between different processes. Different  types of the kernel are: 

Monolithic Kernel 

Hybrid kernels 

Exo kernels 

Micro kernels 

2. System Library: Isthe special types of functions that are used to implement the functionality  of the operating system.

3. Shell: It is an interface to the kernel which hides the complexity of the kernel’s functions  from the users. It takes commands from the user and executes the kernel’s functions. 

4. Hardware Layer: This layer consists all peripheral devices like RAM/ HDD/ CPU etc. 5. System Utility: It provides the functionalities of an operating system to the user. 

Advantages of Linux 

The main advantage of Linux, is it is an open-source operating system. This means the source  code is easily available for everyone and you are allowed to contribute, modify and  distribute the code to anyone without any permissions. 

In terms of security, Linux is more secure than any other operating system. It does not mean  that Linux is 100 percent secure it has some malware for it but is less vulnerable than any  other operating system. So, it does not require any anti-virus software. 

The software updates in Linux are easy and frequent. 

Various Linux distributions are available so that you can use them according to your  requirements or according to your taste. 

Linux is freely available to use on the internet. 

It has large community support. 

It provides high stability. It rarely slows down or freezes and there is no need to reboot it  after a short time. 

It maintain the privacy of the user. 

The performance of the Linux system is much higher than other operating systems. It allows  a large number of people to work at the same time and it handles them efficiently. 

It is network friendly. 

The flexibility of Linux is high. There is no need to install a complete Linux suit; you are  allowed to install only required components. 

Linux is compatible with a large number of file formats. 

It is fast and easy to install from the web. It can also install on any hardware even on your  old computer system. 

It performs all tasks properly even if it has limited space on the hard disk. Linux Distribution

Linux distribution is an operating system that is made up of a collection of software based on Linux  kernel or you can say distribution contains the Linux kernel and supporting libraries and software.  And you can get Linux based operating system by downloading one of the Linux distributions and  these distributions are available for different types of devices like embedded devices, personal  computers, etc. Around 600 + Linux Distributions are available and some of the popular Linux  distributions are: 

MX Linux 

Manjaro 

Linux Mint 

elementary 

Ubuntu 

Debian 

Solus 

Fedora 

openSUSE 

Deepin 

∙ 

Linux installation process  

This is a popular method to install a Linux operating system. The virtual installation offers you the  freedom of running Linux on an existing OS already installed on your computer. This means if you  have Windows running, then you can just run Linux with a click of a button. 

Virtual machine software like Oracle VM can install Linux on Windows in easy steps. Let us look at  them. 

Here the brief steps 

PART A) Download and Install Virtual Box 

Download Virtual box using this link 

Depending on your processor and OS, select the appropriate package. In our case, we have selected  Windows with AMD

Once the download is complete, Open setup file and follow the steps below: Step-1) Click On next 

Step-2) Select you’re the directory to install VirtualBox and click on next

Step-3) Select Desktop icon and click on next, now click on yes Step-4) Click On install to install Linux on Windows. 

Step-5) Now installation of the virtual box will start. Once complete, click on Finish Button to  start Virtual Box

The virtual box dashboard looks like this 

PART B) Download Ubuntu 

Visit this link to download Ubuntu. 

You can select 32/64-bit versions as per your choice.

PART C) Create a Machine in Virtual Box 

Step-1) Open Virtual box and click on new button 

Step-2) In next window, give the name of your OS which you are installing in virtual box. And  select OS like Linux and version as Ubuntu 32 bit. And click on next 

Step-3) Now Allocate Ram Size To your Virtual OS. I recommended keeping 1024mb (1 GB)  ram to run Ubuntu better. And click on next.

Step-4) Now To run OS in virtual box we have to create virtual hard disk, click on create a  virtual hard drive now and click on create button. 

The virtual hard disk is where the OS installation files and data/applications you create/install  in this Ubuntu machine will reside 

Step-5) select VHD (virtual hard disk) option and click on next.

Step-6) Click on dynamic allocated and click on next. This means that the size of the disk  will increase dynamically as per requirement. 

Step-7) Allocate memory to your virtual hard drive .8GB recommended. Click on create  button.

Step-8) Now you can see the machine name in left panel 

So a Machine (PC) with 8GB Hardisk, 1GB RAM is ready. PART D) How to Install Ubuntu 

Step 1) Select the Machine and Click on Start

Step 2) Select the Folder Option 

Step 3) Select the Ubuntu iso file

Step 4) Click Start 

Step-5) You have an option to Run Ubuntu WITHOUT installing. In this tutorial will install  Ubuntu 

Step-6) Click continue.

Step-7) Select option to erase the disk and install Ubuntu and click on install now. This  option installs Ubuntu into our virtual hard drive which is we made earlier. It will not harm  your PC or Windows installation 

Step-8) Select your location for setting up time zone, and click on continue

Step-9) Select your keyboard layout, by default English (US) is selected but if you want to  change then, you can select in the list. And click on continue

Step-10) Select your username and password for your Ubuntu admin account. This  information has been needed for installing any software package into Ubuntu and also for  login to your OS. Fill up your details and tick on login automatically to ignore login attempt  and click on continue 

Step-11) Installation process starts. May take up to 30 minutes. Please wait until installation  process completes. 

Step-12) After finishing the installation, you will see Ubuntu Desktop.

Hardeware Requirements of linux 

Minimum RAM, central processing unit and hard disk(HDD) requirement for the desktop edition  of the Debian based OS and the RedHat based OS is as listed here. 

1. RAM: 

To run the Linux OS smoothly minimum 1-2 GB RAM is required. The actual minimum memory  requirements for the Linux operating system only (without any additional software) are less than  these numbers. For example, it is possible to install Debian with 20MB RAM. 

2. Central Processing Unit: 

Linux can give optimum performance on an Intel Pentium or a higher processor. Linux also  supports non-Intel processors such as the Cyrix 6x86 and the AMD K5 and K6. 

3. Hard Disk 

A 4 to 5 GB hard disk is enough to store the system and other important files of a Linux  distribution. However, to store users' data it is recommended to have at least 25 GB hard disk  size. 

More efficient hardware produced in the last few years means Linux can often work well with  drive storage (HDD). For example, a netbook with an 8 GB hard disk will work well if user data is  directly stored onto the cloud. A good rule of thumb is that machines that could run XP, Vista,  and Windows 7 will almost always be a lot faster with Linux even if they are lower-spec than  described. 

4. Choosing the Best Distribution 

No distribution is best, and none is the worst. The good thing about Linux is that it has got a  distribution for almost all user needs. Your requirement/usage will determine distribution suits  best. Here are some key factors, which you can consider while choosing a Linux distribution. 

5. Graphical User Environments(GUI) 

The desktop environment, or the graphical user interface (GUI), is the interface the user sees  when operating the system. When choosing a Linux distribution, find the most  suitable/convenient GUI from a variety of choices. In the Microsoft Windows OS, users only have  one desktop manager, while the Linux users can choose their desktop environment. Popular  Linux desktop managers include KDE, Gnome, Xfce, Cinnamon, and LXDE. 

Partitioning in Linux 

Disk Partitioning is the process of dividing a disk into one or more logical areas, often known as  partitions, on which the user can work separately. It is one step of disk formatting. If a partition  is created, the disk will store the information about the location and size of partitions in the 

partition table. With the partition table, each partition can appear to the operating system as a  logical disk, and users can read and write data on those disks. The main advantage of disk  partitioning is that each partition can be managed separately. 

Why we need it? 

To upgrade Hard Disk (to incorporate new Hard Disk to the system) 

Dual Booting (Multiple Operating Systems on the same system) 

Efficient disk management 

Ensure backup and security 

Work with different File Systems using the same system 

How to Partition Disks in Linux? 

(For the purpose of demonstration Cent OS 7 and Vmware are used in the screenshots of the  article.) 

In order to successfully partition a disk and to make it useful, we need to ensure that, we have  completed the below four steps, regardless of the Operating system and Hardware of the  system. 

1. Attach disk on the proper port 

2. Create partitions in the disk 

3. Create a file system on the partition 

4. Mounting the file systems 

Virtual memory space 

Linux supports virtual memory, that is, using a disk as an extension of RAM so that the effective size  of usable memory grows correspondingly. The kernel will write the contents of a currently unused  block of memory to the hard disk so that the memory can be used for another purpose. When the  original contents are needed again, they are read back into memory. This is all made completely  transparent to the user; programs running under Linux only see the larger amount of memory  available and don't notice that parts of them reside on the disk from time to time. Of course, reading  and writing the hard disk is slower (on the order of a thousand times slower) than using real  memory, so the programs don't run as fast. The part of the hard disk that is used as virtual memory  is called the swap space

Linux can use either a normal file in the filesystem or a separate partition for swap space. A swap  partition is faster, but it is easier to change the size of a swap file (there's no need to repartition the  whole hard disk, and possibly install everything from scratch). When you know how much swap  space you need, you should go for a swap partition, but if you are uncertain, you can use a swap file 

first, use the system for a while so that you can get a feel for how much swap you need, and then  make a swap partition when you're confident about its size. 

You should also know that Linux allows one to use several swap partitions and/or swap files at the  same time. This means that if you only occasionally need an unusual amount of swap space, you can  set up an extra swap file at such times, instead of keeping the whole amount allocated all the time. 

A note on operating system terminology: computer science usually distinguishes between swapping  (writing the whole process out to swap space) and paging (writing only fixed size parts, usually a few  kilobytes, at a time). Paging is usually more efficient, and that's what Linux does, but traditional  Linux terminology talks about swapping anyway. 

KDE and GNOME Desktop  

KDE and GNOME are Linux desktop systems. KDE is an international project, which is known provide  a developed and distributed open source software for desktop and portable computing; whereas  GNOME is a part of free and open source GNU projects, known to provide the similar windows  desktop systems, applicable to work for Unix systems. 

GNONE 

GNOME basically is a graphical user interface and a desktop environment project. It is made up of  entirely free and open source software components, which are developed by the largest corporate  contributors of Red Hat, the volunteers and paid contributors. It is an international project that  includes the creation of software development frameworks and selection of application software for  the desktop. It works on the programs that manage the launching of applications, file handling along  with windows and task management. 

The GNOME project puts heavy emphasis on simplicity, usability, and making things “just work”. The  other aims of the project are: 

Freedom 

Internationalization and localization 

Developer-friendliness 

Organization 

Support 

KDE 

KDE is known for its plasma Desktop environment, which provides a default working environment  for several Linux distributions, such as the open SUSE, Mageia and Kubuntu and is default desktop  environment on PC-BSD a BSD operating system. The basic aim of the KDE community is to facilitate  the basic desktop functions and its applications for the daily purposes. It also provides tools and  documentations for documentations for the programmers and developers to write stand-alone  applications for a system. KDE software is based on the Qt framework. The projects of KDE work  under the KDE technologies, and there are several such small and large projects 

conducted under the KDE technology. There are several libraries and services to run the KDE  applications. 

KDE is a platform, which is mainly coded in C++ and includes the mature bindings for other  programming languages such as the: 

Python 

Ruby (Korundum, built on top of QtRuby) 

C# 

Perl 

What is a boot loader? 

A boot loader, also called a boot manager, is a small program that places the operating system (OS)  of a computer into memory. When a computer is powered-up or restarted, the basic input/output  system (BIOS) performs some initial tests, and then transfers control to the Master Boot Record  (MBR) where the boot loader resides. Most new computers are shipped with boot loaders for some  version of Microsoft Windows or the Mac OS. If a computer is to be used with Linux, a special boot  loader must be installed. 

For Linux, the two most common boot loaders are known as LILO (LInux LOader) and LOADLIN (LOAD  LINux). An alternative boot loader, called GRUB (GRand Unified Bootloader), is used with Red  Hat Linux. LILO is the most popular boot loader among computer users that employ Linux as the  main, or only, operating system. The primary advantage of LILO is the fact that it allows for fast  boot-up. LOADLIN is preferred by some users whose computers have multiple operating systems,  and who spend relatively little time in Linux. LOADLIN is sometimes used as a backup boot loader for  Linux in case LILO fails. GRUB is preferred by many users of Red Hat Linux, because it is the default  boot loader for that distribution. 

shutdown 

The shutdown command brings down system in a secure way. All the logged-in users are notified  about the system shutdown. 

Signal SIGTERM notifies all the processes that the system is going down, so that processes can be  saved and exit properly. 

Command shutdown signals the init process to change the runlevel. 

Runlevel 0 halts the system 

Runlevel 6 reboots the system 

Runlevel 1 is default state. 

Five minutes before shutdown sequence starts, file /etc/nologin is created when shutdown is  scheduled for future which does not allow new user logins.

If by any reason, command shutdown is stopped before signalling init, this file is removed. It is also  removed to change runlevel before signalling init. 

To run shutdown command root user access is required. 

LOGIN 

The login program is used to establish a new session with the system. It is normally invoked  automatically by responding to the "login:" prompt on the user's terminal. login may be special to  the shell and may not be invoked as a sub-process. When called from a shell, login should be  executed as exec login which causes the user to exit from the current shell (and thus prevents the  new logged in user to return to the session of the caller). Attempting to execute login from any shell  but the login shell produces an error message. 

Syntax 

login [-p] [-h host] [username] [ENV=VAR...] 

login [-p] [-h host] -f username 

login [-p] -r host 

Options

-f 

Do not perform authentication; user is pre-authenticated. In that  case, username is mandatory.

-h 

Name of the remote host for this login.

-p 

Preserve environment.

-r 

Perform autologin protocol for rlogin.



No comments:

Post a Comment