Pages

Thursday, May 16, 2013

Kickstart Installation

Redhat KickStart Installation step by step guide

To use kickstart, you must:
1. Create a kickstart file.
2. Create a boot media with the kickstart file or make the kickstart file available on the network.
3. Make the installation tree available.
4. Start the kickstart installation.


Genral Installation and automatic creation of kickstart file

step 1 : Connect system to DHCP network
Step 2 : Boot your system using Redhat boot media.
Step 3 : Enter command "linux askmethod" at boot prompt and press enter.
step 4 : Follow the installation process till it asks for Installation Method.

The options for installation method incude.

Local CDROM
Hard Drive
NFS Image  ( Network installation )
FTP  ( Network installation )
HTTP ( Network installation )

Select your method and install accordingly.

After installation /root/anaconda-ks.cfg file is automatically created during Install.

/root/anaconda-ks.cfg can be used as a template for future installation.

It is a scripted installation process.

we can manually configure with System-Config-Kickstart

Check systax of Kickstart file with : ksvalidator
 
System-Config-Kickstart mykickstartfile.ks

Once you are ready with Kickstart file lets start installation with Kickstart file.


for installation with kickstart we should give following command at boot prompt

linux ks= Url

Ks will queries DHCP for kickstart location
URl gets file via HTTP or FTP or NFS.

we can also give local address like

KS=floppy; ks=Cdrom or ks= hd:device:/path of the file.


Using a NFS Server

Verify that the first two lines of the file look like this or else you may be prompted for NFS ISO file location information.

install
nfs --server=192.16.1.100 --dir=/data/network-install/ISO


example : linux ks=nfs:192.168.1.100:/kickstart/ks.cfg

Run this at boot prompt with your settings for NFS ks installation

Using a Web Server

Verify that the first two lines of the file look like this or else you may be prompted for RPM base file location information.

install
url --url http://192.168.1.100/network-install/

example : linux ks=http://192.168.1.100/network-install/kickstart/ks.cfg

Run this at boot prompt with your settings for http ks installation

Comming to Kickstart file it consists of three sections

1 command section
2 packages section
3 scripts section



Note 1: Do not change the order of the entries in the kickstart configuration file.
Note 2: The IP address you assign must be on the same subnet as that of the DHCP server for kickstart to work. If the server is going to reside on a different network after the installation, then you have to run a separate script to change the IP addressing information after the installation is complete.

Redhat refrence links for Kickstart

What are Kickstart Installations ? explained by Redhat
How Do You Perform a Kickstart Installation? explained by Redhat
Creating the Kickstart File  explained by Redhat
Kickstart Options  explained by Redhat
Pre-installation Script explained by Redhat
Post-installation Script explained by Redhat
Making the Kickstart File Available explained by Redhat
Starting a Kickstart Installation explained by Redhat
Kickstart Configurator explained by Redhat
Installation Method explained by Redhat

Access Your MySQL Server Remotely Over SSH

So you’ve got MySQL on your web server, but it’s only opened to local ports by default for security reasons. If you want to access your database from a client tool like the MySQL Query Browser, normally you’d have to open up access from your local IP address… but that’s not nearly as secure.
So instead, we’ll just use port-forwarding through an SSH tunnel, so your MySQL client thinks it’s connecting to your localhost machine, but it’s really connecting to the other server through the tunnel.
If you are using the command line ssh, the command would look like this. (You can do the same thing graphically in Putty or SecureCRT options if you need to)
ssh -L 3306:localhost:3306 geek@webserver.com
The syntax is ssh -L <localport>hostname<remoteport> <username>@<servername>. We’re using localhost as the hostname because we are directly accessing the remote mysql server through ssh. You could also use this technique to port-forward through one ssh server to another server.
If you already have mysql running on your local machine then you can use a different local port for the port-forwarding, and just set your client tools to access MySQL on a different port.
image
Once you’ve got the ssh tunnel going, you can open up MySQL Query Browser and enter in the details for your remote server, using localhost as the server host, and adjust the port to whatever you used.
Once you get used to this method, you’ll wonder why you ever used phpmyadmin or the command line version.

Wednesday, May 15, 2013

Linux Bootprocess

The following are the 6 high level stages of a typical Linux boot process.


1. BIOS

  • BIOS stands for Basic Input/Output System
  • Performs some system integrity checks
  • Searches, loads, and executes the boot loader program.
  • It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key (typically F12 of F2, but it depends on your system) during the BIOS startup to change the boot sequence.
  • Once the boot loader program is detected and loaded into the memory, BIOS gives the control to it.
  • So, in simple terms BIOS loads and executes the MBR boot loader.

2. MBR

  • MBR stands for Master Boot Record.
  • It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda
  • MBR is less than 512 bytes in size. This has three components 1) primary boot loader info in 1st 446 bytes 2) partition table info in next 64 bytes 3) mbr validation check in last 2 bytes.
  • It contains information about GRUB (or LILO in old systems).
  • So, in simple terms MBR loads and executes the GRUB boot loader.

3. GRUB

  • GRUB stands for Grand Unified Bootloader.
  • If you have multiple kernel images installed on your system, you can choose which one to be executed.
  • GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file.
  • GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t understand filesystem).
  • Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). The following is sample grub.conf of CentOS.
·         #boot=/dev/sda
·         default=0
·         timeout=5
·         splashimage=(hd0,0)/boot/grub/splash.xpm.gz
·         hiddenmenu
·         title CentOS (2.6.18-194.el5PAE)
·                   root (hd0,0)
·                   kernel /boot/vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/
          initrd /boot/initrd-2.6.18-194.el5PAE.img
  • As you notice from the above info, it contains kernel and initrd image.
  • So, in simple terms GRUB just loads and executes Kernel and initrd images.

4. Kernel

  • Mounts the root file system as specified in the “root=” in grub.conf
  • Kernel executes the /sbin/init program
  • Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.
  • initrd stands for Initial RAM Disk.
  • initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.

5. Init

  • Looks at the /etc/inittab file to decide the Linux run level.
  • Following are the available run levels
    • 0 – halt
    • 1 – Single user mode
    • 2 – Multiuser, without NFS
    • 3 – Full multiuser mode
    • 4 – unused
    • 5 – X11
    • 6 – reboot
  • Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program.
  • Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run level
  • If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that.
  • Typically you would set the default run level to either 3 or 5.

6. Runlevel programs

  • When the Linux system is booting up, you might see various services getting started. For example, it might say “starting sendmail …. OK”. Those are the runlevel programs, executed from the run level directory as defined by your run level.
  • Depending on your default init level setting, the system will execute the programs from one of the following directories.
    • Run level 0 – /etc/rc.d/rc0.d/
    • Run level 1 – /etc/rc.d/rc1.d/
    • Run level 2 – /etc/rc.d/rc2.d/
    • Run level 3 – /etc/rc.d/rc3.d/
    • Run level 4 – /etc/rc.d/rc4.d/
    • Run level 5 – /etc/rc.d/rc5.d/
    • Run level 6 – /etc/rc.d/rc6.d/
  • Please note that there are also symbolic links available for these directory under /etc directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d.
  • Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K.
  • Programs starts with S are used during startup. S for startup.
  • Programs starts with K are used during shutdown. K for kill.
  • There are numbers right next to S and K in the program names. Those are the sequence number in which the programs should be started or killed.
  • For example, S12syslog is to start the syslog deamon, which has the sequence number of 12. S80sendmail is to start the sendmail daemon, which has the sequence number of 80. So, syslog program will be started before sendmail.
There you have it. That is what happens during the Linux boot process.