Build Pxe+dhcp+nfs+kickstart under Centos 6.*

Source: Internet
Author: User

First, the Linux automatic installation system detailed work process. Second, configure the PXE network installation instructions and sequence of steps 1), configure Server for NFS, with the installation files for the Linux system. 2), configure the TFTP server to provide the client PXE boot necessary files 3), configure DHCP to provide the client with IP address and other information 4), configure the Kickstart for automatic answer installation 5), use the PXE function to boot the client three, Install NFS service and profile share directory to copy the installation media from the CD-ROM or ISO file to a directory on the server, you can access it using a variety of network protocols, such as HTTP,FTP and NFS. 1), create a shared directory, and copy the contents of the disc to a shared directory. [[email protected]~]# mkdir/data/sys-p[[email protected]~]# rsync-avz-p/MNT/DATA/SYS/2), install and configure NFS to publish the shared directory [[email protected]~]rpm-qa | grep nfs[[email protected]~]yum-y Install Nfs-utils portmap[[email protected]~]echo "/data/sys/192.168.0.0/24 (ro,sync)" >>/etc/exports[[email protected]~]CAT/ETC/EXPORTS/DATA/SYS/192.168.0.0/24 (Ro,sync) 3), NFS, Rpcbind service startup [[email protected]~]#/etc/init.d/rpcbind Start
Starting rpcbind: [OK] [[email protected]~]#/etc/init.d/nfs Start
Starting NFS services: [OK]
Starting NFS mountd: [OK]
Starting NFS daemon: [OK]
Starting RPC IDMAPD: [OK]4), and boot auto start [[email protected]~] #chkconfig NFS on[[email protected]~] #chkconfig Rpcbind on[[email protected]~] #chkconfig--list nfs[[email protected]~] #chkconfig--list rpcbind5), check that the directory/data/sys is shared correctly [[email protected]~]#[[email protected]~]# showmount-e 127.0.0.1
Export list for 127.0.0.1:
/data/sys 192.168.0.0/24 installation Configuration TFTP service during the PXE installation, the client downloads and executes the bootstrap file from the TFTP service via the TFTP protocol. 1), install the TFTP service tip: If the Yum tool is executed before the following processing, the Yum installed RPM package can be reserved for backup. [[email protected]~]# sed-i ' s#keepcache=0#keepcache=1#g '/etc/yum.conf[[email protected]~] #tree/var/cache/yum/base/[[email protected]~]# yum-y Install tftp-server* 2), configure the TFTP service TFTP service to be managed by the XINETD service. Edit the "/etc/xinetd.d/tftp" file to change the parameter value of disable in the file from Yes to No. [[email protected] ~] #cat/etc/xinetd.d/tftp # default:off# description:the TFTP server serves files using the trivial file Tran Sfer \#       protocol.  the TFTP protocol is often used to boot diskless \#       workstations, download configuration files To Network-aware printers, \#       and to start of the installation process for some operating Systems.servic E tftp{        socket_type             = dgram      &NBSP ; Protocol                = udp        wait                    = yes        user                    = root        server             &NBSP ;    =/usr/sbin/in.tftpd        Server_args         &NBsp   =-s/var/lib/tftpboot     Here is the default FTFP path, and a startup file will be placed here.         disable                 = yes     To change Yes to NO&NB Sp       Per_source              = 11        CPS                     = 2       ,     &NB Sp             = ipv4}    From the configuration file, as can be seen,/tftpboot default to the TFTP server root directory location, after the configuration is complete restart the XINETD service, Make the TFTP server effective. [[email protected]~]#/etc/init.d/xinetd startstarting xinetd: [OK]3), PXE boot configuration (bootstrap) PXE    The boot image file is provided by the Syslinux package and is available on the CentOS Linux CD, and you can also go to the Syslinux home page, http://syslinux.zytor.com/download rpm to install. As soon as we install the Syslinux (installed by default), a pxelinux.0 is generated and the pxelinux.0 file is copied to the "/tftpboot" directory:if not, you can configure the Yum source to install it: yum-y install syslinux[[email protected]~] #cp/usr/share/syslinux/pxelinux.0/tftpboot[[email protected]~]# ll/tftpboot/
Total 28
-rw-r--r--1 root root 26828 Apr 21:06 pxelinux.04), kernel files for network boot will be "images/pxeboot/{vmlinux,initrd.img}" in the CentOS installation CD directory The boot file is copied to an installation directory, for example: "/tftpboot" [[email protected]~] #cp/mnt/images/pxeboot/initrd.img/tftpboot[[email protected]~] #cp/mnt/images/pxeboot/vmlinuz/tftpboot[[email protected]~] #lsinitrd. IMG TRANS. TBL vmlinuz[[email protected]tftpboot]# mkdir pxelinux.cfg
[[email protected]tftpboot]# ls
Initrd.img pxelinux.0 pxelinux.cfg vmlinuz[[email protected]~] #cp/data/sys/isolinux/isolinux.cfg/tftpboot/pxelinux.cfg/default[[email protected] ~] #cat  /tftpboot/pxelinux.cfg/defaultdefault local     Here, select None as the default installation, text mode is Linuxprompt 1     Displays the "boot:" prompt. is not prompted for ' 0 ', the content specified in the default parameter will be started directly. Timeout 999999     user input before the timeout, in units of 1/10 seconds, display the contents of a file, note the path of the file. The default is in the/tftpboot directory. It can also resemble such "install/rhel-inst/boot.msg" such that the path + filename display BOOT.MSGF1 boot.msg     Press the ' F1 ' key after the file is displayed. Note the path. The default is/tftpboot. Note: Syslinux official website says, currently can only use F1-F10F2 options.msgf3 general.msgf4 param.msgf5 rescue.msglabel linux  kernel vmlinuz   Append Initrd=initrd.imglabel text  kernel vmlinuz  append ks=nfs:192.168.2.253:/data/sys/kickstart/ Ks.cfg initrd=initrd.img text    Here's nfs:192.168.2.253:/data/sys/kickstart/ks.cfg For the NFS share path where ks.cfg is located, be careful to place ks.cfg on/data/sys/kickstart/ks.cfglabel ks  kernel vmlinuz  when configuring Kisckstart later KS initrd=initrd.imglabel local  localboot 1label memtest86  kernel memtest  append- # ' label ' to designate you in ' Boot: ' Prompt to enter keywords. Example: Boot:linux[enter] #这个会启动 ' label Linux 'Tagged kernel and initrd.img files. #这里还定义了其它几个关键字: #boot: The text#boot:ks#kernet parameter specifies the kernel to start. Also note the path, which defaults to the/tftpboot directory. #append指定追加给内核的参数, the parameters appended to the kernel that can be used in Gurb are also available here. #使用kickstart安装. You can specify the location of the kickstart file directly after the KS parameter. Special NOTE: Deploying an unattended installation can sometimes cause serious negative problems when configured incorrectly, such as when someone's personal computer or server is powered on, it may be strange to have a Linux system installed that you define directly. So: The following configuration is critical: Default Localprompt 1timeout 999999  Five, install and configure DHCP service         during PXE boot installation, The PXE client obtains the IP address, PXE boot file name of the PXE client through the DHCP service, and the client then downloads the boot file from the TFTP server via the TFTP protocol and executes it to start the System Setup program. 1), install the DHCP package [[email protected]~] #yum-y install dhcp*2), configure DHCP 1, modify the/etc/dhcpd.conf file, specify the IP address, and so on. 2, in/etc/dhcp.conf add tftp-server need to push to the client's boot file (bootstrap): filename "pxelinux.0"; because the default directory for TFTP is/tftpboot,    So the absolute path to the file is:/tftpboot/pxelinux.0; Of course it can be specified as a different path. You also need to specify the Next-server parameter to tell the client where to get the remaining startup files after obtaining the pxelinux.0 file: Next-server 192.168.2.253; [[email protected]~] #vi/etc/dhcpd.conf ddns-update-style none;ignore client-updates;allow booting;allow bootp;default-lease-time 21600 ; max-lease-time 43200;option routers 192.168.2.254;        Subnet 192.168.2.0 netmask 255.255.255.0 {range DYNAMIC-BOOTP 192.168.2.200 192.168.2.250;        Next-server 192.168.2.253;        FileName "/data/sys/kickstart/ks.cfg";        Next-server 192.168.2.253; FileName "pxelinux.0";} [[email protected]~] #chkconfig dhcpd on[[email protected] ~] #ps-ef | grep dhcp root     20460     1  0 22:31?        00:00:00/usr/sbin/dhcpdroot     20478 18819  0 22:34 pts/3    00:00:0 0 grep dhcp  VI, Kickstart installation configuration         Usually we need a lot of interaction with the server in the process of installing the operating system, in order to reduce the interaction process, Kickstart was born. Using this kickstart, You only need to define good one kickstart auto-answer profile ks.cfg (usually on the installation server), and let the installer know the location of the configuration file, the installer can read the installation configuration from it during the installation process, thus avoiding multiple human-computer interaction during the installation process, so as to realize unattended automated security Mount         Three ways to generate Kickstart configuration files:        Method 1, each installed a Linux machine, The Linux installer creates a kickstart configuration file that records your real-world installation configuration. If you want to implement a similar installation to a system, you can build your own kickstart profile based on the system's kickstart configuration file.         Method 2, Linux provides a graphical kickstart configuration tool. Running the tool on any of the installed Linux systems makes it easy to create your own kickstart configuration file. The Kickstart Configuration Tool command is Redhat-config-kickstart or System-config-kickstart.         Method 3, read the manual for the Kickstart configuration file. You can create your own kickstart configuration file with any text editor. [[email protected]~] #mv anaconda-ks.cfg kickstart/ks.cfg[[email protected]~] #cd kickstart/

[[email protected] kickstart]# ls

Ks.cfg

[[email protected] ~] #vi ks.cfg# Kickstart file automatically generated by Anaconda. install     indicates installation system instead of upgrade system NFS-- server=192.168.2.253--dir=/data/sys        nfs installation method,--server for NFS, Ip,--dir for NFS share path. You can also use the Http method, as follows: Url--url=http://192.168.2.253/sys/centos5.8   key--skiplang zh_cn. UTF-8 or en_US. UTF8     Character set keyboard US     keyboard layout network--device eth0--bootproto DHCP--hostname localhost.com     Network configuration, Eth0 is the first NIC, end Localhost.comnetwork--device eth1--onboot no--bootproto DHCP     can also set the address of the second to third NIC. ROOTPW    123456    root user password, you can use clear text, the installation is completed into an encrypted state. If you are using encryption, see the following #rootpw--iscrypted $1$mbhhwc.n$9/x3ksgy6ptg8bp4wywe71authconfig--enableshadow--enablemd5     System Certification Information Firewall--disabled     Close firewall    enforcing turn on SELinux--disabled     Shut down firewall timezone Asia /shanghai     System time bootloader--location=mbr--DRIVEORDER=SDA     system boot related configuration firstboot    -- Disabled &nbsp   Disable agent Settings after installation loging    --level=info     set log level zerombr     Clear MBR boot information  ######### ##### #分区 #################### #clearpart--all--DRIVES=SDA     Clears all partitions on the SDA. If SDA does not exist may error, you can also use the following usage #clearpart--linuxclearpart--all#part/boot--fstype ext3--size=100--ondisk=sda#part Pv.2-- Size=0--grow--ondisk=sda#volgroup VolGroup00--pesize=32768 pv.2#logvol/--fstype ext3--name=logvol00--vgname= VolGroup00--size=1024--grow#logvol swap--fstype swap--name=logvol01--vgname=volgroup00--size=1000--grow--maxsize =50240################# #安装包选择 ##############% Packages@admin-tools@base@chinese-support@core@dialup@editors@gnome-desktop@graphical-internet@graphics@java@legacy-softw Are-support@printing@sound-and-video@text-internet@base-xkexec-toolsiscsi-initiator-utilsfipscheckdevice-mapper-multipath sgpioemacslibsane-hpaioxorg-x11-utilsxorg-x11-server-xnest      

Build Pxe+dhcp+nfs+kickstart under Centos 6.*

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.