91av免费观看_日韩视频在线免费看_日本xxxx色视频在线观看免费_伊人222综合网图片_国产二区三区在线_91麻豆麻豆

IT之道-艾銻知道

您當前位置: 主頁 > 資訊動態 > 艾銻分享 >

服務器維護CentOS 7實現PXE支持CentOS5,6,7的系統安裝


2020-06-07 13:43 作者:admin
服務器維護CentOS 7實現PXE支持CentOS5,6,7的系統安裝
 
如何做好服務器維護?北京艾銻無限科技與你談談IT人員必須知道的服務器維護信息
 
服務器維護小知識主要目的為實現自定義頁面自動化安裝系統,基于PXE支持的網卡,目前實現環境為VMware虛擬機。所用鏡像為CentOS6.9,CentOS7.3及rhel5.4。支持中小規模自動化系統統一安裝。
另:如果最近常見到pxe相關博文,多半為本人的同期,還請不要在意內容的重復性。不同人眼中的pxe自動化安裝,如此理解吧。
環境準備
服務器維護小知識1.網絡環境:獨立網絡環境配備
實驗中需要配置dhcp服務器,所以多余的網絡會和本地dhcp服務器造成沖突。
本人的虛擬機里僅選用了一個獨立網卡,同時主機配置靜態IP。
服務器維護小知識2.外部環境:這里主要指防火墻和SElinux,二者會對實驗造成影響,所以這里,關掉會省去很多麻煩。
服務器維護小知識3.安裝必要軟件包:這里syslinux包里的幾個文件是必須的,dhcpd包提供dhcp服務器環境配置,tftp-server是輕文本傳輸用到的。httpd和ftpd選裝一個就OK,主要是我們從網站或ftp服務器上獲取數據使用。
yum install httpd dhcp tftp-server syslinux --skip-broken
服務器維護小知識原理及過程
從網絡獲取鏡像文件,并獨立配置安裝菜單選項,網絡引導。
當某機使用完成后的環境安裝系統時,首先網卡啟動,然后向本機,即dhcp服務器申請IP。IP獲得后,tftp負責文本傳輸,得到網站上的pxe啟動文檔等信息,并根據引導文件安裝系統。
這里為了簡便,dhcp服務器及http網站等均由本機擔任。
服務器維護小知識實現步驟
1.dhcpd文件配置
[root@CentOS7 ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
#上面的第一個文件是模板,第二個是配置文件
[root@CentOS7 ~]# vim /etc/dhcp/dhcpd.conf
#查照此文件中的模板添加下信息,此段信息最好放在原文件中第一個subnet上方。
subnet 192.168.23.0 netmask 255.255.255.0{
  range 192.168.23.10 192.168.234.100;
  option routes 192.168.23.7;
  next-server 192.168.23.7;        #此處為本機IP
  filename "pxelinux.0";        #pxe啟動文檔
}
2.開啟服務
systemctl enable dhcpd httpd tftp 將服務設為開機啟動
systemctl start dhcpd httpd tftp 啟動服務
systemctl status dhcpd httpd tftp 查看服務狀態
3.掛載鏡像文件到http
確保三個鏡像都已連接,然后按順序掛好。不要弄錯了。
    cd /var/www/html/
    mkdir centos{6,7}
    mkdir rhel5
    echo '- - -' > /sys/class/scsi_host/host2/scan
    mount /dev/sr0 /var/www/html/centos7
    mount /dev/sr1 /var/www/html/centos6
    mount /dev/sr2 /var/www/html/rhel5
    也可以把掛載寫入/etc/fstab文件。
4.編輯安裝引導文件ks.cfg
可以簡單編輯root家目錄下的anaconda-ks.cfg,然后把三個系統的引導文件復制到本機的/var/html/www/下。并注意此文件權限為644。
centos7的.cfg文件參考如下:
[root@centos7 ~]# cat /var/www/html/ks7.cfg 
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
url --url=http://192.168.23.7/centos7
# Use graphical install
#graphical
text
reboot
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
 
# Network information
network  --bootproto=dhcp --device=ens33 --onboot=on --ipv6=auto --activate
network --hostname=centos7.magedu.com
 
# Root password
rootpw --iscrypted $6$/BVcMpadhqgy0l4J$FQ1fqYddKm1zqjxEkXn3XctFXiJ2LLWnVfRPi1u1oF6Wx5ebfKwe.8W0wHfF7oxeqDLJbkJJYTnry7W9o/6KP/
# System services
services --disabled="chronyd"
 
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# X Window System configuration information
xconfig  --startxonboot
# System bootloader configuration
zerombr
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --all --initlabel --drives=sda
# Disk partitioning information
part / --fstype="xfs" --ondisk=sda --size=47683
part /boot --fstype="xfs" --ondisk=sda --size=953
part swap --fstype="swap" --ondisk=sda --size=3814
part /app --fstype="xfs" --ondisk=sda --size=47683
 
%packages
@base
@core
@dial-up
@fonts
@guest-agents
@network-file-system-client
@networkmanager-submodules
@x11
 
%end
%addon com_RedHat_kdump --disable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=50 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=50 --notstrict --nochanges --notempty
pwpolicy luks --minlen=6 --minquality=50 --notstrict --nochanges --notempty
%end
centos6的.cfg參考如下:
[root@centos7 html]# cat /var/www/html/ksdir/ks6.cfg 
# Kickstart file automatically generated by anaconda.
 
#version=DEVEL
install
url --url=http://httpsrv/centos/6
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw  --iscrypted $6$CxpwSUg0oCIQZX52$0yfD8CXU4Q.60uYDqSHWz5.1enxwnhrv9esPRYSix4U1cWoaN.hOpgSLqCd22yjRdEhAwwUdxAIbn.mxMn.kx/
firewall --disable
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
zerombr
clearpart --all
reboot
text
part /boot --fstype=ext4 --size=1000
part / --fstype=ext4 --size=100000
part /app --fstype=ext4 --size=50000
part swap --size=2048
 
%packages
@base
@core
@basic-desktop
@desktop-platform
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@internet-applications
@internet-browser
@network-file-system-client
@office-suite
@print-client
@remote-desktop-clients
@server-policy
@workstation-policy
@x11
mtools
pax
%end
rhel5的.cfg文件如下:
# Kickstart file automatically generated by anaconda.
 
install
url --url=http://192.168.23.7/rhel5
key --skip
lang zh_CN.UTF-8
keyboard us
xconfig --startxonboot
network --device eth0 --bootproto dhcp --hostname rhel5.4.centos.com
rootpw --iscrypted $1$YntMaKAR$vXCZ6J8hGwcRtfso7lk9o.
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux
zerombr
clearpart --all
reboot
 
text
part /boot --fstype ext3 --size=100
part / --fstype ext3 --size=51200
part /app --fstype ext3 --size=10240
part swap --size=1024
 
%packages
@admin-tools
@base
@core
@dialup
@editors
@graphical-internet
@graphics
@legacy-software-support
@office
@printing
@text-internet
@base-x
kexec-tools
fipscheck
sgpio
emacs
libsane-hpaio
xorg-x11-utils
xorg-x11-server-Xnest
5.準備相關文件,必備文件如下:
pxelinux.0(pex引導文件),menu.c32(圖形菜單),vmlinuz內核文件,initrd.img初始根文件系統
配置文件:isolinux.cfg改名為pxelinux.cfg/default
    cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/tftpboot/
    mkdir /var/lib/tftpboot/centos{6,7}
    mkdir /var/lib/tftpboot/rhel5
    cp /var/www/html/rhel5/isolinux/{initrd.img,vmlinuz}  /var/lib/tftpboot/rhel5
    cp /var/www/html/centos6/isolinux/{initrd.img,vmlinuz}  /var/lib/tftpboot/centos6
    cp /var/www/html/centos7/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
此環節準備的文件均在/var/lib/tftpboot下,以便通過tftp獲取文件。

[root@centos7 tftpboot]# tree /var/lib/tftpboot
.
|-- centos6
|  |-- initrd.img
|  `-- vmlinuz
|-- centos7
|  |-- initrd.img
|  `-- vmlinuz
|-- menu.c32
|-- pxelinux.0
|-- pxelinux.cfg
|  `-- default
`-- rhel5
    |-- initrd.img
    `-- vmlinuz
 
4 directories, 9 files
6.編輯自動化安裝頁面菜單
即編輯/var/lib/tftpboot/pxelinux.cfg/default文件。其基本信息如下:
[root@centos7 ~]# 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
服務器維護小知識這樣制作過程便OK了。期間可能出現小的錯誤導致服務不能正常重啟。還要就事論事,一項項排除。主要步驟就是這些了。
安裝測試
服務器維護小知識設置網卡與服務器(即上面配置的主機)為同一網段,即僅能連接到服務器端,不能連接到其他網絡環境。
如果是沒有裝過操作系統的新機開機就會自動裝載系統,不過,需要你手動選擇要安裝的系統哦。默認可是按本地磁盤啟動的。
安裝過操作系統的若想覆蓋安裝,則要在bios里調整??動順序,將網絡引導調至最上面。
IT運維  我們選擇北京艾銻無限
以上文章由北京艾銻無限科技發展有限公司整理
 

相關文章

IT外包服務
二維碼 關閉
主站蜘蛛池模板: 午夜影院7cdy | 欧美极品kennajames喷水 | 蜜桃免费在线视频 | 亚洲精品久久久久久久蜜臀老牛 | 给丰满丁字裤少妇按摩到高潮 | JIZZ成熟丰满韩国女人少妇 | 亚洲精品区午夜亚洲精品区 | 欧美成人免费专区精品高清 | 116少妇做爰毛片 | 亚裔avvideos和黑人 | 亚洲色爱免费观看视频 | 成人片免费网站 | 韩日av一区二区 | 大肉大捧一进一出好爽视频百度 | 22精品一区二区三区 | 国产精品99精品一区二区三区 | 亚洲成在人线视av | 爆乳一丝丝不挂裸体大胸美女 | 精品国产一区二区三区四区色欲 | 暖暖视频免费高清日本 | 美女扒开屁股让男人桶 | 乌克兰少妇videos高潮 | 亚洲性无码av中文字幕 | 国产人伦一级二级三级 | 国产无人区码一码二码三MBA | 一级在线观看视频 | 深夜A级毛片免费无码视频 亚洲精品色播一区二区 | "国产精品1区 2区 3区" | 日本熟妇色xxxxx日本免费看 | 四虎影视在线永久免费观看 | 韩国19禁无遮挡啪啪无码网站 | 男女啪啪全过程免费看永久网 | 老司机午夜精品99久久免费 | 人妻免费久久久久久久了 | 麻豆专媒体一区二区 | 99国精产品一二三区 | 特级毛片www欧美 | 日本视频免费观看 | 97人妻熟女成人免费视频 | www..com1111桃花岛| 亚洲VA中文字幕无码 |