Wednesday, February 29, 2012

Remote installation of centos linux

Sponsored Links
Remote installation of centos linux
Remote installation or installing centos linux from a remote location can be done is a few ways. We can do remote installation using mainly three methods. NFS, FTP and HTTP. And when doing remote installation we can pull the graphical screen via VNC to our local system. We can categorize the installation again into two. Attended and unattended. In attended installation, we have to sit in front of the system and give answers. In unattended installation, we can write the answers into a file and notify the installation process to read the answers from it. In linux unattended installation can be done with kickstart file. We can save all things in some installation server and configure network instillation via PXE so that it'll need just a few clicks for the entire installation. We will discuss all the following methods in this article.


1. NFS
2. FTP
3. HTTP
4. VNC
5. PXE
6. Kickstart

For this example we will use the following network settings, you must adjust to your own network:
SERVER IP: 192.168.137.100
Netmask: 255.255.255.0
Gateway: 192.168.137.1
DNS:  192.168.137.100 , 8.8.8.8
Server Network Interface: eth0
Workstation Machine: 192.168.1.200
VNC Password: qwerty 

1. Remote installation Using NFS


NFS is network filesystem. It is a popular way to share directories between linux systems.

When using NFS for the remote installation, we will create one nfs share of centos dvd on a server machine and we will boot the client using a bootable disk/usb device. And when asked we will provide the nfs share details to client so that it can continue with the installation.

Checking which package is installed or not. Else intall it with "yum install nfs-utils"
[root@server ~]# rpm -qf /etc/init.d/nfs
nfs-utils-1.0.9-33.el5
[root@server ~]#

Checking whether the nfs service is working or not. /etc/init.d/nfs is the nfs service startup script
[root@server ~]# /etc/init.d/nfs status
rpc.mountd is stopped
nfsd is stopped

Starting the nfs service
[root@server ~]# /etc/init.d/nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@server ~]#

Mounting the cdrom to the mount point /media/CentOS.
[root@server ~]# mount /dev/cdrom /media/CentOS
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@server ~]#

Sharing the mount point using nfs . * -means it is shared to all ips. ro -means read only.
[root@server ~]# cat /etc/exports
/media/CentOS *(ro)
[root@server ~]#

Activating all the nfs shares specified in /etc/exports
[root@server ~]# exportfs -a

Checking the permissions of the share
[root@server ~]# exportfs -v
/media/CentOS   <world>(ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)

Checking the available shares in the machine
[root@server ~]# showmount -e localhost
Export list for localhost:
/media/CentOS *
[root@server ~]# showmount -e 192.168.137.100
Export list for 192.168.137.100:
/media/CentOS *
[root@server ~]#

Checking the service's ports and other services associated with it
[root@server ~]# rpcinfo -p
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100011    1   udp    801  rquotad
    100011    2   udp    801  rquotad
    100011    1   tcp    804  rquotad
    100011    2   tcp    804  rquotad
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100021    1   udp  32772  nlockmgr
    100021    3   udp  32772  nlockmgr
    100021    4   udp  32772  nlockmgr
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100021    1   tcp  55549  nlockmgr
    100021    3   tcp  55549  nlockmgr
    100021    4   tcp  55549  nlockmgr
    100005    1   udp    867  mountd
    100005    1   tcp    870  mountd
    100005    2   udp    867  mountd
    100005    2   tcp    870  mountd
    100005    3   udp    867  mountd
    100005    3   tcp    870  mountd
[root@server ~]#

Nfs defaultly binds to port 2049. You can check it with the comamnd "netstat -ntplau | grep 2049"
tcp        0      0 0.0.0.0:2049                0.0.0.0:*                   LISTEN      -

Checking the nfs share from a remote machine. If the share is not showing something is wrong.
[root@server ~]# ifconfig | grep inet
          inet addr:192.168.137.250  Bcast:192.168.137.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe8d:1693/64 Scope:Link
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
[root@server ~]# showmount -e 192.168.137.100
Export list for 192.168.137.100:
/media/CentOS *
[root@server ~]#

Checking the share by mounting to the remote machine.
[root@server ~]# mount 192.168.137.100:/media/CentOS /mnt
[root@server ~]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/mapper/VolGroup00-LogVol01 on /home type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.137.100:/media/CentOS on /mnt type nfs (rw,addr=192.168.137.100)
[root@server ~]# ls /mnt
CentOS    RELEASE-NOTES-cs       RELEASE-NOTES-en_US       RELEASE-NOTES-ja          RELEASE-NOTES-ro
EULA      RELEASE-NOTES-cs.html  RELEASE-NOTES-en_US.html  RELEASE-NOTES-ja.html     RELEASE-NOTES-ro.html
GPL       RELEASE-NOTES-de       RELEASE-NOTES-es          RELEASE-NOTES-nl          repodata
images    RELEASE-NOTES-de.html  RELEASE-NOTES-es.html     RELEASE-NOTES-nl.html     RPM-GPG-KEY-beta
isolinux  RELEASE-NOTES-en       RELEASE-NOTES-fr          RELEASE-NOTES-pt_BR       RPM-GPG-KEY-CentOS-5
NOTES     RELEASE-NOTES-en.html  RELEASE-NOTES-fr.html     RELEASE-NOTES-pt_BR.html  TRANS.TBL
[root@server ~]#

While mounting the share in remote  machine we will get the logs in the server.
[root@server ~]# tail -f /var/log/messages
Feb 28 12:14:01 server mountd[5355]: authenticated mount request from 192.168.137.250:931 for /media/CentOS (/media/CentOS)
Feb 28 12:14:26 server mountd[5355]: authenticated unmount request from 192.168.137.250:958 for /media/CentOS (/media/CentOS)
Feb 28 12:58:25 server mountd[5355]: authenticated mount request from 192.168.137.200:670 for /media/CentOS (/media/CentOS)

Now nfs share is ready. We can start the client os installation and when asked we can provide the server and share details we have configured.

Client side sreenshots:

linux askmethod:
We can start the client installation using a bootable media(cd/dvd/usb). When booted it will ask for the boot command. Then give "linux askmethod"
Remote installation of centos linux

choose a language:
Then we need to choose a language : English
Remote installation of centos linux

Keyboard Type
Then we need to choose a language : us
Remote installation of centos linux

Installation method:
Now we need to select an installation method. In this case :nfs
Remote installation of centos linux

network configuration:
While installation the machine being installed needs to communicate with other systems(eg: for nfs/ftp/http shares). If there is a dhcp server running in our network we can leave the settings for it else we have to set it manually.

DHCP ( Dynamic host configuration protocol)
Remote installation of centos linux
Manual
Remote installation of centos linux

Setting the ip/netmask manually
Remote installation of centos linux

share details:
We need to give the nfs server details and the location of the media directory.
Remote installation of centos linux

Installation can be done in two modes.

1.graphical (needs good memory)
Remote installation of centos linux

2.text
Remote installation of centos linux


2. Remote installation Using FTP

FTP is file transfer protocol . It is the common way to transfer files through internet.
Like when using NFS for the remote installation, we will create one ftp directory of centos dvd on one machine and we will boot the client using a bootable disk/usb device. And when asked we will provide the ftp server and directory location details to client so that it can continue with the installation.

Checking whether ftp is running. But no.
[root@server ~]# netstat -ntplau | grep ftp
[root@server ~]#

Installing the vsftpd service. Vsftp is one of the ftp packages available for centos linux
[root@server ~]# yum install vsftpd

Checking the status
[root@server ~]# /etc/init.d/vsftpd status
vsftpd is stopped
[root@server ~]#

Starting the vsftpd service
[root@server ~]# /etc/init.d/vsftpd start
Starting vsftpd for vsftpd:                                [  OK  ]

vsftpd is now listening on port 21
[root@server ~]# netstat -ntplau | grep ftp
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      5851/vsftpd
[root@server ~]#

/var/ftp is the public directory of vsftpd. When an anonymous user logs in, he will get in to this  directory.
[root@server ~]# cd /var/ftp/
[root@server ftp]# ls
pub
[root@server ftp]#

We will create a directory CentOS in /var/ftp and copy the contents of dvd to it
[root@server ftp]# cp -rv /media/CentOS/* CentOS
[root@server ftp]# ls
CentOS  pub
[root@server ftp]# ls CentOS/
CentOS    RELEASE-NOTES-cs       RELEASE-NOTES-en_US       RELEASE-NOTES-ja          RELEASE-NOTES-ro
EULA      RELEASE-NOTES-cs.html  RELEASE-NOTES-en_US.html  RELEASE-NOTES-ja.html     RELEASE-NOTES-ro.html
GPL       RELEASE-NOTES-de       RELEASE-NOTES-es          RELEASE-NOTES-nl          repodata
images    RELEASE-NOTES-de.html  RELEASE-NOTES-es.html     RELEASE-NOTES-nl.html     RPM-GPG-KEY-beta
isolinux  RELEASE-NOTES-en       RELEASE-NOTES-fr          RELEASE-NOTES-pt_BR       RPM-GPG-KEY-CentOS-5
NOTES     RELEASE-NOTES-en.html  RELEASE-NOTES-fr.html     RELEASE-NOTES-pt_BR.html  TRANS.TBL
[root@server ftp]#

Testing from another server logging as anonymous user.
[root@work1 ~]# ftp 192.168.137.100
Connected to 192.168.137.100.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (192.168.137.100:root): anonymous
331 Please specify the password.
Password: #you can give anything here.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,137,100,58,142)
150 Here comes the directory listing.
drwxr-xr-x    7 0        0            4096 Feb 28 08:16 CentOS
drwxr-xr-x    2 0        0            4096 May 24  2008 pub
226 Directory send OK.
ftp> cd CentOS
250 Directory successfully changed.
ftp> ls
227 Entering Passive Mode (192,168,137,100,220,161)
150 Here comes the directory listing.
drwxr-xr-x    2 0        0          147456 Feb 28 08:15 CentOS
-rw-r--r--    1 0        0             212 Feb 28 08:15 EULA
-rw-r--r--    1 0        0           18009 Feb 28 08:15 GPL
drwxr-xr-x    2 0        0            4096 Feb 28 08:16 NOTES
*** OUTPUT TRUNCATED ***
drwxr-xr-x    4 0        0            4096 Feb 28 08:16 images
drwxr-xr-x    2 0        0            4096 Feb 28 08:16 isolinux
drwxr-xr-x    2 0        0            4096 Feb 28 08:16 repodata
226 Directory send OK.
ftp> bye
221 Goodbye.
[root@work1 ~]#

Now ftp share is ready. We can start the client os installation and when asked we can provide the server and share details we have configured.

Client side sreenshots:

linux askmethod:
We can start the client installation using a bootable media(cd/dvd/usb). When booted it will ask for the boot command. Then give "linux askmethod"
Check the screenshots of the nfs in confused.

choose a language:
Then we need to choose a language : English
Check the screenshots of the nfs in confused.

Keyboard Type
Then we need to choose a language : us
Check the screenshots of the nfs in confused.

Installation method:
Now we need to select an installation method. In this case :ftp
Linux Remote installation Using FTP

network configuration:
While installation the machine being installed needs to communicate with other systems(eg: for nfs/ftp/http shares). If there is a dhcp server running in our network we can leave the settings for it else we have to set it manually.
Check the screenshots of the nfs in confused.

share details:
We need to give the ftp server details and the location of the media directory.
Linux Remote installation Using FTP

Installation can be done in two modes.
1.graphical (needs good memory)
2.text

3. Remote installation Using HTTP


HTTP is hypertext transfer protocol. For implementing http in linux, we mostly use apache webserver.
Like ftp for the remote installation, we will create one web directory of centos dvd on one machine and we will boot the client using a bootable disk/usb device. And when asked we will provide the web server and directory location details to client so that it can continue with the installation.

Checking whether the package is installed or not.
[root@server ~]# rpm -q httpd
httpd-2.2.3-11.el5_1.centos.3

Checking whether the service is bind to any port
[root@server ~]# netstat  -npla | grep http
[root@server ~]#  

Checking the service status
[root@server ~]# /etc/init.d/httpd status
httpd is stopped
[root@server ~]#

Starting the httpd service
[root@server ~]# /etc/init.d/httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using server.lap.work for ServerName
                                                           [  OK  ]

Now it is binded to the port 80
[root@server ~]# netstat  -npla | grep http
tcp        0      0 :::80                       :::*                        LISTEN      6224/httpd
[root@server ~]#

like /var/ftp in case of vsftpd /vara/www/html is the default document root of httpd server
[root@server ~]# cd /var/www/html/
[root@server html]# ls
[root@server html]#

We will move the copy of the dvd we created for ftp to the document root of apache, the httpd web server.
[root@server html]# mv /var/ftp/CentOS .
[root@server html]# ls
CentOS
[root@server html]#

[root@server ~]# tail -f /var/log/httpd/access_log

192.168.137.200 - - [28/Feb/2012:14:23:02 +0530] "GET /CentOS//disc1/.discinfo HTTP/1.1" 404 301 "-" "urlgrabber/3.1.0"
192.168.137.200 - - [28/Feb/2012:14:23:04 +0530] "GET /CentOS/RELEASE-NOTES-en_US.UTF-8.html HTTP/1.1" 404 315 "-" "urlgrabber/3.1.0"
192.168.137.200 - - [28/Feb/2012:14:23:04 +0530] "GET /CentOS/RELEASE-NOTES.en_US.UTF-8 HTTP/1.1" 404 310 "-" "urlgrabber/3.1.0"
192.168.137.200 - - [28/Feb/2012:14:23:04 +0530] "GET /CentOS/RELEASE-NOTES-en_US.html HTTP/1.1" 200 1367 "-" "urlgrabber/3.1.0"
192.168.137.200 - - [28/Feb/2012:14:23:38 +0530] "GET /CentOS/repodata/repomd.xml HTTP/1.1" 200 1140 "-" "urlgrabber/3.1.0"
192.168.137.200 - - [28/Feb/2012:14:23:38 +0530] "GET /CentOS/repodata/primary.xml.gz HTTP/1.1" 200 876639 "-" "urlgrabber/3.1.0"
192.168.137.200 - - [28/Feb/2012:14:23:41 +0530] "GET /CentOS/repodata/comps.xml HTTP/1.1" 200 935865 "-" "urlgrabber/3.1.0"

Now httpd share is ready. We can start the client os installation and when asked we can provide the server and share details we have configured.

Client side sreenshots:

linux askmethod:
We can start the client installation using a bootable media(cd/dvd/usb). When booted it will ask for the boot command. Then give "linux askmethod"
Check the screenshots of the nfs in confused.

choose a language:
Then we need to choose a language : English
Check the screenshots of the nfs in confused.

Keyboard Type
Then we need to choose a language : us
Check the screenshots of the nfs in confused.

Installation method:
Now we need to select an installation method. In this case :http
Linux Remote installation Using http

network configuration:
While installation the machine being installed needs to communicate with other systems(eg: for nfs/ftp/http shares). If there is a dhcp server running in our network we can leave the settings for it else we have to set it manually.
Check the screenshots of the nfs in confused.

share details:
We need to give the http server details and the location of the media directory.
Linux Remote installation Using http

Installation can be done in two modes.
1.graphical (needs good memory)
2.text

4. Remote installation Using VNC


We can ingnate installation on a machine and attend the installation from a remote machine using vnc ( Virtual Network Computing ). VNC is a protocol through which we can graphically login to another computer. 

On the machine which is being installed, we have to boot it with the following options
boot: linux vnc vncpassword=qwerty ip= netmask=xxx.xxx.xxx.xxx gateway=xxx.xxx.xxx.xxx

Then after the initialization of anaconda, we can control the installation from the remote machine via vnc. But in the above case it uses local dc/dvd. If u want to use nfs/ft/http u  have to specify the method as follows
boot: linux vnc vncpassword=qwerty ip= netmask=xxx.xxx.xxx.xxx gateway=xxx.xxx.xxx.xxx method=nfs:IP_OF_NSF_SHARE:/SHARE_PATH

Server side :

Linux Remote installation Using VNC

Linux Remote installation Using http

From the windows vnc client.
Giving the ip and details:
Linux Remote installation Using vnc
Giving the password
Linux Remote installation Using vnc
Now the vnc session:
Linux Remote installation Using vnc

5. Remote installation Using PXE


PXE installation is explained in the following post
Remote installation PXE

6. Remote installation Using kickstart


Kickstart installation is explained in the following post.
linux Remote installation using kickstart

Recommended Reading

1. Practical Guide to Linux Commands, Editors, and Shell Programming, A (2nd Edition)
2. UNIX and Linux System Administration Handbook (4th Edition)
3. Linux All-in-One For Dummies
4. Introduction to the Command Line (Second Edition): The Fat Free Guide to Unix and Linux Commands

Sponsored Links

No comments:

Post a Comment

Be nice. That's all.