山火贲,在线字典查询,揭阳水库抓到真水鬼
大规模装机时,使用无人值守装机便可大大简便人工操作,提高效率。
ens33
为nat
网络,ens37
为仅主机网络,配置ens37
[root@localhost ~]# cd /etc/sysconfig/network-scripts/ [root@localhost network-scripts]# cp ifcfg-ens33 ifcfg-ens37 [root@localhost network-scripts]# vim ifcfg-ens37 type=ethernet bootproto=static device=ens37 onboot=yes ipaddr=192.168.100.100 netmask=255.255.255.0 gateway=192.168.100.1
[root@localhost ~]# service network restart restarting network (via systemctl): [ ok ]
[root@localhost ~]# ifconfig ens33 ens33: flags=4163<up,broadcast,running,multicast> mtu 1500 inet 192.168.28.128 netmask 255.255.255.0 broadcast 192.168.28.255 inet6 fe80::605e:3c48:bafd:e550 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:bc:ab:96 txqueuelen 1000 (ethernet) rx packets 635342 bytes 935571060 (892.2 mib) rx errors 0 dropped 0 overruns 0 frame 0 tx packets 288265 bytes 17505470 (16.6 mib) tx errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]# ifconfig ens37 ens37: flags=4163<up,broadcast,running,multicast> mtu 1500 inet 192.168.100.100 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::20c:29ff:febc:aba0 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:bc:ab:a0 txqueuelen 1000 (ethernet) rx packets 1514 bytes 461770 (450.9 kib) rx errors 0 dropped 0 overruns 0 frame 0 tx packets 186 bytes 31726 (30.9 kib) tx errors 0 dropped 0 overruns 0 carrier 0 collisions 0
dhcp
软件包[root@localhost ~]# yum install dhcp -y
dhcp
配置文件[root@localhost ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf cp: overwrite ‘/etc/dhcp/dhcpd.conf’? y
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
27-40
行配置网段信息。subnet 192.168.100.0 netmask 255.255.255.0 { range 192.168.100.20 192.168.100.50; option routers 192.168.100.100; option domain-name-servers 114.114.114.114; next-server 192.168.100.100; filename "pxelinux.0"; }
syslinux
软件包[root@localhost ~]# yum install syslinux -y
pxelinux.0
引导程序[root@localhost ~]# rpm -ql syslinux | grep pxelinux.0 /usr/share/syslinux/gpxelinux.0 /usr/share/syslinux/pxelinux.0
tftp-server
软件包[root@localhost ~]# yum install tftp-server -y
tftp-server
文件列表[root@localhost ~]# rpm -ql tftp-server /etc/xinetd.d/tftp /usr/lib/systemd/system/tftp.service /usr/lib/systemd/system/tftp.socket /usr/sbin/in.tftpd /usr/share/doc/tftp-server-5.2 /usr/share/doc/tftp-server-5.2/changes /usr/share/doc/tftp-server-5.2/readme /usr/share/doc/tftp-server-5.2/readme.security /usr/share/man/man8/in.tftpd.8.gz /usr/share/man/man8/tftpd.8.gz /var/lib/tftpboot
pxelinux.0
至tftp
站点下[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
tftp
配置文件[root@localhost ~]# vim /etc/xinetd.d/tftp
14
行,yes
改为no
,开启tftp
功能disable = no
[root@localhost ~]# yum install vsftpd -y
[root@localhost ~]# mkdir /var/ftp/centos7 [root@localhost ~]# mount /dev/cdrom /var/ftp/centos7/ mount: /dev/sr0 is write-protected, mounting read-only [root@localhost ~]# df -ht filesystem type size used avail use% mounted on /dev/sda2 xfs 20g 4.3g 16g 22% / devtmpfs devtmpfs 1.9g 0 1.9g 0% /dev tmpfs tmpfs 1.9g 0 1.9g 0% /dev/shm tmpfs tmpfs 1.9g 9.0m 1.9g 1% /run tmpfs tmpfs 1.9g 0 1.9g 0% /sys/fs/cgroup /dev/sda5 xfs 10g 37m 10g 1% /home /dev/sda1 xfs 2.0g 174m 1.9g 9% /boot tmpfs tmpfs 378m 40k 378m 1% /run/user/0 /dev/sr0 iso9660 4.3g 4.3g 0 100% /var/ftp/centos7
initrd.img
和压缩内核vmlinuz
至tftp
站点下[root@localhost ~]# cd /var/ftp/centos7/images/pxeboot/
[root@localhost pxeboot]# cp initrd.img vmlinuz /var/lib/tftpboot/
default
[root@localhost ~]# mkdir /var/lib/tftpboot/pxelinux.cfg [root@localhost ~]# vim /var/lib/tftpboot/pxelinux.cfg/default default auto prompt 1 label auto kernel vmlinuz append initrd=initrd.img method=ftp://192.168.100.100/centos7 label linux text kernel vmlinuz append text initrd=initrd.img method=ftp://192.168.100.100/centos7 label linux rescue kernel vmlinuz append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7
[root@localhost ~]# tree /var/lib/tftpboot/ /var/lib/tftpboot/ ├── initrd.img ├── pxelinux.0 ├── pxelinux.cfg │ └── default └── vmlinuz 1 directory, 4 files
[root@localhost ~]# systemctl enable dhcpd created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service. [root@localhost ~]# systemctl enable tftp created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket. [root@localhost ~]# systemctl enable vsftpd created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service. [root@localhost ~]# systemctl start dhcpd [root@localhost ~]# systemctl start tftp [root@localhost ~]# systemctl start vsftpd
[root@localhost ~]# systemctl stop firewalld [root@localhost ~]# setenforce 0
这一步做完已经可以使用网络引导装机了,但是需要手动选择相关安装配置。
[root@localhost ~]# yum install system-config-kickstart -y
[root@localhost ~]# system-config-kickstart
boot
信息home
信息swap
信息/
信息/var/ftp
[root@localhost ~]# ls /var/ftp/ centos7 ks.cfg pub
/root/anaconda-ks.cfg
中复制需要安装的软件包的参数[root@localhost ~]# vim /root/anaconda-ks.cfg
%packages @^gnome-desktop-environment @base @core @desktop-debugging @dial-up @directory-client @fonts @gnome-desktop @guest-agents @guest-desktop-agents @input-methods @internet-browser @java-platform @multimedia @network-file-system-client @networkmanager-submodules @print-client @x11 chrony kexec-tools %end
ks.cfg
文件最后[root@localhost ~]# vim /var/ftp/ks.cfg
#platform=x86, amd64, or intel em64t #version=devel # install os instead of upgrade install # keyboard layouts keyboard 'us' # root password rootpw --iscrypted $1$mzi8tkpp$whwlrjqndsvomtgoewq0i1 # use network installation url --url="ftp://192.168.100.100/centos7" # system language lang en_us # firewall configuration firewall --disabled # system authorization information auth --useshadow --passalgo=sha512 # use graphical install graphical firstboot --disable # selinux configuration selinux --disabled # network information network --bootproto=dhcp --device=ens33 # reboot after installation reboot # system timezone timezone asia/shanghai # system bootloader configuration bootloader --location=mbr # clear the master boot record zerombr # partition clearing information clearpart --all # disk partitioning information part /boot --fstype="xfs" --size=1024 part /home --fstype="xfs" --size=5120 part swap --fstype="swap" --size=4096 part / --fstype="xfs" --grow --size=1 %packages @^gnome-desktop-environment @base @core @desktop-debugging @dial-up @directory-client @fonts @gnome-desktop @guest-agents @guest-desktop-agents @input-methods @internet-browser @java-platform @multimedia @network-file-system-client @networkmanager-submodules @print-client @x11 chrony kexec-tools %end
[root@localhost ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
default auto prompt 1 label auto kernel vmlinuz append initrd=initrd.img method=ftp://192.168.100.100/centos7 ks=ftp://192.168.100.100/ks.cfg label linux text kernel vmlinuz append text initrd=initrd.img method=ftp://192.168.100.100/centos7 label linux rescue kernel vmlinuz append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7
现在从网络引导启动后就可以自动完成安装,不需要手动操作,完成无人值守安装。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
linux下文本编辑器vim的使用方法(复制、粘贴、替换、行号、撤销、多文件操作)
网友评论