您好,登錄后才能下訂單哦!
服務端:
1、DHCP服務 指定分配ip地址 定位引導文件next-server //指向TFTP路徑
filename //引導程序文件位置
—————————————————————————2、TFTP服務(簡單文件傳輸協議) UDP69端口
高效率 容量小
(引導程序pxelinnx.0(syslinux包),壓縮內核vmlinuz,
系統初始化文件initrd.img,啟動菜單default)—————————————————————————
3.FTP (vsftp) 文件傳輸協議 系統鏡像(centos7)
安全 容量大 TCP 20(數據傳輸), 21(連接)—————————————————————————
安裝包:dhcp, tftp-server, vsftp, syslinux
4.安裝并配置kickstart無人值守
[root@localhost ~]# ifconfig //查看網卡詳細信息
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.17.128 netmask 255.255.255.0 broadcast 192.168.17.255
inet6 fe80::e3c7:14af:6e4d:7216 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:c9:dd:05 txqueuelen 1000 (Ethernet)
RX packets 622 bytes 385786 (376.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 217 bytes 18826 (18.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::658e:4c2d:2273:9cf5 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:c9:dd:0f txqueuelen 1000 (Ethernet)
RX packets 7 bytes 795 (795.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 82 bytes 13820 (13.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
//我們的兩塊網卡有了
[root@localhost ~]# cd /etc/sysconfig/network-scripts/ //到我們的網卡配置文件夾中
[root@localhost network-scripts]# ls
ifcfg-ens33 ifdown-isdn ifup ifup-plip ifup-tunnel
ifcfg-lo ifdown-post ifup-aliases ifu-plusb ifup-wireless
ifdown ifdown-ppp ifup-bnep ifup-post init.ipv6-global
ifdown-bnep ifdown-routes ifup-eth ifup-ppp network-functions
ifdown-eth ifdown-sit ifup-ib ifup-routes network-functions-ipv6
ifdown-ib ifdown-Team ifup-ippp ifup-sit
ifdown-ippp ifdown-TeamPort ifup-ipv6 ifup-Team
ifdown-ipv6 ifdown-tunnel ifup-isdn ifup-TeamPort
[root@localhost network-scripts]# cp -p ifcfg-ens33 ifcfg-ens36 //復制ens33網卡的信息到ens36中
[root@localhost network-scripts]# vim ifcfg-ens36 //進入ens36網卡進行配置
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static //靜態
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens36
DEVICE=ens36
ONBOOT=yes
IPADDR=192.168.100.100 //IP地址
NETMASK=255.255.255.0 //子網掩碼
GATWAY=192.168.100.100 //默認網關
~
~
~
~
~
~
~
~
~
:wq //保存退出
[root@localhost network-scripts]# systemctl restart network //重啟網絡服務,查看我們的網址有沒有配上去
[root@localhost network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.17.128 netmask 255.255.255.0 broadcast 192.168.17.255
inet6 fe80::e3c7:14af:6e4d:7216 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:c9:dd:05 txqueuelen 1000 (Ethernet)
RX packets 2302 bytes 679197 (663.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 951 bytes 111027 (108.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens36: 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::658e:4c2d:2273:9cf5 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:c9:dd:0f txqueuelen 1000 (Ethernet)
RX packets 9 bytes 1281 (1.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 230 bytes 39857 (38.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost network-scripts]# yum install dhcp -y //安裝DHCP服務
[root@localhost network-scripts]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
cp:是否覆蓋"/etc/dhcp/dhcpd.conf"? yes //復制模板
[root@localhost network-scripts]# vim /etc/dhcp/dhcpd.conf //配置dhcp服務
subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.20 192.168.100.30; //地址范圍
option routers 192.168.100.100; //默認網關指向客戶端
option domain-name-servers 114.114.114.114; //地址解析南京的服務器解析
next-server 192.168.100.100; //指向TFTP服務器是自己的地址
filename "pxelinux.0"; //ftp站點底下的引導程序文件位置
}
#This is a very basic subnet declaration.
:wq
[root@localhost network-scripts]# yum install syslinux -y
[root@localhost network-scripts]# yum install tftp-server -y
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: mirrors.aliyun.com
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 tftp-server.x86_64.0.5.2-22.el7 將被 安裝
--> 解決依賴關系完成
[root@localhost network-scripts]# 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 //站點
cp /usr/share/syslinux/pxelinux.0
[root@localhost network-scripts]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ //復制引導程序到站點
[root@localhost network-scripts]# ls /var/lib/tftpboot/
pxelinux.0
[root@localhost network-scripts]# vim /etc/xinetd.d/tftp
default: off
#description: The tftp server serves files using the trivial file transfer \
protocol. The tftp protocol is often used to boot diskless \
workstations, download configuration files to network-aware printers, \
and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no //把yes改成no就行
per_source = 11
cps = 100 2
flags = IPv4
}
~
~
~
~
~
~
~
~
~
~
:wq
[root@localhost network-scripts]# yum install vsftpd -y //安裝站點
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: mirrors.aliyun.com
正在解決依賴關系
[root@localhost network-scripts]# cd /var/ftp
[root@localhost ftp]# ls
pub
[root@localhost ftp]# mkdir centos7 //創建一個文件夾
[root@localhost ftp]# ls
centos7 pub
[root@localhost ftp]# mount /dev/sr0 /var/ftp/centos7 //掛載
mount: /dev/sr0 寫保護,將以只讀方式掛載
[root@localhost ftp]# df -hT
文件系統 類型 容量 已用 可用 已用% 掛載點
/dev/sda2 xfs 10G 4.3G 5.8G 43% /
devtmpfs devtmpfs 898M 0 898M 0% /dev
tmpfs tmpfs 912M 0 912M 0% /dev/shm
tmpfs tmpfs 912M 9.0M 903M 1% /run
tmpfs tmpfs 912M 0 912M 0% /sys/fs/cgroup
/dev/sda5 xfs 10G 37M 10G 1% /home
/dev/sda1 xfs 6.0G 174M 5.9G 3% /boot
tmpfs tmpfs 183M 20K 183M 1% /run/user/0
/dev/sr0 iso9660 4.3G 4.3G 0 100% /var/ftp/centos7
[root@localhost ftp]# cd centos7/
[root@localhost centos7]# ls
CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7
EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL
[root@localhost centos7]# cd images/
[root@localhost images]# ls
efiboot.img pxeboot TRANS.TBL
[root@localhost images]# cd pxeboot/
[root@localhost pxeboot]# ls
initrd.img TRANS.TBL vmlinuz
[root@localhost pxeboot]# cp initrd.img vmlinuz /var/lib/tftpboot/ 把系統內核和初始化文件放到站點中
[root@localhost pxeboot]# ls /var/lib/tftpboot/
initrd.img pxelinux.0 vmlinuz
[root@localhost pxeboot]#
[root@localhost pxeboot]# cd /var/lib/tftpboot/
[root@localhost tftpboot]# ls
initrd.img pxelinux.0 vmlinuz
[root@localhost tftpboot]# mkdir pxelinux.cfg
[root@localhost tftpboot]# ls
initrd.img pxelinux.0 pxelinux.cfg vmlinuz
[root@localhost tftpboot]# cd pxelinux.cfg
[root@localhost pxelinux.cfg]# vim 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
~
~
~
~
~
~
~
~
~
~
~
~
~
~
:wq
[root@localhost pxelinux.cfg]# systemctl stop firewalld.service 關閉防火墻
[root@localhost pxelinux.cfg]# setenforce 0 //關閉增強功能
[root@localhost pxelinux.cfg]# systemctl start dhcpd //開啟這三個服務
[root@localhost pxelinux.cfg]# systemctl start tftp
[root@localhost pxelinux.cfg]# systemctl start vsftpd
[root@localhost pxelinux.cfg]#
[root@localhost pxelinux.cfg]# yum install system-config-kickstart -y //安裝無人值守工具
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
[root@localhost pxelinux.cfg]# cd /var/ftp/
[root@localhost ftp]# ls
centos7 ks.cfg pub
[root@localhost ftp]# vim ks.cfg
[root@localhost ftp]# cd /root
[root@localhost ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg 公共 模板 視頻 圖片 文檔 下載 音樂 桌面
[root@localhost ~]# vim 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文件地址就可以了ks=ftp://192.168.100.100/ks.cfg
[root@localhost ftp]# cd /var/lib/tftpboot/
[root@localhost tftpboot]# ls
initrd.img pxelinux.0 pxelinux.cfg vmlinuz
[root@localhost tftpboot]# cd pxelinux.cfg/
[root@localhost pxelinux.cfg]# ls
default
[root@localhost pxelinux.cfg]# vim 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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。