Live as if you were to die tomorrow. Learn as if you were to live forever.

Tuesday 30 December 2014

Mount your own iso image on redhat linux


First create the mount point where you want to mount the iso image.

#mkdir /mntimg

Now, To mount iso image temporarily use following step


#mount -o loop -t iso9660 /image/data.iso /mntimg

Now, you have mounted the data.iso file on /mntimg directory.
You can check the entry of iso file in mtab file.


vi /etc/mtab

Now, You have mounted the iso file temporarily.

When you restart the system the iso image will unmount automatically for that you need to mount the iso permanently.

To mount iso permanently use following steps:

You need to add the entry in the fstab file


vi /etc/fstab

add the following entry



/image/data.iso /mntimg iso9660 loop,ro 0 0
wq!



You can crosscheck using the command


#mount -a

Cheers !!!! Now, You have permanently mount the iso image on /mntimg directory.

Monday 29 December 2014

Configure your own yum repository using iso image

If you have installed the RedHat/CentOS on your Desktop and you are not having the Internet connectivity. In this case you cannot install the packages using the YUM but if you wants to install the packages for that you will need to configure the YUM as follows

First of all mount iso image on the directory.

Now configure the YUM repository

Create the file under the yum.repos.d directory which is having the .repo extension.

#vi /etc/yum.repos.d/rpm.repo

add the following lines under rpm.repo file


[Repository]
name="Yum Repository"
baseurl=file:///mntimg/
enabled=1
gpgcheck=0

:wq!

Now, Try to install the package.

#yum install vsftpd

Cheers !! You have successfully configured your own yum repository.

Wednesday 24 December 2014

What is GNU ?

GNU means GNU not Unix. The important part of any O.S. is kernel. In GNU the Linux is the kernel. Linux alone cannot form O.S. but with the help of other programs “GNU” we refer as Linux.

Linux is same as like of Unix. Linux is free, multitasking, multi-user O.S. but its not user friendly, You will need some training to handle the Linux O.S.

We can say, free Unix like O.S. known as GNU.

Most of the people uses Linux as Server O.S.


Saturday 20 December 2014

Runlevels in Linux

Run-level defines the state in which O.S. and its services are running.

There are total 7 run-levels in linux and system can be booted in any of these run-levels.

Run-level
                              Description
        0
Halt / Shutdown
        1
Single User Mode
        2
Multi User without NFS
        3
Full Multiuser
        4
Unused
        5
X11 (Graphical Mode)
        6
Reboot

By default linux boots in either run-level 3 or 5
                       
The init program is used to handle all the run-levels and its process id is 1.

You can also check the process id of init using below command

[root@server]$ ps -aux | grep init
root         1  0.0  0.1  31032  1880 ?        Ss   Sep30   0:19 /sbin/init  

The /etc/inittab file contains the information regarding the run-levels.
Issue the command cat /etc/inittab
                       
            # Default runlevel. The runlevels used are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:                      

Here, see the last line in file “id:5:initdefault:” which states that the run-level of the system is 5. You can also change the run-level to 3 or 1 as per your convenience but keep in mind that these changes are permanent.

To change the run-level temporarily simply you can type the command “init run-level” i.e. init 3.

How to  check the current run-level ?

runlevel command is used to check the current run-level.

[root@server]$ runlevel
N 3

Here, N means previous run-level and 3 is the current run-level.

You can also use the command who –r


[root@server]$ who -r
         run-level 3  2014-09-30 04:23

MBR (Master Boot Loader)


MBR is the Master Boot Loader which is located at first sector of the hard disk used to find the operating system and load it into the memory.

The MBR can be created automatically when you create the partitions.

The size of MBR is 512 bytes which contains:

(i)                 Primary Boot Loader (446 Bytes)
(ii)               Partition table (64 Bytes)
(iii)             MBR Validation Check/Magic Number (2 Bytes)

(i)  Primary Boot Loader:

Primary boot loader contains partition and that partition contains the code (software program) to boot the system. The size of primary boot loader is 446 Bytes.

(ii) Partition Table:

The partition table is used to store all the information of the created partitions. In linux we can create only 4 primary partitions because the size of partition table is 64 bytes and each primary partition requires 16 byes so 16 x 4 = 64 bytes. Now size of partition size is over, that’s the reason we cannot create more than 4 partitions in linux.

(iii) MBR Validation Check/Magic Number:

If the MBR gets corrupted in this situation Magic Number restore MBR. Its size is 2 Bytes.



Friday 19 December 2014

Linux Boot Procedure


Step I: Once you power on the system it performs the POST (Power On Self Test). POST check if connected devices are working properly and ready to use. Once the POST will complete, BIOS will take the control of the booting procedure and it loads the MBR.

Step II: MBR is the Master Boot Record which present in the first sector of the Hard Disk. The size of MBR is 512 bytes.

MBR contains:
(i)                 Primary Boot Loader (446 Bytes)
(ii)               Partition Table (64 Bytes)
(iii)             Magic Number (2 Bytes)

Later we will see details about the MBR.

Now, MBR load the GRUB boot loader.


StepIII: GRUB is the Grand Unified Bootloader. GRUB configuration file is /grub/grub.conf. As we know that grub.conf contains the information regarding the kernel and it load the kernel and initrd(Initialization of Ram Disk)

Grub loads the user selected kernel into the memory and passes the control to the kernel. If you don’t select any kernel then after some time GRUB will load the default kernel into the memory.

Now the control is towards the kernel.

Step IV: Initrd is used by kernel as temporary root file system until the real root file system is mounted. Initrd also contains the driver which helps to access connected hardware.

Kernal mounts the root file system mentioned in the grub.conf file as read only and it runs the init process.

Step V: Init identifies default run level from /etc/inittab.
            There are total 7 run-levels (0-6) in linux
0                    Halt/Shutdown
1                    Single user mode
2                    Multiuser without NFS
3                    Full multiuser
4                    Unused
5                    X11 (Graphical Mode)
6                    Reboot

Based on appropriate run level scripts are executed to start and stop various processes to run the system.
Init having process ID 1.

Later we will discuss about run-levels in details.

Once the initialization of run-level completes, init process run one more file called /etc/rc.local which are the last command in the booting procedure. Once everything is completed control goes back to the kernel.

Step VI: Once kernel get the control of the booting procedure it start multiple instances of getty which waits for login console. You will get a login screen to log inside your booted system.

Thursday 18 December 2014

Get and Share the information related to Linux, Networking and Windows


Hi Guys,


I have opened this blog to share the information related to Linux and Networking.  


In this blog you will get all the information related to Linux from Linux Basic to Server confirmation. Firewall configuration to server hardening and you will come to know all interested stuff in Linux as well.


You will get the knowledge of Shell script as well. So it will be helpful to learn shell script using this blog.


I am also going to share some networking concept.


I hope here you will get the all the stuff required for a System Administrator.