Debian batch deployment using FAI + PXE

Source: Internet
Author: User

BKJIA exclusive Article] FAI full name Fully Automatic Installation is a software package based on Debian GNU/Linux platform for Fully Automatic Installation of cluster nodes. It provides a convenient and quick Installation method for cluster construction, it can be automatically installed on all nodes in dozens of minutes.

Is the network topology of this instance:

Configure DHCP Service

The DHCP Service is installed to assign an IP address to the client that needs to install the operating system.

1. Install the DHCP service.

srv10:~# apt-get install dhcp3-server

2. Configure the DHCP service. Add the following content to the/etc/dhcp3/dhcpd. conf file.

Allow booting; allow bootp;Subnet 192.168.1.0 netmask 255.255.255.0 {range 192.168.1.220 192.168.1.250;Next-server 192.168.1.233; # specify the server filename "/pxelinux.0" found by the PXE client; # specify the Startup FileOption routers 192.168.1.254; option domain-name-servers 202.103.24.68 ;}

Configure the TFTP service

The installation of the TFTP service allows the client that needs to install the operating system to download the boot file that supports PXE.

1. Install the TFTP service.

srv10:~# apt-get install tftp tftpdsrv10:~# apt-get install xinetd

2. Configure the TFTP service.

To use the new Xinetd-based TFTP service, comment out the following content in the/etc/inetd. conf file.

#tftp dgram udp wait nobody  /usr/sbin/tcpd  /usr/sbin/in.tftpd /home/creater/image 

Create a tftp file under the/etc/xinetd. d directory and add "server_args" to specify the root directory of the TFTP service ).

service tftp{ socket_type  = dgram protocol  = udp wait= yes user= root server = /usr/sbin/in.tftpd server_args  = -s /tftpboot disable= no per_source= 11 cps = 100 2 flags  = IPv4}

Create the root directory of the TFTP service

srv10:~# mkdir /tftpboot

Install the NFS service

The FAI service shares necessary startup and installation files with the FAI client through NFS.

srv10:~# apt-get install nfs-kernel-server

Configure FAI

1. Install FAI.

srv10:~# apt-get install fai-quickstart

2. Configure FAI.

The basic function of FAI is to modify/etc/fai. confFAI master profile),/etc/fai/make-fai-nfsroot.confFAI using NFS service profile),/etc/fai/apt/sources. list source list is used for NFS-Root, that is, the list of client sources installed through FAI ).

Overwrite the/etc/fai/apt/sources. list file directly using/etc/apt/sources. list.

srv10:~# cp /etc/apt/sources.list /etc/fai/apt/sources.list

Modify the following content in the/etc/fai. conf file.

LOGUSER = faiFAI_LOGPROTO = sshFAI_CONFIG_SRC = nfs: // 192.168.1.233 $ FAI_CONFIGDIR # Storage path of the FAI configuration file # MNTPOINT =/media/mirror # comment out this sentence

Modify the/etc/fai/make-fai-nfsroot.conf file as follows.

NFSROOT =/srv/fai/nfsroot # NFS-Root directory path TFTPROOT =/tftpboot # specify the TFTP service Root directory path NFSROOT_ETC_HOSTS = "192.168.1.233" # specify the NFS server address # Use fai-setup command to download package address FAI_DEBOOTSTRAP = "lenny http://ftp.debian.org/debian" NFSROOT_HOOKS =/etc/fai/NFSROOT-hooks/FAI_DEBOOTSTRAP_OPTS = "-- arch i386 -- exclude = dhcp-client, info"

Use the following command to create the content required for FAI. This step may be slow depending on network conditions ).

srv10:~# fai-setup -v

Run the following command to create the startup and configuration files required to support the PXE Server.

srv10:~# fai-chboot -IFv default

Modify the/srv/fai/config/disk_config/FAIBASE file to specify the client disk partition and startup tag.

# Bootable: 1 # mark 1st partitions as startup partitions. Disk_config disk1 disklabel: msdosBootable: 1Primary/25G ext3rw, errors = remount-roprimary swap 1 Gswaprw

Restart related services.

srv10:~# /etc/init.d/nfs-common restartsrv10:~# /etc/init.d/nfs-kernel-server restartsrv10:~# /etc/init.d/dhcp3-server restartsrv10:~# /etc/init.d/xinetd restart

After the configuration is complete, the content in the/tftpboot directory is as follows.

srv10:~# ll /tftpboot/total 10012drwxr-xr-x  3 fai  nogroup 4096 2010-12-21 21:35 .drwxr-xr-x 23 root root 4096 2010-12-21 21:35 ..-rw-r--r--  1 fai  nogroup 8732200 2010-12-21 21:35 initrd.img-2.6.26-2-486-rwxr-xr-x  1 fai  nogroup15820 2010-12-21 21:35 pxelinux.0drwxr-xr-x  2 fai  nogroup 4096 2010-12-21 21:36 pxelinux.cfg-rw-r--r--  1 fai  nogroup 1469968 2010-11-24 21:57 vmlinuz-2.6.26-2-486

After the FAI server is configured, restart the computer where the FAI service is located and set the client BIOS to start from the network, the Debian system can be fully installed. The default password of the root user on the client is fai.

Other FAI configurations

1. Customize the software packages to be installed on the client.

If you need to install more software packages for the client, you can modify the/srv/fai/config/package_config/FAIBASE file. For example, to install the GNOME desktop environment, you can add the following to the file.

2. Modify the client disk partition.

To modify the client disk partition, modify the/srv/fai/config/disk_config/FAIBASE file.

3. Execute the custom script.

/Srv/fai/config/scripts/LAST/50-misc # The script is executed after the client completes all the installation. You can add some custom script content to the script. # Fcopy # Add the FAI server/srv/fai/nfsroot/live/filesystem. the contents of the corresponding directory under the dir/directory are obtained to the corresponding directory of the client. The following is the/srv/fai/nfsroot/live/filesystem. dir/etc/apt/l *. copy the deb file to the/etc/apt directory of the client. Fcopy-I/etc/apt/l *. deb # $ ROOTCMD # Content Used for local execution on the client. $ ROOTCMD echo "root: debian" | $ ROOTCMD chpasswd

Author profile: Zhang Qin blog), MCSE, mcba, RHCE, engaged in software development (Delphi, Java), project management, system integration. He has participated in many Windows and Linux-based large-scale system integration projects and published technical articles on multiple well-known IT websites in China.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.