linux basics | history | practice set up | architecture

52
Linux Basics Tutorial Who this Linux course is for ? In organization level, there could be different levels of Linux knowledge requirement based on JOB Role. Here, we present how our content can be used to achieve their respective purpose. We have arranged everything in an organized way, keeping one's individual goals. If you are not a Linux administrator? But need to have Linux basic skill set to support your technology, then you can follow "First steps" in Linux. If you are a Linux Administrator? In a corporate environment, a Linux admin has to work with different teams such as Networking, security or other application & technology administration teams. So, we need to have a good amount of basic or in-depth knowledge of those sectors. This will help one's job easy in resolving the issues and supporting the projects.

Upload: abclearnn

Post on 12-Apr-2017

68 views

Category:

Education


2 download

TRANSCRIPT

Linux Basics Tutorial

Who this Linux course is for ?

In organization level, there could be different levels of Linux knowledge requirement based on JOB Role. Here, we present how

our content can be used to achieve their respective purpose.

We have arranged everything in an organized way, keeping one's individual goals.

If you are not a Linux administrator?

But need to have Linux basic skill set to support your technology, then you can follow "First steps" in Linux.

If you are a Linux Administrator?

In a corporate environment, a Linux admin has to work with different teams such as Networking, security or other application &

technology administration teams.

So, we need to have a good amount of basic or in-depth knowledge of those sectors. This will help one's job easy in resolving the

issues and supporting the projects.

If you are aiming for Linux Interview Questions with examples?

Then we have the full in-depth review of Linux questions based on topic wise. We have presented Linux command with practical

example and their usage in real time project support.

Advantages:

Questions are organized at each topic level

Also listed out the practical usage of those Linux commands with examples

We have presented diagrams representations for most of the questions for easy understanding.

Also, these questions are aligned for RHEL certifications also.

What is an operating system

An operating system is a software which acts as an interface between the user and the hardware.

Commonly used operating systems are Windows, MAC- osX, UNIX/Linux.

What are the Functions of operating system?

Booting the system.

Managing the basic computer tasks like managing various peripherals for example mouse and

keyboard.

Provides user interface like CLI (command line interface) and GUI (Graphical user interface).

Handles system resources such as computer's memory and sharing of the central processing unit (CPU).

What is Hardware?

Hardware comprises of physical devices like CPU, Monitor, printer, mouse etc.,

The user can perform several tasks on hardware using the operating system. This shows that the

operating system is an interface between the user and the hardware.

The process of accessing the hardware.

List out Different Operating systems as you know?

Note:

Above mentioned are a couple of operating systems that we know so far and a couple we might

encounter over a period in IT industry. There are other operating systems like RTOS,

VXWorksetc..Wedin’tspecify here.

In this tutorial, we are going to focus more on Linux based operating systems for enterprise servers.

Topics Summary

1.What is an operating system?

2.What are the Functions of operating system?

3.What is Hardware?

4.List out Different Operating systems as you know?

History of Linux operating system

In 1969 Ken Thompson developed UNIX in bell laboratories. The UNIX operating system was

developed basically using the c programming language.

Later the years passed on several operating systems are developed using the UNIX some of them are

HP-UX, Apple computer’s A/UX, IBM’s AIX etc.,

In 1990’s Linus Torvalds, a graduate student from the University of Helsinki designed a kernel on

80386 Intel machine and gave this to OSF (Open Source Foundation).

From his name the kernel was named as Linux kernel. By collaborating this kernel with

the GNU applications a complete UNIX like os was developed and that is called Linux OS.

Linus' UNIX -> Linux

Linus Torvalds

The good competitors of Linux were windows, Solaris, IBM-AIX, HP-UX etc.

Previous:: What is os? Next:: Distributions and features of Linux

Additional links

What is kernel?

Linux Linus' UNIX

Features of Linux OS

Linux OS is multiuser, multitasking operating system and portable to be installed on any hardware

platform. Linux OS provides robut security features in comparative to other desktop operating

systems.

Linux operating system distributions in tree format

Linux Kernel was bundled with many others software packages from various distributors and named

it there own distributions. We can see such distribution list in tree format.

Linux Distros Tree:

What are the Features of Linux?

Multitasking:

Linux OS is capable of running multiple applications and processes at the same time.

Multiuser :

It means more than one user can shares the same system resources (hard disk,memory, printer,

application software etc..) at the same time.

Portability:

Linux OS can be installed on all hardware architectures.

Reliability:

Linux OS servers are highly available and requires less downtime. And this enables small to large

organizations to equip linux server for their application hostings.

Security:

Linux OS provides robut security features in comparative to other desktop operating systems

particularly - windows operating system. For example,

Linux servers are more insulated to viruses than its counter part windows.

Email attachments are not directly executable in linux machines.

Clustering:

Multiple linux servers can be harnessed as part of high performance cluster. This provides highly

available application services during hardware failures on any box.

RHEL Download in Linux OS

RHEL is an enterprise version Linux operating system distributed by Redhat organization. It is a

licensced product. But redhat also provides a 30 days evaluation version of actual RHEL software.

We have downloaded the evaluation version for our setup purpose.

Step by Step Procedure for registration & download:

To download Redhat Enterprise Linux Register at https://access.redhat.com/.

Click the login button on the right side top corner of the window.

After clicking on register enter your details and create an account for yourself.

Login with the registered credentials and proceed further.

After logging in to Redhat website, we can see following window.

Click on downloads tab and then select the "Red Hat Enterprise Linux - Start Evaluation" link.

Click the continue tab under "Red Hat Enterprise Linux server". Then the following window will appear.

In the above window click on the "Download latest" in green colour to download the Iso file.

From the above screen we can select the version of rhel we want to download. We have

selected rhel 6.5 and the architecture is x86_64. The architecture may vary from hardware to

hardware.

Now scroll down window till the following appears.

Click the download button for initiating the downloading.

Now your .iso file is ready for installation.

How to Install Linux(RHEL) OS:

After downloading the RHEL from redhat web site, we can proceed with installation. Here, we have

explained step by step linux installation with screen shots.

Note:

Whatever installation we are doing that is for our lab purpose only. In reality when we work in an

organization, we don't actually download the software from website and we don't follow graphical

installation steps. Please keep this in mind.

Linux-OS-Installation-Step-By-Step

We have RHEL software available as a bootable DVD.

Go to the bios settings and change the boot sequence priority to the cdrom.

Insert the cd or dvd in the drive and start the system.

Whenever the system is booting the following screen will appear.

In the above screen, there are some options available and choose "install or upgrade an

existing system" and press enter to start with the installation.

Now the following window will appear for the hardware check.

Choose OK to test the available media otherwise, Skip.

Choose the language, when language screen appears.

Select the type of the keyboard and click next.

As we are configuring this system for lab purpose only, we will choose "basic storage

devices" and click next.

Name the system from the hostname text box and click next.

We can choose any name as hostname or a better approach is follow your organization

standards.

Select the time zone of the server from next screen.

Now the following window will be displayed to enter a root password for the server.

Next screen is very important as we have to format the Linux partitions according to our

requirements. To create our own partitions, we select "create a custom layout" and then click

Next.

Now the following window will be displayed to create the partitions our own. Click

"Create" button to create the partition.

After clicking the "create button" the following window will be displayed. Select the

"standard partition" option and click the "create" button.

Following window will be displayed,

Select mount point as ‘/’ which is our root file system, file system type is ext4 and the size is

15000 MB.

Click OK to create the partition.

Note:

Choose the file system type as "ext4".

Similarly, create the /boot file system as follows.

Create swap as well as shown below.

By creating the file system when we click ok the following window will be displayed.

In this window, we will see all the created file systems summary. Click next.

By clicking next the following window will be displayed for making changes to the disk.

Click on the format button and then write changes to the disk.

By clicking next the following window will be displayed to load the boot loader to the

particular partition.

We have selected /dev/sda1 slice or partition for loading the boot loader and then click next.

In the next screen the following window will be displayed to select the software set. Select

the desktop option and click next.

After the dependency checks, the following window will appear and installation continues.

After completing the packages installation click on reboot.

The system will reboots and welcome screen will appear. It will guide us through couple of

more settings.

Click Forward.

Accept the licensce agreement.

We can create any new user which is not a root user and proceed further.

Select the date and time and click forward.

Allocate some storage foe kdump.

If any system crashes the total important data and the causes for the crash are stored in this

dump.

Now login to the server using username as root and password as you mentioned during the

installation.

After logging in to our lab server, we are ready to work with further setups.

Linux Login with Putty

For practicing different tasks on the system there are two ways to login to the system

1. Login directly to the system and open the terminal on the desktop and start practicing.

2. Log in to the server remotely through the putty tool.

Login directly to the system:

Log in to the installed machine as the root.

Right, click on the desktop of the machine.

On the menu select open terminal.

Log in to the system through putty:

Download the putty tool from http://www.putty.org/ .

Open putty and give IP address of the server, select the ssh protocol and port number 22.

To know the ip address of the server go to the machine and open terminal run ifconfig –a

command.

Linux OS Architecture

The architecture of Lnix based os contains three parts majorly they are

Shell - It is an interface between user and kernel. It interprets the user commands and executes them on kerne. To know more about Shell, clik Shell

Kernel - Kernel is the part of the operating system that interacts directly with the hardware.

More on kernel, refer Kernel

Hardware - it is combination of all peripherals associated with system. For example, RAM,

CPU, printer, scanner, Harddisk etc.

For example, we are saving or modifying the file in our system. This means that we are making the

changes in the hard disk, but we are not making the changes in the hard disk directly.

We are instructing the shell to perform a suitable task though commands.

Shell decodes this command to machine understandable language and sent to kernet for execution.

The kernel generates the instruction set to the processor and processor will make the changes directly on hard disk by using the memory.

Here memory, processor and the hard disk are in hardware layer.

Types of shells in Linux

There are different types of shells available on any linux machine. Primarily we need to understand

about, Bourne shell, Korn shell and bash shell etc. But before getting into types of shell, let's

understand a bit more on Shell.

What is SHELL?

It is an interface between user and kernel. It is an interpreter that executes the commands given by

the user. Shell is not a part of the kernel but it uses the kernel to execute the commands.

Every shell will do the same tasks or functions but the syntax of commands are different for different

shells and provide different built-in functions.

In MS-DOS the shell is command.com and the shell in windows the shell is power shell.

What are the shells available on Linux?

Some shells are available in the RHEL are c-shell, bash shell, korn shell etc.,

To know the list of shells available on our Linux, the command is as follows.

[root@sys3 ~]# cat /etc/shells /bin/sh /bin/bash /sbin/nologin /bin/dash /bin/tcsh /bin/csh

1. /bin/sh represents Bourne shell which is default shell in solaris.

2. /bin/bash represents Bourne again shell. This shell is improved version of Bourne shell. This is the

default shell in Linux.

3. /bin/dash represents DebianAlmquist shell. It is the default shell in Debian OS.

4. /bin/csh represents c-shell.

5. /bin/tcshtepresents advanced c-shell.

What is “/sbin/nologin”?

From the above output all shells are available in /bin directory. Except for one thing that is

“/sbin/nologin”.

/sbin/nologin - represents the no shell.

For example I am creating a user for the authentication of FTP server. For this user there is no need

to have a shell to download the files. At that situation as an admin we can create a userid with no

shell.

This makes possible by using “/sbin/nologin” with attribute –s of “useradd” command. To know

about creating the user having noshell click here.

Note:

This attribute is performed by the administrator only. Because of that it lies on /sbin directory. /sbin

represents super user binary executable files.

How to know the default working Shell?

To know the default shell of the particular Linux operating system the command is,

[root@sys3 ~]# echo $SHELL /bin/bash

How to go from one shell to another shell?

To change the current working shell simply enter the individual shell command in the terminal.

If you want to change the shell from bash to c- shell simply enter the command as “csh”. To change

to bash shell, type "bash" in terminal window.

How to check our current working shell?

To check the current working shell type the command # echo $0.

[root@sys3 ~]#csh [root@sys3 ~]# echo $0 Csh

How to revert back to the previous shell?

To revert from that shell simply type "exit" on the terminal.

[root@sys3 ~]# exit exit [root@sys3 ~]# echo $0 -bash

Topics Summary

1.What is SHELL?

2.What are the shells available on Linux?

3.What is “/sbin/nologin”?

5.How to know the default working Shell?

6.How to go from one shell to another shell?

7.How to check our current working shell?

8.How to revert back to the previous shell?

Kernel Architecture in Linux

What is the KERNEL?

Kernel is the part of the operating system that interacts directly with the hardware. It is used to

provide an application interface between programs and physical devices.

Most of the kernel programming is done in C language and the kernel is the heart of the operating

system.

There are three types of kernels available,

1. Monolithic kernels - these are mostly used by Linux operating systems.

2. Micro kernels - are used for Minix operating systems.

3. Hybrid kernels - are mostly used b Windows and OS-X systems.

We can learn more about kernel and their internal programming in detailed in Kernel programming

course.

Topics Summary

1.What is the KERNEL?