Deploy Linux PXE Server
环境说明:
PXE Server:
IP:192.168.56.132,Mask:24
OS:RHEL5 Update 10(64 Bit)
OS Info:
1 2 3 |
[root@rhel510 ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.10 (Tikanga) [root@rhel510 ~]# |
先决条件:存储。
挂载点容量使用情况:
1 2 3 4 5 6 |
[root@rhel510 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 15G 2.6G 12G 19% / /dev/sda1 289M 17M 258M 7% /boot tmpfs 2.0G 0 2.0G 0% /dev/shm [root@rhel510 ~]# |
根分区(/)只剩下:12GB。
使用空间不够。
添加新的挂载点:/pxe_root
1 2 3 4 5 |
[root@rhel510 ~]# mkdir /pxe_root [root@rhel510 ~]# ll -d /pxe_root/ drwxr-xr-x 2 root root 4096 Dec 17 04:27 /pxe_root/ [root@rhel510 ~]# ls /pxe_root/ [root@rhel510 ~]# |
为挂载点(/pxe_root)挂载磁盘:
新磁盘分区:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
[root@rhel510 ~]# fdisk -l | grep --color "Disk" Disk /dev/sdb doesn't contain a valid partition table Disk /dev/sda: 21.4 GB, 21474836480 bytes Disk /dev/sdb: 42.9 GB, 42949672960 bytes [root@rhel510 ~]# 分区前sdb的状态: [root@rhel510 ~]# fdisk -l /dev/sdb Disk /dev/sdb: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn't contain a valid partition table [root@rhel510 ~]# 开始分区: [root@rhel510 ~]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. The number of cylinders for this disk is set to 5221. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help): p Disk /dev/sdb: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-5221, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-5221, default 5221): Using default value 5221 Command (m for help): p Disk /dev/sdb: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 5221 41937651 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@rhel510 ~]# [root@rhel510 ~]# partprobe /dev/sdb [root@rhel510 ~]# 分区后sdb的状态: [root@rhel510 ~]# fdisk -l /dev/sdb Disk /dev/sdb: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 5221 41937651 83 Linux [root@rhel510 ~]# [root@rhel510 ~]# ll /dev/sd* brw-r----- 1 root disk 8, 0 Dec 17 03:32 /dev/sda brw-r----- 1 root disk 8, 1 Dec 17 03:32 /dev/sda1 brw-r----- 1 root disk 8, 2 Dec 17 03:32 /dev/sda2 brw-r----- 1 root disk 8, 3 Dec 17 03:32 /dev/sda3 brw-r----- 1 root disk 8, 16 Dec 17 04:28 /dev/sdb brw-r----- 1 root disk 8, 17 Dec 17 04:28 /dev/sdb1 [root@rhel510 ~]# |
格式化(mkfs.ext3):/dev/sdb1。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
[root@rhel510 ~]# mkfs.ext mkfs.ext2 mkfs.ext3 [root@rhel510 ~]# mkfs.ext3 /dev/sdb1 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 5242880 inodes, 10484412 blocks 524220 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 320 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 23 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@rhel510 ~]# |
挂载磁盘(/dev/sdb1)到挂载点(/pxe_root):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[root@rhel510 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 15G 2.6G 12G 19% / /dev/sda1 289M 17M 258M 7% /boot tmpfs 2.0G 0 2.0G 0% /dev/shm [root@rhel510 ~]# mount /dev/sdb1 /pxe_root/ [root@rhel510 ~]# [root@rhel510 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 15G 2.6G 12G 19% / /dev/sda1 289M 17M 258M 7% /boot tmpfs 2.0G 0 2.0G 0% /dev/shm /dev/sdb1 40G 177M 38G 1% /pxe_root [root@rhel510 ~]# |
查看挂载点(/pxe_root)状态:
1 2 3 4 |
[root@rhel510 ~]# ls -ltr /pxe_root/ total 16 drwx------ 2 root root 16384 Dec 17 04:31 lost+found [root@rhel510 ~]# |
至此,对PXE安装的路径与存储容量的准备就完成了。
基本的操作系统配置。
文件:/etc/resolv.conf
(针对当前环境:VMware workstation 12 Pro)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[root@rhel510 ~]# cat /etc/resolv.conf ; generated by /sbin/dhclient-script search localdomain nameserver 192.168.56.2 [root@rhel510 ~]# [root@rhel510 ~]# ping -c 3 baidu.com PING baidu.com (220.181.57.217) 56(84) bytes of data. 64 bytes from 220.181.57.217: icmp_seq=1 ttl=128 time=80.6 ms 64 bytes from 220.181.57.217: icmp_seq=2 ttl=128 time=75.9 ms 64 bytes from 220.181.57.217: icmp_seq=3 ttl=128 time=78.4 ms --- baidu.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2000ms rtt min/avg/max/mdev = 75.906/78.342/80.699/1.970 ms [root@rhel510 ~]# |
文件:/etc/hosts
1 2 3 4 5 6 7 8 9 10 |
[root@rhel510 ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. # Localhost 127.0.0.1 localhost # Pub 192.168.56.132 rhel510 [root@rhel510 ~]# |
文件:/etc/yum.repos.d/iso.repo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@rhel510 ~]# cat /etc/yum.repos.d/iso.repo [Server] name=Server baseurl=file:///iso/Server gpgcheck=0 [VT] name=VT baseurl=file:///iso/VT gpgcheck=0 [Cluster] name=Cluster baseurl=file:///iso/Cluster gpgcheck=0 [ClusterStorage] name=ClusterStorage baseurl=file:///iso/ClusterStorage gpgcheck=0 [root@rhel510 ~]# |
YUM:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
[root@rhel510 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 15G 2.6G 12G 19% / /dev/sda1 289M 17M 258M 7% /boot tmpfs 2.0G 0 2.0G 0% /dev/shm /dev/sdb1 40G 177M 38G 1% /pxe_root [root@rhel510 ~]# [root@rhel510 ~]# mount /dev/sr0 /iso mount: block device /dev/sr0 is write-protected, mounting read-only [root@rhel510 ~]# [root@rhel510 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 15G 2.6G 12G 19% / /dev/sda1 289M 17M 258M 7% /boot tmpfs 2.0G 0 2.0G 0% /dev/shm /dev/sdb1 40G 177M 38G 1% /pxe_root /dev/sr0 4.1G 4.1G 0 100% /iso [root@rhel510 ~]# [root@rhel510 ~]# yum repolist Loaded plugins: product-id, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Cluster | 1.5 kB 00:00 ClusterStorage | 1.5 kB 00:00 Server | 1.5 kB 00:00 VT | 1.3 kB 00:00 repo id repo name status Cluster Cluster 32 ClusterStorage ClusterStorage 39 Server Server 3,358 VT VT 59 repolist: 3,488 [root@rhel510 ~]# |
文件:/etc/selinux/config
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[root@rhel510 ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - SELinux is fully disabled. SELINUX=disabled # SELINUXTYPE= type of policy in use. Possible values are: # targeted - Only targeted network daemons are protected. # strict - Full SELinux protection. SELINUXTYPE=targeted [root@rhel510 ~]# sestatus SELinux status: disabled [root@rhel510 ~]# getenforce Disabled [root@rhel510 ~]# |
防火墙(iptables):
1 2 3 4 5 |
[root@rhel510 ~]# chkconfig iptables --list iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@rhel510 ~]# service iptables status Firewall is stopped. [root@rhel510 ~]# |
服务:sendmail(不需要的服务,若开启,影响开机速度)。
1 2 3 |
[root@rhel510 ~]# chkconfig sendmail --list sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@rhel510 ~]# |
一、服务:tFTP
安装:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
[root@rhel510 ~]# rpm -qa | grep tftp [root@rhel510 ~]# [root@rhel510 ~]# yum list | grep --color tftp This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. syslinux-tftpboot.x86_64 4.02-7.2.el5 Server tftp.x86_64 0.49-2 Server tftp-server.x86_64 0.49-2 Server [root@rhel510 ~]# [root@rhel510 ~]# yum install tftp tftp-server Loaded plugins: product-id, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package tftp.x86_64 0:0.49-2 set to be updated ---> Package tftp-server.x86_64 0:0.49-2 set to be updated --> Processing Dependency: xinetd for package: tftp-server --> Running transaction check ---> Package xinetd.x86_64 2:2.3.14-19.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================== Installing: tftp x86_64 0.49-2 Server 23 k tftp-server x86_64 0.49-2 Server 32 k Installing for dependencies: xinetd x86_64 2:2.3.14-19.el5 Server 127 k Transaction Summary ===================================================================================================================================================== Install 3 Package(s) Upgrade 0 Package(s) Total download size: 182 k Is this ok [y/N]: y Downloading Packages: ----------------------------------------------------------------------------------------------------------------------------------------------------- Total 14 MB/s | 182 kB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : xinetd 1/3 Installing : tftp-server 2/3 Installing : tftp 3/3 Cluster/productid | 1.7 kB 00:00 ClusterStorage/productid | 1.7 kB 00:00 Server/productid | 1.7 kB 00:00 Installed: tftp.x86_64 0:0.49-2 tftp-server.x86_64 0:0.49-2 Dependency Installed: xinetd.x86_64 2:2.3.14-19.el5 Complete! [root@rhel510 ~]# [root@rhel510 ~]# rpm -qa | grep tftp tftp-server-0.49-2 tftp-0.49-2 [root@rhel510 ~]# |
配置tftp:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
[root@rhel510 ~]# ll /etc/xinetd.d/ | grep --color tftp -rw-r--r-- 1 root root 576 Dec 17 04:49 tftp [root@rhel510 ~]# cat /etc/xinetd.d/tftp # default: off # description: The tftp server serves files using the trivial file transfer \ # protocol. The tftp protocol is often used to boot diskless \ # workstations, download configuration files to network-aware printers, \ # and to start the installation process for some operating systems. service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd # server_args = -s /tftpboot server_args = -u nobody -s /pxe_root/tftpboot # disable = yes disable = no per_source = 11 cps = 100 2 flags = IPv4 } [root@rhel510 ~]# |
创建tftp根目录:/pxe_root/tftpboot。
1 2 3 4 5 6 7 |
[root@rhel510 ~]# ls /tftpboot/ [root@rhel510 ~]# mkdir /pxe_root/tftpboot [root@rhel510 ~]# ll /pxe_root/ total 20 drwx------ 2 root root 16384 Dec 17 04:31 lost+found drwxr-xr-x 2 root root 4096 Dec 17 04:50 tftpboot [root@rhel510 ~]# |
启动服务:
1 2 3 4 5 6 |
[root@rhel510 ~]# service xinetd status xinetd is stopped [root@rhel510 ~]# [root@rhel510 ~]# service xinetd start Starting xinetd: [ OK ] [root@rhel510 ~]# |
二、服务:DHCP
安装:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
[root@rhel510 ~]# rpm -qa | grep --color dhcp dhcpv6-client-1.0.10-20.el5 [root@rhel510 ~]# [root@rhel510 ~]# yum list | grep dhcp This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. dhcpv6-client.x86_64 1.0.10-20.el5 installed dhcp.x86_64 12:3.0.5-33.el5_9 Server dhcp-devel.i386 12:3.0.5-33.el5_9 Server dhcp-devel.x86_64 12:3.0.5-33.el5_9 Server dhcpv6.x86_64 1.0.10-20.el5 Server libdhcp.i386 1.20-13.el5 Server libdhcp.x86_64 1.20-13.el5 Server libdhcp-devel.i386 1.20-13.el5 Server libdhcp-devel.x86_64 1.20-13.el5 Server libdhcp4client.i386 12:3.0.5-33.el5_9 Server libdhcp4client.x86_64 12:3.0.5-33.el5_9 Server libdhcp4client-devel.i386 12:3.0.5-33.el5_9 Server libdhcp4client-devel.x86_64 12:3.0.5-33.el5_9 Server libdhcp6client.i386 1.0.10-20.el5 Server libdhcp6client.x86_64 1.0.10-20.el5 Server libdhcp6client-devel.i386 1.0.10-20.el5 Server libdhcp6client-devel.x86_64 1.0.10-20.el5 Server sblim-cmpi-dhcp.i386 1:1.0-49.el5 Server sblim-cmpi-dhcp.x86_64 1:1.0-49.el5 Server sblim-cmpi-dhcp-devel.i386 1:1.0-49.el5 Server sblim-cmpi-dhcp-devel.x86_64 1:1.0-49.el5 Server sblim-cmpi-dhcp-test.x86_64 1:1.0-49.el5 Server [root@rhel510 ~]# [root@rhel510 ~]# yum install dhcp Loaded plugins: product-id, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package dhcp.x86_64 12:3.0.5-33.el5_9 set to be updated --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================== Installing: dhcp x86_64 12:3.0.5-33.el5_9 Server 890 k Transaction Summary ===================================================================================================================================================== Install 1 Package(s) Upgrade 0 Package(s) Total download size: 890 k Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : dhcp 1/1 Installed: dhcp.x86_64 12:3.0.5-33.el5_9 Complete! [root@rhel510 ~]# [root@rhel510 ~]# rpm -qa | grep --color dhcp dhcpv6-client-1.0.10-20.el5 dhcp-3.0.5-33.el5_9 [root@rhel510 ~]# |
查看DHCP配置文件的位置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
[root@rhel510 ~]# rpm -ql dhcp | grep --color dhcp /etc/dhcpd.conf /etc/rc.d/init.d/dhcpd /etc/sysconfig/dhcpd /usr/sbin/dhcpd /usr/share/doc/dhcp-3.0.5 /usr/share/doc/dhcp-3.0.5/IANA-arp-parameters /usr/share/doc/dhcp-3.0.5/README /usr/share/doc/dhcp-3.0.5/RELNOTES /usr/share/doc/dhcp-3.0.5/api+protocol /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /usr/share/doc/dhcp-3.0.5/draft-ietf-dhc-authentication-14.txt /usr/share/doc/dhcp-3.0.5/draft-ietf-dhc-dhcp-dns-12.txt /usr/share/doc/dhcp-3.0.5/draft-ietf-dhc-failover-07.txt /usr/share/doc/dhcp-3.0.5/ja_JP.eucJP /usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhclient-script.8 /usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhclient.8 /usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhclient.conf.5 /usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhclient.leases.5 /usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhcp-eval.5 /usr/share/doc/dhcp-3.0.5/ja_JP.eucJP/dhcp-options.5 /usr/share/doc/dhcp-3.0.5/rfc1542.txt /usr/share/doc/dhcp-3.0.5/rfc2131.txt /usr/share/doc/dhcp-3.0.5/rfc2132.txt /usr/share/doc/dhcp-3.0.5/rfc2485.txt /usr/share/doc/dhcp-3.0.5/rfc2489.txt /usr/share/doc/dhcp-3.0.5/rfc951.txt /usr/share/man/man5/dhcp-eval.5.gz /usr/share/man/man5/dhcp-options.5.gz /usr/share/man/man5/dhcpd-eval.5.gz /usr/share/man/man5/dhcpd-options.5.gz /usr/share/man/man5/dhcpd.conf.5.gz /usr/share/man/man5/dhcpd.leases.5.gz /usr/share/man/man8/dhcpd.8.gz /var/lib/dhcpd /var/lib/dhcpd/dhcpd.leases [root@rhel510 ~]# |
文件:dhcpd.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
[root@rhel510 ~]# cat /etc/dhcpd.conf # # DHCP Server Configuration file. # see /usr/share/doc/dhcp*/dhcpd.conf.sample #[root@rhel510 ~]# [root@rhel510 ~]# cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcpd.conf cp: overwrite `/etc/dhcpd.conf'? y [root@rhel510 ~]# 开始编辑: [root@rhel510 ~]# vi /etc/dhcpd.conf [root@rhel510 ~]# cat /etc/dhcpd.conf ddns-update-style interim; ignore client-updates; # for DHCP next-server 192.168.56.132; subnet 192.168.56.0 netmask 255.255.255.0 { # --- default gateway option routers 192.168.56.2; option subnet-mask 255.255.255.0; option nis-domain "d-prototype.com"; option domain-name "d-prototype.com"; option domain-name-servers 192.168.56.132; option time-offset -18000; # Eastern Standard Time # option ntp-servers 192.168.1.1; # option netbios-name-servers 192.168.1.1; # --- Selects point-to-point node (default is hybrid). Don't change this unless # -- you understand Netbios very well # option netbios-node-type 2; range dynamic-bootp 192.168.56.164 192.168.56.254; default-lease-time 21600; max-lease-time 43200; # we want the nameserver to appear at a fixed address # host ns { # next-server marvin.redhat.com; # hardware ethernet 12:34:56:78:AB:CD; # fixed-address 207.175.42.254; # } # for DHCP filename "/pxelinux.0"; } [root@rhel510 ~]# |
如上,需要注意:
1.相关的网关与IP改掉;
2.文件头部“ignore client-updates;”后的“next-server”跟进的是当前PXE Server的IP地址;
3.该文件末尾添加:“filename “/pxelinux.0”;”;
4.“range dynamic-bootp”表示DHCP分发IP的最小与最大边界;
启动DHCP服务:
1 2 3 4 5 6 |
[root@rhel510 ~]# service dhcpd status dhcpd is stopped [root@rhel510 ~]# [root@rhel510 ~]# service dhcpd start Starting dhcpd: [ OK ] [root@rhel510 ~]# |
如果dhcpd.conf配置文件写的有问题,启动会失败:
1 2 3 |
[root@rhel510 ~]# service dhcpd start Starting dhcpd: [FAILED] [root@rhel510 ~]# |
这时候可以通过日志:/var/log/message找到更详细的报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Dec 17 05:05:06 rhel510 dhcpd: Internet Systems Consortium DHCP Server V3.0.5-RedHat Dec 17 05:05:06 rhel510 dhcpd: Copyright 2004-2006 Internet Systems Consortium. Dec 17 05:05:06 rhel510 dhcpd: All rights reserved. Dec 17 05:05:06 rhel510 dhcpd: For info, please visit http://www.isc.org/sw/dhcp/ Dec 17 05:05:06 rhel510 dhcpd: Address range 192.168.56.164 to 192.168.0.254, netmask 255.255.255.0 spans multiple subnets! Dec 17 05:05:06 rhel510 dhcpd: Dec 17 05:05:06 rhel510 dhcpd: If you did not get this software from ftp.isc.org, please Dec 17 05:05:06 rhel510 dhcpd: get the latest from ftp.isc.org and install that before Dec 17 05:05:06 rhel510 dhcpd: requesting help. Dec 17 05:05:06 rhel510 dhcpd: Dec 17 05:05:06 rhel510 dhcpd: If you did get this software from ftp.isc.org and have not Dec 17 05:05:06 rhel510 dhcpd: yet read the README, please read it before requesting help. Dec 17 05:05:06 rhel510 dhcpd: If you intend to request help from the dhcp-server@isc.org Dec 17 05:05:06 rhel510 dhcpd: mailing list, please read the section on the README about Dec 17 05:05:06 rhel510 dhcpd: submitting bug reports and requests for help. Dec 17 05:05:06 rhel510 dhcpd: Dec 17 05:05:06 rhel510 dhcpd: Please do not under any circumstances send requests for Dec 17 05:05:06 rhel510 dhcpd: help directly to the authors of this software - please Dec 17 05:05:06 rhel510 dhcpd: send them to the appropriate mailing list as described in Dec 17 05:05:06 rhel510 dhcpd: the README file. Dec 17 05:05:06 rhel510 dhcpd: Dec 17 05:05:06 rhel510 dhcpd: exiting. |
如果没有问题,DHCP服务将被成功启动,它的后台日志为:
1 2 3 4 5 6 7 8 |
Dec 17 05:15:39 rhel510 dhcpd: Internet Systems Consortium DHCP Server V3.0.5-RedHat Dec 17 05:15:39 rhel510 dhcpd: Copyright 2004-2006 Internet Systems Consortium. Dec 17 05:15:39 rhel510 dhcpd: All rights reserved. Dec 17 05:15:39 rhel510 dhcpd: For info, please visit http://www.isc.org/sw/dhcp/ Dec 17 05:15:39 rhel510 dhcpd: Wrote 0 leases to leases file. Dec 17 05:15:39 rhel510 dhcpd: Listening on LPF/eth0/00:0c:29:2d:3e:85/192.168.56/24 Dec 17 05:15:39 rhel510 dhcpd: Sending on LPF/eth0/00:0c:29:2d:3e:85/192.168.56/24 Dec 17 05:15:39 rhel510 dhcpd: Sending on Socket/fallback/fallback-net |
至此,服务:DHCP,配置完成。
三、配置PXE。
确认文件:/etc/xinetd.d/tftp中“server_args”中指定的“-s /pxe_root/tftpboot”路径存在:
(默认情况下为:/tftpboot,但这不是一定的,你可以根据自己的需求做出相应的更改。)
1 2 3 4 5 |
[root@rhel510 ~]# ll /pxe_root/ lost+found/ tftpboot/ [root@rhel510 ~]# ll /pxe_root/tftpboot/ total 0 [root@rhel510 ~]# |
拷贝PXE的引导文件到tftpboot中:
1 2 3 4 5 6 7 8 9 10 11 |
[root@rhel510 ~]# find /usr/ -name "pxelinux.0" /usr/share/syslinux/pxelinux.0 [root@rhel510 ~]# [root@rhel510 ~]# file /usr/share/syslinux/pxelinux.0 /usr/share/syslinux/pxelinux.0: data [root@rhel510 ~]# [root@rhel510 ~]# cp /usr/share/syslinux/pxelinux.0 /pxe_root/tftpboot/ [root@rhel510 ~]# ll /pxe_root/tftpboot/ total 28 -rw-r--r-- 1 root root 26828 Dec 17 05:23 pxelinux.0 [root@rhel510 ~]# |
将系统光盘的isolinux的资料拷贝到tftpboot中:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
[root@rhel510 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 15G 2.6G 12G 19% / /dev/sda1 289M 17M 258M 7% /boot tmpfs 2.0G 0 2.0G 0% /dev/shm /dev/sdb1 40G 177M 38G 1% /pxe_root /dev/sr0 4.1G 4.1G 0 100% /iso [root@rhel510 ~]# ls -l /iso | grep --color isolinux dr-xr-xr-x 2 root root 2048 Sep 10 2013 isolinux [root@rhel510 ~]# ls /iso/isolinux/ boot.cat boot.msg general.msg initrd.img isolinux.bin isolinux.cfg memtest options.msg param.msg rescue.msg splash.lss TRANS.TBL vmlinuz [root@rhel510 ~]# [root@rhel510 ~]# cp /iso/isolinux/* /pxe_root/tftpboot/ [root@rhel510 ~]# ll /pxe_root/tftpboot/ total 14608 -r--r--r-- 1 root root 2048 Dec 17 05:25 boot.cat -r--r--r-- 1 root root 292 Dec 17 05:25 boot.msg -r--r--r-- 1 root root 919 Dec 17 05:25 general.msg -r--r--r-- 1 root root 12593055 Dec 17 05:25 initrd.img -r--r--r-- 1 root root 24576 Dec 17 05:25 isolinux.bin -r-xr-xr-x 1 root root 364 Dec 17 05:25 isolinux.cfg -r--r--r-- 1 root root 94600 Dec 17 05:25 memtest -r--r--r-- 1 root root 817 Dec 17 05:25 options.msg -r--r--r-- 1 root root 517 Dec 17 05:25 param.msg -rw-r--r-- 1 root root 26828 Dec 17 05:23 pxelinux.0 -r--r--r-- 1 root root 490 Dec 17 05:25 rescue.msg -r--r--r-- 1 root root 23107 Dec 17 05:25 splash.lss -r--r--r-- 1 root root 2659 Dec 17 05:25 TRANS.TBL -r--r--r-- 1 root root 2127468 Dec 17 05:25 vmlinuz [root@rhel510 ~]# |
创建并配置pxelinux.cfg路径:
1 2 3 4 5 6 |
[root@rhel510 ~]# mkdir /pxe_root/tftpboot/pxelinux.cfg [root@rhel510 ~]# cp /pxe_root/tftpboot/isolinux.cfg /pxe_root/tftpboot/pxelinux.cfg/default [root@rhel510 ~]# ll /pxe_root/tftpboot/pxelinux.cfg/ total 4 -r-xr-xr-x 1 root root 364 Dec 17 05:27 default [root@rhel510 ~]# |
至此,PXE的配置,完成。
四、服务:NFS。
创建共享路径:
1 2 |
[root@rhel510 ~]# mkdir -p /pxe_root/ftp_data/pub [root@rhel510 ~]# |
配置NFS:
1 2 3 4 |
[root@rhel510 ~]# cat /etc/exports /nfs_me 192.168.56.0/24(rw) /pxe_root/ftp_data/pub 192.168.56.0/24(rw) *(ro) [root@rhel510 ~]# |
重启服务:
1 2 3 4 5 6 7 8 9 10 |
[root@rhel510 ~]# showmount -e Export list for rhel510: /nfs_me 192.168.56.0/24 [root@rhel510 ~]# service nfs reload [root@rhel510 ~]# [root@rhel510 ~]# showmount -e Export list for rhel510: /nfs_me 192.168.56.0/24 /pxe_root/ftp_data/pub (everyone) [root@rhel510 ~]# |
至此,NFS的配置完成。
还需要将希望自动化部署的光盘介质的内容全部拷贝到目录:/pxe_root/ftp_data/pub中,即可。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
[root@rhel510 ~]# cd /iso [root@rhel510 iso]# ls Cluster README-gu.html README-te.html RELEASE-NOTES-kn.html RELEASE-NOTES-U10-en.html RELEASE-NOTES-U10-ru.html ClusterStorage README-hi.html README-zh_CN.html RELEASE-NOTES-ko.html RELEASE-NOTES-U10-es.html RELEASE-NOTES-U10-ta.html EULA README-it.html README-zh_TW.html RELEASE-NOTES-ml.html RELEASE-NOTES-U10-fr.html RELEASE-NOTES-U10-te.html eula.en_US README-ja.html RELEASE-NOTES-as.html RELEASE-NOTES-mr.html RELEASE-NOTES-U10-gu.html RELEASE-NOTES-U10-zh_CN.html GPL README-kn.html RELEASE-NOTES-bn.html RELEASE-NOTES-or.html RELEASE-NOTES-U10-hi.html RELEASE-NOTES-U10-zh_TW.html images README-ko.html RELEASE-NOTES-de.html RELEASE-NOTES-pa.html RELEASE-NOTES-U10-it.html RELEASE-NOTES-zh_CN.html isolinux README-ml.html RELEASE-NOTES-en RELEASE-NOTES-pt_BR.html RELEASE-NOTES-U10-ja.html RELEASE-NOTES-zh_TW.html README-as.html README-mr.html RELEASE-NOTES-en.html RELEASE-NOTES-ru.html RELEASE-NOTES-U10-kn.html RPM-GPG-KEY-redhat-beta README-bn.html README-or.html RELEASE-NOTES-es.html RELEASE-NOTES-ta.html RELEASE-NOTES-U10-ko.html RPM-GPG-KEY-redhat-release README-de.html README-pa.html RELEASE-NOTES-fr.html RELEASE-NOTES-te.html RELEASE-NOTES-U10-ml.html Server README-en README-pt_BR.html RELEASE-NOTES-gu.html RELEASE-NOTES-U10-as.html RELEASE-NOTES-U10-mr.html TRANS.TBL README-en.html README-ru.html RELEASE-NOTES-hi.html RELEASE-NOTES-U10-bn.html RELEASE-NOTES-U10-or.html VT README-es.html README-si.html RELEASE-NOTES-it.html RELEASE-NOTES-U10-de.html RELEASE-NOTES-U10-pa.html README-fr.html README-ta.html RELEASE-NOTES-ja.html RELEASE-NOTES-U10-en RELEASE-NOTES-U10-pt_BR.html [root@rhel510 iso]# [root@rhel510 iso]# du -sh /pxe_root/ftp_data/pub/ 4.0K /pxe_root/ftp_data/pub/ [root@rhel510 iso]# ls /pxe_root/ftp_data/pub/ [root@rhel510 iso]# [root@rhel510 iso]# cp -r * /pxe_root/ftp_data/pub/ (... ... Long time wait。) [root@rhel510 iso]# du -sh /pxe_root/ftp_data/pub/ 4.1G /pxe_root/ftp_data/pub/ [root@rhel510 iso]# ls /pxe_root/ftp_data/pub/ Cluster README-gu.html README-te.html RELEASE-NOTES-kn.html RELEASE-NOTES-U10-en.html RELEASE-NOTES-U10-ru.html ClusterStorage README-hi.html README-zh_CN.html RELEASE-NOTES-ko.html RELEASE-NOTES-U10-es.html RELEASE-NOTES-U10-ta.html EULA README-it.html README-zh_TW.html RELEASE-NOTES-ml.html RELEASE-NOTES-U10-fr.html RELEASE-NOTES-U10-te.html eula.en_US README-ja.html RELEASE-NOTES-as.html RELEASE-NOTES-mr.html RELEASE-NOTES-U10-gu.html RELEASE-NOTES-U10-zh_CN.html GPL README-kn.html RELEASE-NOTES-bn.html RELEASE-NOTES-or.html RELEASE-NOTES-U10-hi.html RELEASE-NOTES-U10-zh_TW.html images README-ko.html RELEASE-NOTES-de.html RELEASE-NOTES-pa.html RELEASE-NOTES-U10-it.html RELEASE-NOTES-zh_CN.html isolinux README-ml.html RELEASE-NOTES-en RELEASE-NOTES-pt_BR.html RELEASE-NOTES-U10-ja.html RELEASE-NOTES-zh_TW.html README-as.html README-mr.html RELEASE-NOTES-en.html RELEASE-NOTES-ru.html RELEASE-NOTES-U10-kn.html RPM-GPG-KEY-redhat-beta README-bn.html README-or.html RELEASE-NOTES-es.html RELEASE-NOTES-ta.html RELEASE-NOTES-U10-ko.html RPM-GPG-KEY-redhat-release README-de.html README-pa.html RELEASE-NOTES-fr.html RELEASE-NOTES-te.html RELEASE-NOTES-U10-ml.html Server README-en README-pt_BR.html RELEASE-NOTES-gu.html RELEASE-NOTES-U10-as.html RELEASE-NOTES-U10-mr.html TRANS.TBL README-en.html README-ru.html RELEASE-NOTES-hi.html RELEASE-NOTES-U10-bn.html RELEASE-NOTES-U10-or.html VT README-es.html README-si.html RELEASE-NOTES-it.html RELEASE-NOTES-U10-de.html RELEASE-NOTES-U10-pa.html README-fr.html README-ta.html RELEASE-NOTES-ja.html RELEASE-NOTES-U10-en RELEASE-NOTES-U10-pt_BR.html [root@rhel510 iso]# |
至此,NFS部分,完成。
五、设置服务开机启动:
1 2 3 4 5 6 7 |
[root@rhel510 iso]# chkconfig dhcpd on [root@rhel510 iso]# chkconfig portmap on [root@rhel510 iso]# chkconfig syslog on [root@rhel510 iso]# chkconfig nfs on [root@rhel510 iso]# chkconfig xinetd on [root@rhel510 iso]# chkconfig network on [root@rhel510 iso]# |
六、测试PXE。
到了这里,其实PXE Server的配置已经完成了。
七、Kickstart。
到了上面,PXE帮助引导让我们找到了安装操作系统的介质。
但是接下来的安装还是需要我们一步步的手动执行。
为了让这个过程也自动化,我们可以采用Kickstart的脚本(类似于Oracle数据库的相应文件,两者作用都是一样的:无人值守的静默安装)。
Kickstart可以通过RHEL的命令“system-config-kickstart”生成:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
[root@rhel510 ~]# rpm -qa | grep --color kickstart [root@rhel510 ~]# [root@rhel510 ~]# yum list | grep --color kickstart This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. pykickstart.noarch 0.43.9-1.el5 Server system-config-kickstart.noarch 2.6.19.9-2.el5 Server [root@rhel510 ~]# yum install -y system-config-kickstart Loaded plugins: product-id, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package system-config-kickstart.noarch 0:2.6.19.9-2.el5 set to be updated --> Processing Dependency: pykickstart for package: system-config-kickstart --> Running transaction check ---> Package pykickstart.noarch 0:0.43.9-1.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================== Installing: system-config-kickstart noarch 2.6.19.9-2.el5 Server 980 k Installing for dependencies: pykickstart noarch 0.43.9-1.el5 Server 129 k Transaction Summary ===================================================================================================================================================== Install 2 Package(s) Upgrade 0 Package(s) Total download size: 1.1 M Downloading Packages: ----------------------------------------------------------------------------------------------------------------------------------------------------- Total 1.2 GB/s | 1.1 MB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : pykickstart 1/2 Installing : system-config-kickstart 2/2 Installed: system-config-kickstart.noarch 0:2.6.19.9-2.el5 Dependency Installed: pykickstart.noarch 0:0.43.9-1.el5 Complete! [root@rhel510 ~]# [root@rhel510 ~]# [root@rhel510 ~]# rpm -qa | grep --color kickstart pykickstart-0.43.9-1.el5 system-config-kickstart-2.6.19.9-2.el5 [root@rhel510 ~]# [root@rhel510 ~]# export DISPLAY=192.168.56.1:0.0 [root@rhel510 ~]# xhost + access control disabled, clients can connect from any host [root@rhel510 ~]# [root@rhel510 ~]# system-config-kickstart & [1] 17317 [root@rhel510 ~]# Loaded plugins: product-id [root@rhel510 ~]# |
查看Kickstart文件内容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
[root@rhel510 ~]# pwd /root [root@rhel510 ~]# ll total 68 -rw------- 1 root root 879 Dec 2 13:33 anaconda-ks.cfg drwxr-xr-x 2 root root 4096 Dec 2 13:43 Desktop -rw-r--r-- 1 root root 36679 Dec 2 13:33 install.log -rw-r--r-- 1 root root 4038 Dec 2 13:32 install.log.syslog -rw-r--r-- 1 root root 1028 Dec 17 06:09 ks-rhel5u10-64.cfg [root@rhel510 ~]# [root@rhel510 ~]# cat ks-rhel5u10-64.cfg #platform=x86, AMD64, or Intel EM64T # System authorization information auth --useshadow --enablemd5 # System bootloader configuration bootloader --location=mbr # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --initlabel # Use graphical install graphical # Firewall configuration firewall --disabled # Run the Setup Agent on first boot firstboot --disable # System keyboard keyboard us # System language lang en_US # Installation logging level logging --level=info # Use NFS installation media nfs --server=192.168.56.132 --dir=/pxe_root/ftp_data/pub # Network information network --bootproto=dhcp --device=eth0 --onboot=on # Reboot after installation reboot #Root password rootpw --iscrypted $1$o4AKX7/J$C8mSQkO75hKbv3WwS8LuL1 # SELinux configuration selinux --disabled # System timezone timezone --isUtc Asia/Shanghai # Install OS instead of upgrade install # X Window System configuration information xconfig --defaultdesktop=GNOME --depth=32 --resolution=1024x768 --startxonboot [root@rhel510 ~]# |
Kickstart文件除了可以通过上面的方法获得之外,在你正常安装完了RHEL之后,/root/路径下会自动的生成一个anaconda-ks.cfg的Kickstart文件。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
[root@rhel510 ~]# pwd /root [root@rhel510 ~]# ll total 64 -rw------- 1 root root 880 Dec 17 06:11 anaconda-ks.cfg drwxr-xr-x 2 root root 4096 Dec 2 13:43 Desktop -rw-r--r-- 1 root root 36679 Dec 2 13:33 install.log -rw-r--r-- 1 root root 4038 Dec 2 13:32 install.log.syslog -rw-r--r-- 1 root root 1030 Dec 17 06:12 ks-rhel5u10-64.cfg [root@rhel510 ~]# [root@rhel510 ~]# cat anaconda-ks.cfg # Kickstart file automatically generated by anaconda. install cdrom key --skip lang en_US.UTF-8 keyboard us xconfig --startxonboot --resolution 800x600 network --device eth0 --bootproto dhcp rootpw --iscrypted $1$d5$tHYO6d1gIwAUxW8gxvuNZ. firewall --enabled --port=22:tcp authconfig --useshadow --enablemd5 selinux --enforcing timezone --utc America/Los_Angeles bootloader --location=mbr --driveorder=sda --append="rhgb quiet" # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work #clearpart --all --initlabel #part /boot --fstype ext3 --size=300 #part / --fstype ext3 --size=3000 --grow #part swap --size=1000 --grow --maxsize=5952 %packages @X Window System @GNOME Desktop Environment @Graphical Internet @Development Tools python [root@rhel510 ~]# |
该文件真实的记录了你安装当前系统时的策略。
这里,我们选择anaconda-ks.cfg来为我们的系统安装提供自动化引导。
由于生成anaconda-ks.cfg 时,我们是使用光盘安装的,而接下来我们将通过NFS安装,所以anaconda-ks.cfg文件需要作出一些修改:
将第三、四行的“install”、“cdrom”改为“install nfs xxxxxx”。
改后结果如下:
(最终应用的Kickstart脚本)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
[root@rhel510 ~]# cat anaconda-ks.cfg # Kickstart file automatically generated by anaconda. # Install OS Instead of upgrade install # Use NFS Installation media nfs --server=192.168.56.132 --dir=/pxe_root/ftp_data/pub # About Keyborad key --skip keyboard us # System Language lang en_US.UTF-8 # X Window System Configuration Info xconfig --defaultdesktop=GNOME --depth=32 --resolution=1024x768 # Use graphical Install graphical # No firewall #firewall --enabled --port=22:tcp firewall --disabled # System authorization Info authconfig --useshadow --enablemd5 # No SELinux #selinux --enforcing selinux --disabled # Timezone is Asia China Shanghai #timezone --utc America/Los_Angeles timezone --isUtc Asia/Shanghai # System bootloader Configuration bootloader --location=mbr --driveorder=sda --append="rhgb quiet" # Network Info network --bootproto=dhcp --device=eth0 --onboot=on # Reboot after install reboot # Root Password rootpw --iscrypted $1$o4AKX7/J$C8mSQkO75hKbv3WwS8LuL1 # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work clearpart --all --initlabel part /boot --fstype ext3 --size=300 part / --fstype ext3 --size=3000 --grow part swap --size=1000 --grow --maxsize=5952 # Clear the Master Boot Record #zerombr # Partition clearing info #clearpart --all --initlabel %packages @X Window System @GNOME Desktop Environment @Graphical Internet @Development Tools python [root@rhel510 ~]# |
将Kickstart配置到PXE中.
复制*.cfg脚本到PXE中:
1 2 3 4 5 6 7 8 9 10 11 |
[root@rhel510 ~]# mkdir /pxe_root/ftp_data/pub/kickstat_me [root@rhel510 ~]# cp anaconda-ks.cfg /pxe_root/ftp_data/pub/kickstat_me/ks_for_rhel5u10.cfg [root@rhel510 ~]# ll /pxe_root/ftp_data/pub/kickstat_me/ total 4 -rw------- 1 root root 1407 Dec 17 06:35 ks_for_rhel5u10.cfg [root@rhel510 ~]# [root@rhel510 ~]# chmod 644 /pxe_root/ftp_data/pub/kickstat_me/ks_for_rhel5u10.cfg [root@rhel510 ~]# ll /pxe_root/ftp_data/pub/kickstat_me/ total 4 -rw-r--r-- 1 root root 1407 Dec 17 06:35 ks_for_rhel5u10.cfg [root@rhel510 ~]# |
修改:pxelinux.cfg/default。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
[root@rhel510 ~]# vi /pxe_root/tftpboot/pxelinux.cfg/default [root@rhel510 ~]# cat /pxe_root/tftpboot/pxelinux.cfg/default default linux prompt 1 timeout 600 display boot.msg F1 boot.msg F2 options.msg F3 general.msg F4 param.msg F5 rescue.msg label linux kernel vmlinuz append ks=nfs:192.168.56.132:/pxe_root/ftp_data/pub/kickstat_me/ks_for_rhel5u10.cfg initrd=initrd.img label text kernel vmlinuz append initrd=initrd.img text label ks kernel vmlinuz append ks initrd=initrd.img label local localboot 1 label memtest86 kernel memtest append - [root@rhel510 ~]# |
如上,label linux的append的ks定义了去哪里找kickstart文件。
至此,Kickstart的PXE配置完成。
通过Kickstart + PXE安装完成后的系统,状态如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
[root@rhel510 ~]# ssh 192.168.56.253 The authenticity of host '192.168.56.253 (192.168.56.253)' can't be established. RSA key fingerprint is d1:57:1f:b8:e7:d8:28:80:60:08:a9:d1:83:d8:8d:3c. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.56.253' (RSA) to the list of known hosts. Address 192.168.56.253 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT! root@192.168.56.253's password: Last login: Fri Dec 18 07:10:26 2015 [root@localhost ~]# [root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:2E:25:3B inet addr:192.168.56.253 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe2e:253b/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:75 errors:0 dropped:0 overruns:0 frame:0 TX packets:69 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:9596 (9.3 KiB) TX bytes:10970 (10.7 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1298 errors:0 dropped:0 overruns:0 frame:0 TX packets:1298 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4035876 (3.8 MiB) TX bytes:4035876 (3.8 MiB) [root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 15G 2.3G 12G 17% / /dev/sda1 289M 17M 258M 6% /boot tmpfs 1004M 0 1004M 0% /dev/shm [root@localhost ~]# [root@localhost ~]# fdisk -l Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 38 305203+ 83 Linux /dev/sda2 39 1967 15494692+ 83 Linux /dev/sda3 1968 2610 5164897+ 82 Linux swap / Solaris [root@localhost ~]# [root@localhost ~]# sestatus SELinux status: disabled [root@localhost ~]# [root@localhost ~]# service iptables status Firewall is stopped. [root@localhost ~]# |
终了。
——————————————
Done。