CentOS7.0-Kickstart無人值守安裝linux
方法:FTP+TFTP+DHCP+Kickstart+PXEvim
PXE服務器:CentOS7.0-192.168.25.1服務器
1.搭建yum倉庫:socket
[root@max ~]# vim /etc/yum.repos.d/serverl.repoide
[base]url
name=serverspa
baseurl=file:///mntrest
gnabled=1server
gpgcheck=0blog
[root@max ~]# mount /dev/cdrom /mnt
2.配置ftp:
[root@max ~]# yum install vsftpd –y
[root@max ~]# systemctl restart vsftpd.service ;systemctl enable vsftpd.service
3.配置tftp:
[root@max ~]# yum install tftp tftp-server xinetd -y
[root@max ~]# vim /etc/xinetd.d/tftp
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
}
[root@max ~]# systemctl restart xinetd.service ; systemctl restart tftp.service ; systemctl enable tftp.service
4.安裝dhcp,修改配置文件及開啓服務:
[root@max ~]# yum install dhcp –y
[root@max ~]# cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak
[root@max ~]# cp /usr/share/doc/dhcp*/dhcpd.conf.example dhcpd.conf
[root@max ~]# vim /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf
subnet 192.168.25.0 netmask 255.255.255.0 {
range 192.168.25.100 192.168.25.200;
next-server 192.168.25.1;
filename "pxelinux.0";
}
[root@max ~]# systemctl restart dhcpd ;systemctl enable dhcpd
準備工做完成,咱們開始配置Kickstart
[root@max ~]# mkdir /tftpboot
[root@max ~]# mkdir /tftpboot/pxelinux.cfg
[root@max ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/
----若是找不到syslinux目錄,須要安裝包syslinux
[root@max ~]# cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
[root@max ~]# cp /mnt/p_w_picpaths/pxeboot/initrd.img /tftpboot/
[root@max ~]# cp /mnt/p_w_picpaths/pxeboot/vmlinuz /tftpboot/
[root@max ~]# chmod 644 /tftpboot/pxelinux.cfg/default
[root@max ~]# vim /tftpboot/pxelinux.cfg/default
[root@max ~]# yum install system-config-kickstart.noarch –y
[root@max ~]# system-config-kickstart
[root@max ~]#cp ks.cfg /var/ftp
從新掛載CentOS7.0安裝光盤到/var/ftp/pub目錄下,開始執行另外一臺機器的無人值守安裝:
[root@max ~]# umount /dev/cdrom //原來掛載到/mnt下的
[root@max ~]# mount /dev/cdrom /var/ftp/pub
[root@max ~]# iptables -F
[root@max ~]# setenforce 0
[root@max ~]# systemctl stop firewall