标签:pxe 安装linux 网络 自动安装 centos6.5 linux
1.dhcp服务安装和配置
需要的程序: dhcpd
[root@GateWay dhcp]# yum install -y dhcpd
配置dhcpd配置文件:
[root@GateWay dhcp]# vim /etc/dhcp/dhcpd.conf
添加以下内容
subnet 172.16.0.0 netmask 255.255.0.0 { # 注意这里的IP地址要跟你的网卡上的配置一致,否则服务无法启动 range 172.16.0.2 172.16.0.100; next-server 172.16.0.1; filename "pxelinux.0"; option routers 172.16.0.1; option domain-name-servers 8.8.8.8; }
启动服务:
[root@GateWay dhcp]# service dhcpd start Starting dhcpd: [ OK ]
2.配置tftp服务
需要的程序 tftp-server 方便起见 tftp 也安装上
[root@GateWay dhcp]# yum -y install tftp-server tftp
[root@GateWay dhcp]# chkconfig tftp on # 设置tftp服务开机自启动 [root@GateWay dhcp]# chkconfig xinetd on # 设置tftp需要的超级守护进程开机自启动 [root@GateWay dhcp]# service xinetd start # 开启超级守护进程 [root@GateWay dhcp]# ss -unl | grep "69" # 查看tftp的69端口是否开启 UNCONN 0 0 *:69 *:*
3. 准备安装树
[root@GateWay dhcp]# mount /dev/sr0 /var/www/html/centos6/ -r # 把CentOS6.5的DVD安装光盘挂载到网站服务上 [root@GateWay dhcp]# service httpd start # 启动httpd服务 Starting httpd: httpd: apr_sockaddr_info_get() failed for GateWay httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName [ OK ]
4. 准备tftp下的文件
[root@GateWay pxeboot]# cd /var/www/html/centos6/isolinux/ [root@GateWay isolinux]# cp vesamenu.c32 boot.msg splash.jpg /var/lib/tftpboot/ [root@GateWay isolinux]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ [root@GateWay isolinux]# mkdir /var/lib/tftpboot/pxelinux.cfg [root@GateWay isolinux]# cp isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default [root@GateWay isolinux]# cd /var/lib/tftpboot/pxelinux.cfg/ [root@GateWay pxelinux.cfg]# chmod +w default
5. 提供kickstart配置文件
# Kickstart file automatically generated by anaconda. #version=DEVEL install url --url=http://172.16.0.1/centos6/ lang en_US.UTF-8 keyboard us network --onboot yes --device eth0 --bootproto dhcp --noipv6 rootpw --iscrypted $6$lRieOm2AuzqOKJk1$16DB6y2KHugFfuqkcj0Rmcw8568g304tkOSkOg7V7vt04MPvg30iemq48ljTX9iaWlZTVs8wQ5x7dR1.bi6Gc1 # Reboot after installation reboot firewall --service=ssh authconfig --enableshadow --passalgo=sha512 selinux --disabled timezone Asia/Seoul bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb rhgb quiet 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 --drives=sda part /boot --fstype=ext4 --size=500 part pv.008002 --grow --size=1 volgroup vg_stu --pesize=4096 pv.008002 logvol / --fstype=ext4 --name=lv_root --vgname=vg_stu --grow --size=1024 --maxsize=51200 logvol swap --name=lv_swap --vgname=vg_stu --grow --size=2016 --maxsize=2016 repo --name="CentOS" --baseurl=http://172.16.0.1/centos6/ --cost=100 %packages @Base @Core @base @console-internet @core @debugging @directory-client @java-platform @mysql-client @network-file-system-client @performance @perl-runtime @php @postgresql-client @server-platform @server-policy @turbogears @web-server @web-servlet @workstation-policy certmonger device-mapper-persistent-data krb5-workstation oddjob pam_krb5 pax perl-CGI perl-DBD-SQLite samba-winbind sgpio %end
[root@GateWay pxelinux.cfg]# cp /root/anaconda-ks.cfg /var/www/html/ks.cfg [root@GateWay pxelinux.cfg]# chmod +r /var/www/html/ks.cfg [root@GateWay pxelinux.cfg]# vim /var/lib/tftpboot/pxelinux.cfg/default default vesamenu.c32 #prompt 1 timeout 600 display boot.msg menu background splash.jpg menu title Welcome to CentOS 6.5! menu color border 0 #ffffffff #00000000 menu color sel 7 #ffffffff #ff000000 menu color title 0 #ffffffff #00000000 menu color tabmsg 0 #ffffffff #00000000 menu color unsel 0 #ffffffff #00000000 menu color hotsel 0 #ff000000 #ffffffff menu color hotkey 7 #ffffffff #ff000000 menu color scrollbar 0 #ffffffff #00000000 label linux menu label ^Install or upgrade an existing system kernel vmlinuz append ks=http://172.16.0.1/ks.cfg initrd=initrd.img #在这里添加ks.cfg的web路径 label vesa menu label Install system with ^basic video driver kernel vmlinuz append initrd=initrd.img xdriver=vesa nomodeset label rescue menu label ^Rescue installed system kernel vmlinuz append initrd=initrd.img rescue label local menu label Boot from ^local drive localboot 0xffff menu default label memtest86 menu label ^Memory test kernel memtest append -
本文出自 “帝国金菜园子” 博客,请务必保留此出处http://diguojin.blog.51cto.com/5034509/1551467
PXE 安装Linux 网络 自动安装 CentOS6.5 Linux
标签:pxe 安装linux 网络 自动安装 centos6.5 linux
原文地址:http://diguojin.blog.51cto.com/5034509/1551467