标签:系统化自动安装
7实现PXE支持centos6和7的系统安装
注意:
1 改成独立的网段vnnet12,非桥接,dhcp功能禁用
2 禁用iptables和selinux
1 yum install httpd dhcp tftp-server syslinux
2 cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf
subnet 192.168.37.0 netmask 255.255.255.0 {
range 192.168.37.10 192.168.37.100;
next-server 192.168.37.107;
filename "pxelinux.0";
}
systemctl start dhcpd
systemctl enable dhcpd
3 systemctl enable tftp
systemctl start tftp
4 systemctl enable httpd
systemctl start httpd
5 mkdir /var/www/html/centos/{6,7}
vim /etc/fstab
/dev/sr0 /var/www/html/centos/6 iso9660 defaults 0 0
/dev/sr1 /var/www/html/centos/7 iso9660 defaults 0 0
mount -a
6 mkdir /var/www/html/ksdir
ls /var/www/html/ksdir/
ks6.cfg ks7.cfg
7 cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/tftpboot/
mkdir /var/lib/tftpboot/centos{6,7}
cp /var/www/html/centos/6/isolinux/{initrd.img,vmlinuz} /var/lib/tftpboot/centos6
cp /var/www/html/centos/7/isolinux/{initrd.img,vmlinuz} /var/lib/tftpboot/centos7
mkdir /var/lib/tftpboot/pxelinux.cfg/
cp /var/www/html/centos/7/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
8 vim /var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
timeout 600
menu title CentOS Linux 7
label centos7
menu label ^Auto Install CentOS Linux 7
kernel centos7/vmlinuz
append initrd=centos7/initrd.img ks=http://httpsrv/ksdir/ks7.cfg
label centos6
menu label Auto install CentOS Linux ^6
kernel centos6/vmlinuz
append initrd=centos6/initrd.img ks=http://httpsrv/ksdir/ks6.cfg
label manualcentos6
menu label ^Manual install CentOS Linux 6
kernel centos6/vmlinuz
append initrd=centos6/initrd.img inst.repo=http://httpsrv/centos/6/
label local
menu default
menu label Boot from ^local drive
localboot 0xffff
menu end
tree /var/lib/tftpboot/
/var/lib/tftpboot/
├── centos6
│?? ├── initrd.img
│?? └── vmlinuz
├── centos7
│?? ├── initrd.img
│?? └── vmlinuz
├── menu.c32
├── pxelinux.0
└── pxelinux.cfg
└── default
cobbler安装(基于epel源):
·设置开机启动systemctl enable httpd tftp cobblerd(安装cobbler之后有cobbler这个服务需要启动)
启动服务 systemctl start httpd tftp cobblerd
·vim /etc/obbler/settings (编辑cobbler配置文件,在server,next_server,default_password_crypted行修改,1.自己服务器ip,2.tftp的ip(本机是TFTP服务就是本机ip),3.默认密码)
·cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/tftpboot/
·vim /etc/cobbler/dhcp.template (修改网络ip地址和地址段)
·cobbler sync(修改完执行,自动导入到dhcp配置文件里)
·cobbler import --path=/misc/cd/ --name=centos7.3 --arch=x86_64(导入系统光盘到cobbler,--path为光盘路径|cobbler distro list命令查看导入的系统!可以导入多个,指定多个多个光盘路径)
#·/var/www/cobbler/ks_mirror(上一步导入,导入到当前目录下)
#·自己制定ks.cfg(应答文件)文件时指定特定路径(url --url=$tree)
·添加启动菜单项:
--name为启动时的菜单选项
--distro为cobbler distro list的选项(yum源选项)
--kickstart应答文件存放路径必须为此路径
·启动菜单选项删除:
基于web的cobbler:
·yum install cobbler-web
·添加用户首次添加需要加上-c选项,之后添加就不需要。
·第二种添加用户
useradd –s /sbin/nologin xxx1
echo xxx2 | passwd –stdin xxx1
vim /etc/cobbler/user.conf
标签:系统化自动安装
原文地址:http://13314012.blog.51cto.com/13304012/1975450