centos7.2 搭建PXE+kickstart多版本系统安装
2018-06-04 19:13
721 查看
网上众多文章,但是自己搭建起来却很少又能用的。
总结下自己的
原理+单系统的实验
这里说明下,最好使用kickstart工具来生成ks.cfg文件(网上参数实在太多,不同系统还要不同的参数)
实验
总结下自己的
原理+单系统的实验
这里说明下,最好使用kickstart工具来生成ks.cfg文件(网上参数实在太多,不同系统还要不同的参数)
实验
系统:CentOS Linux release 7.2.1511 (Core) 内核:3.10.0-327.el7.x86_64 准备工作:关闭 防火墙 和 SELINUX IP:192.168.10.17 yum -y install dhcp cp -f /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf(根据自己dhcp的版本来,不一定是4.1版本的) vim /etc/xinetd.d/tftp disable=no#将yes修改no vi /etc/dhcp/dhcpd.conf subnet 192.168.10.0 netmask 255.255.255.0 { range 192.168.10.100 192.168.10.200; option domain-name-servers pxeserver; option domain-name "1.1.1.1"; option routers 192.168.10.1; option broadcast-address 192.168.10.255; next-server 192.168.10.17; filename "pxelinux.0"; default-lease-time 60000; max-lease-time 720000; } systemctl enable dhcpd systemctl start dhcpd yum -y install nfs* vim /etc/exports /rhel6 192.168.10.0/24(rw,sync) /rhel7 192.168.10.0/24(rw,sync) mkdir /rhel6 /rhel7 虚拟机添加一个光驱(一定点击连接cd-rom设备目录下应该有sr0和sr1两个光驱文件,sr0连接6系统iso sr1连接7系统iso) [root@pxeserver ~]# df -h(这里我先连接了,所以umount掉) Filesystem Size Used Avail Use% Mounted on /dev/sda3 18G 14G 4.5G 75% / devtmpfs 475M 0 475M 0% /dev tmpfs 489M 156K 489M 1% /dev/shm tmpfs 489M 14M 476M 3% /run tmpfs 489M 0 489M 0% /sys/fs/cgroup /dev/sda1 297M 145M 153M 49% /boot tmpfs 98M 0 98M 0% /run/user/0 /dev/sr1 4.1G 4.1G 0 100% /mnt tmpfs 98M 12K 98M 1% /run/user/1000 /dev/sr0 4.2G 4.2G 0 100% /run/media/ding/CentOS_6.5_Final [root@pxeserver ~]# umount /run/media/ding/CentOS_6.5_Final/ [root@pxeserver ~]# umount /mnt/ mount /dev/sr0 /mnt/6 mount /dev/sr1 /mnt/7 cp -a /mnt/6/* /rhel6 cp -a /mnt/7/* /rhel7 vim /etc/exports /dev/sr0 4.2G 4.2G 0 100% /rhel6 /dev/sr1 4.1G 4.1G 0 100% /rhel7 systemctl restart nfs-server.service systemctl enable nfs-server.service yum -y install tftp-server tftp xinetd systemctl restart xinetd.service systemctl restart tftp.service(7里面是tftp) systemctl enable xinetd.service systemctl enable tftp.service yum -y install syslinux-tftpboot cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ cp /rhel6/isolinux/initrd.img /var/lib/tftpboot/Cent6/ cp /rhel6/isolinux/vmlinuz /var/lib/tftpboot/Cent6/ cp /rhel7/isolinux/initrd.img /var/lib/tftpboot/Cent7/ cp /rhel7/isolinux/vmlinuz /var/lib/tftpboot/Cent7/ mkdir /var/lin/tftpboot/pxelinux.cfg cp /rhel6/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default cp /rhel6/isolinux/* /var/lib/tftpboot/ 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 menu default kernel vmlinuz append initrd=initrd.img 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 label memtest86 menu label ^Memory test kernel memtest append - label 7 kernel Cent7/vmlinuz append initrd=Cent7/initrd.img inst.ks=nfs:192.168.10.17:/rhel7/ks.cfg label 6 kernel Cent6/vmlinuz append initrd=Cent6/initrd.img ks=nfs:192.168.10.17:/rhel6/ks.cfg vim /rhel6/ks.cfg #platform=x86, AMD64, 或 Intel EM64T #version=DEVEL # Firewall configuration firewall --disabled # Install OS instead of upgrade 指明是安装系统还是升级系统 install # Use network installation 使用网络安装系统,指明包安装路径 nfs --server=192.168.10.17 --dir=/rhel6 # Root password 设定root密码 rootpw --iscrypted $1$YQ5HiIDI$A82NuasWauRzCl8GWkqn10(这个是加密后的散列值字符,这里我是从/root/anaconda-ks.cfg提取出来用的,下面也会讲下怎么生成自己想要的密码) # System authorization information 密钥加密算法启用shadow文件 auth --useshadow --passalgo=sha512 # Use text mode install 使用文本模式或者图形模式安装系统 text # System keyboard 键盘设定 keyboard us # System language 语言设定 lang en_US # SELinux configuration selinux是否关闭 selinux --disabled # Do not configure the X Window System 是否安装图形界面 skipx # Installation logging level 日志级别 logging --level=info # Reboot after installation 声明安装完成后重启系统 reboot # System timezone 设置时区(可以改成亚洲上海) timezone Africa/Abidjan # System bootloader configuration 设定BootLoader bootloader --location=mbr # Clear the Master Boot Record 清除mbr记录 zerombr # Partition clearing information 清除全部分区 clearpart --all --initlabel # Disk partitioning information 分区设定 part /boot --fstype="ext4" --size=200 part / --fstype="ext4" --size=16000 part swap --fstype="swap" --grow --size=2048 %packages 安装的包设定(这里仅仅最小化安装) @core vim /rhel7/ks.cfg #platform=x86, AMD64, or Intel EM64T #version=DEVEL # Firewall configuration firewall --disabled # Install OS instead of upgrade install # Use FTP installation media nfs --server=192.168.10.17 --dir=/rhel7 # Root password rootpw --iscrypted $1$YQ5HiIDI$A82NuasWauRzCl8GWkqn10 # System authorization information auth useshadow passalgo=sha512 # Use graphical install graphical firstboot disable # System keyboard keyboard us # System language lang en_US # SELinux configuration selinux disabled # Installation logging level logging level=info # System timezone timezone Europe/Amsterdam # System bootloader configuration # Reboot afer installing reboot ##一定要有此 选项否则操作系统安装完后不会自动重启。 ###### bootloader location=mbr clearpart --all --initlabel part swap --asprimary --fstype="swap" --size=1024 part /boot --fstype xfs --size=300 part pv.01 --size=1 --grow volgroup root_vg01 pv.01 logvol / --fstype xfs --name=lv_01 --vgname=root_vg01 --size=1 --grow %packages ###要安装的包 @^minimal @core acpid iputils man net-tools ntp ntpdate parted vim-enhanced wget %end ###以%end结尾 #%addon com_redhat_kdump --disable --reserve-mb='auto' #%end %post #--nochroot --log=/mnt/sysimage/var/log/ks.post01.log mkdir /root/test %end *(7也是最小化安装) *(修改rootpw的方法 [root@pxeserver rhel6]# perl -e 'print crypt("1234abcdefg",q($1$password)),"\n"' $1$password$kMAjDeCG9NGsvGpYFaqE21 1234abcdefg就是密码 ) yum -y install system-config-kickstgart system-config-kickstart #图形化配置应答文件 也可以使用我下面生成的一键安装应答文件,rhel7.0里面没有图像化的安装包选择可以到/root/anaconda-ks.cfg里面 进行拷贝安装图形化的命令到你自己手动创建的ks.cfg文件末行并保存,也可以直接编写,这里直接编写。 将本机机器改成vmnet2,其他要通过17服务器安装的机器也选择vmnet2 第一次启动选择从网络启动 安装完毕后选择从硬盘启动 有问题留言区,共同解决。。
相关文章推荐
- 基于pxe+kickstart 全自动化安装centos系统
- CentOS7.2下PXE+kickstart自动化安装系统
- centos7/rhel7下配置PXE+Kickstart自动安装linux系统
- CentOS dnsmasq 功能外篇——配置PXE服务并使用kickstart安装配置系统
- Kickstart自动化安装部署Centos系统平台的搭建
- DHCP+VSFTPD+TFTP+Kickstart搭建PXE环境实现批量自动化系统安装
- Kickstart+PXE+DHCP+TFTP+FTP网络安装CentOS系统
- 【2017/8/10】PXE+TFTP+VSftp+DHCP+Kickstart无人值守安装系统搭建
- DHCP+TFTP+HTTP+kickstart实现PXE自动化部署系统Centos
- PXE+Kickstart 安装Centos 6.4
- 使用PXE+DHCP+Apache+Kickstart无人值守安装CentOS5.8 x86_64 推荐
- Kickstart+NFS+DHCP+TFTP+PXElinux实现CentOS的网络自动安装
- CentOS5.4 远程安装(PXE+DHCP+tftp+HTTP+kickstart)
- 部署一:PXE+ Kickstart 实现网络安装 单 发行版LINUX系统
- 使用PXE+DHCP+Apache+Kickstart无人值守安装CentOS5.8 x86_64
- 使用PXE+DHCP+Apache+Kickstart系统自动化安装
- 基于kickstart实现网络共享以及制作光盘和U盘实现半自动安装centos6系统
- PXE环境下安装系统(DHCP+TFTP+HTTP+kickstart)
- PXE Server 安装配置( PXE 和 Kickstart 无人值守安装 CentOS Linux 操作系统)
- PXE结合Kickstart实现无人值守安装CentOS6.5