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外包服務
二維碼 關閉
主站蜘蛛池模板: 欧美日韩在线网站 | jizzjizz日本护士 | 亚洲伊人久久综合成人网站 | 麻豆免费视频网站 | 麻花豆传的最新一期内容是 | 宅男天堂 | 久久久久人妻一区精品色欧美 | 色吊丝AV中文字幕 | 无码人妻一区二区三区免费N鬼沢 | 日韩一本之道一区中文字幕 | 亚洲精品乱码日本按摩久久久久 | 亚洲中文无码AV在线 | 1314成人网| japanesetube日本护士高潮 | 久久人妻无码毛片A片麻豆 最近韩国动漫hd免费观看 | 国内自拍小视频 | 欧美AAAAAA级午夜福利视频 | 国产成人精品午夜二三区波多野 | 97精品久久天干天天 | 国产精品一区二区熟女不卡 | 色狠狠色噜噜AV天堂一区 | 亚洲熟妇无码一区二区三区导航 | 中文无码制服丝袜人妻AV | 在线一级 | 蜜桃AV无码免费看永久 | 在线播放国产精品三级 | 麻豆免费视频网站 | 农夫色综合网 | 久久久久久久久888 亚洲国产AV玩弄放荡人妇系列 | 亚洲免费成人 | 色综合色欲色综合色综合色乛 | 欧美大胆A级视频 | 粉嫩aⅴ一区二区三区 | 亚洲av无码国产精品色软件 | 456亚洲精品 | 无码裸模视频在线观看 | 久久亚洲AV成人无码软件 | 一二三四在线观看免费视频 | 狠狠热在线视频免费 | 无码av专区丝袜专区 | 天堂中文在线最新版WWW |