cobbler叢集網路裝機

來源:互聯網
上載者:User

標籤:can   debian   auto   toggle   path   menu   prot   清空   git   

Centos7.X版本安裝cobbler
vim /etc/selinux/config #關閉selinux
setenforce 0 #半關閉
chkconfig iptables off #開機不自啟
iptables -F #清空防火牆
[[email protected] ~]# systemctl stop firewalld #關閉防火牆
[[email protected] ~]# systemctl disable firewalld #開機不自啟
[[email protected] ~]# cat /etc/redhat-release #查看linux版本
CentOS Linux release 7.4.1708 (Core)
[[email protected] ~]# uname -r #查看核心版本
3.10.0-693.el7.x86_64
[[email protected] ~]# yum clean all #清理緩衝
[[email protected] yum.repos.d]# yum makecache #建立緩衝
[[email protected] ~]# yum -y install epel-release #
[[email protected] yum.repos.d]# yum -y install cobbler cobbler-web pykickstart debmirror
#pykickstart #自動設定kickstart指令碼端
#debmirror #能夠被PXE引導的引導檔案的軟體包
[[email protected] ~]# yum -y install httpd
[[email protected] ~]# systemctl restart httpd
[[email protected] ~]# systemctl restart cobblerd
[[email protected] ~]# netstat -an |grep 25151
tcp 0 0 127.0.0.1:25151 0.0.0.0:* LISTEN

[[email protected] ~]# systemctl status httpd #查看apache狀態
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since 三 2018-09-12 16:11:25 CST; 3h 7min ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 1448 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─1448 /usr/sbin/httpd -DFOREGROUND
├─1449 /usr/sbin/httpd -DFOREGROUND
├─1450 /usr/sbin/httpd -DFOREGROUND
├─1451 /usr/sbin/httpd -DFOREGROUND
├─1452 /usr/sbin/httpd -DFOREGROUND
└─1453 /usr/sbin/httpd -DFOREGROUND

9月 12 16:10:24 bogon systemd[1]: Starting The Apache HTTP Server...
9月 12 16:10:55 bogon httpd[1448]: AH00558: httpd: Could not reliably determine the se...age
9月 12 16:11:25 bogon systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.

[[email protected] ~]# systemctl status cobblerd #查看cobbler狀態
● cobblerd.service - Cobbler Helper Daemon
Loaded: loaded (/usr/lib/systemd/system/cobblerd.service; disabled; vendor preset: disabled)
Active: active (running) since 三 2018-09-12 16:18:02 CST; 3h 3min ago
Process: 1498 ExecStartPost=/usr/bin/touch /usr/share/cobbler/web/cobbler.wsgi (code=exited, status=0/SUCCESS)
Main PID: 1497 (cobblerd)
CGroup: /system.slice/cobblerd.service
└─1497 /usr/bin/python2 -s /usr/bin/cobblerd -F

9月 12 16:18:02 bogon systemd[1]: Starting Cobbler Helper Daemon...
9月 12 16:18:02 bogon systemd[1]: Started Cobbler Helper Daemon.

[[email protected] ~]# vim /etc/cobbler/settings

272 next_server: 192.168.10.10
384 server: 192.168.10.10

[[email protected] ~]# vim /etc/xinetd.d/tftp

default: offdescription: 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 /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
~
[[email protected] ~]# cobbler get-loaders #更新補丁
task started: 2018-09-12_195923_get_loaders
task started (id=Download Bootloader Content, time=Wed Sep 12 19:59:23 2018)
downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
TASK COMPLETE

[[email protected] ~]# systemctl enable rsyncd #開啟rsync
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.

[[email protected] ~]# vim /etc/debmirror.conf

Download options

$host="ftp.debian.org";$passwd="[email protected]";
br/>$user="anonymous";
$passwd="[email protected]";
$download_method="ftp";
#@dists="sid"; #注釋掉br/>@sections="main,main/debian-installer,contrib,non-free";

[[email protected] ~]# openssl passwd -1 -salt $(openssl rand -hex 4)
Password:
$1$19017682$.wZFJpkl.qP88idfa34IK/
[[email protected] ~]# vim /etc/cobbler/settings
default_password_crypted: "$1$19017682$.wZFJpkl.qP88idfa34IK/"

安裝柵裝置隔離 #centos6是有cman的,centos7是沒有cman的,如果報錯,是正常的。
[[email protected] ~]# yum -y install cman fence-agents
用cobbler管理DHCP,修改242行manage_dhcp: 0
vim /etc/cobbler/settings
manage_dhcp: 1

#防止迴圈裝系統,適用於伺服器第一啟動項是PXE啟動,修改292行pxe_just_once: 0 #修改為1
285 # if this setting is set to 1, cobbler systems that pxe boot 如果這個設定被設定為1,pxe啟動的cobbler系統
286 # will request at the end of their installation to toggle the 在安裝結束時,將請求關閉
287 # --netboot-enabled record in the cobbler system record. This eliminates 在cobbler系統記錄中啟用了netboot-enabled記錄。這就消除了
288 # the potential for a PXE boot loop if the system is set to PXE 如果系統被設定為PXE,那麼PXE啟動迴圈的潛力
289 # first in it‘s BIOS order. Enable this if PXE is first in your BIOS 首先是BIOS的順序。如果PXE在您的BIOS中首先出現,則啟用此功能
290 # boot order, otherwise leave this disabled. See the manpage 啟動訂單,否則將禁用此功能。看到從
291 # for --netboot-enabled. 支援netboot-啟用。

292 pxe_just_once: 1

#修改完後重啟服務再進行一次檢測
[[email protected] system]# systemctl restart cobblerd
[[email protected] system]# yum -y install dhcp
[[email protected] system]# cp -a /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
cp:是否覆蓋"/etc/dhcp/dhcpd.conf"? y

[[email protected] system]# vim /etc/dhcp/dhcpd.conf
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.100 192.168.10.200;
option routers 192.168.10.2;
default-lease-time 600;
max-lease-time 7200;
}
next-server 192.168.10.10;
filename="pxelinux.0";

[[email protected] system]# systemctl restart dhcpd
[[email protected] system]# systemctl enable dhcpd
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.

[[email protected] system]# yum -y install xinetd #在centos7裡沒有xinetd
[[email protected] system]# systemctl enable xinetd
[[email protected] system]# systemctl restart xinetd
[[email protected] system]# systemctl restart tftp
[[email protected] system]# systemctl enable tftp
Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
[[email protected] system]# cobbler sync
[[email protected] system]# cobbler check #檢測設定檔
No configuration problems found. All systems go.

#掛載鏡像

[[email protected] system]# mkdir -p /mnt/cdrom
[[email protected] system]# vim /etc/fstab
/dev/sr0 /mnt/cdrom iso9660 defaults 0 0
[[email protected] system]# mount -a

#匯入鏡像
[[email protected] system]# cobbler import --name="centos7-x86_64" --path=/mnt/cdrom/
task started: 2018-09-16_113922_import
task started (id=Media import, time=Sun Sep 16 11:39:22 2018)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/ks_mirror/centos7-x86_64:
creating new distro: centos7-x86_64
trying symlink: /var/www/cobbler/ks_mirror/centos7-x86_64 -> /var/www/cobbler/links/centos7-x86_64
creating new profile: centos7-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/centos7-x86_64 for centos7-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos7-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos7-x86_64
looking for /var/www/cobbler/ks_mirror/centos7-x86_64/repodata/comps.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos7-x86_64/repodata
TASK COMPLETE
[[email protected] mnt]# cobbler distro list #查看鏡像列表
centos7-x86_64

/var/www/cobbler/ks_mirror/ 鏡像存放目錄

[[email protected] ks_mirror]# cobbler profile list #查看產生的劇本
centos7-x86_64
[[email protected] ks_mirror]# cobbler profile remove --name=centos7-x86_64 #刪除劇本檔案

[[email protected] kickstarts]# cobbler list
distros:
centos7-x86_64

profiles:

systems:

repos:

images:

mgmtclasses:

packages:

files:
[[email protected] kickstarts]# cobbler distro report --name=centos7-x86_64 #查看安裝鏡像檔案資訊
Name : centos7-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment :
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/initrd.img
Kernel : /var/www/cobbler/ks_mirror/centos7-x86_64/images/pxeboot/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {‘tree‘: ‘http://@@[email protected]@/cblr/links/centos7-x86_64‘}
Management Classes : []
OS Version : rhel7
Owners : [‘admin‘]
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}

[[email protected] kickstarts]# ls
default.ks install_profiles sample_autoyast.xml sample_esxi4.ks sample.ks
esxi4-ks.cfg legacy.ks sample_end.ks(預設使用的kickstarts檔案) sample_esxi5.ks sample_old.seed
esxi5-ks.cfg pxerescue.ks sample_esx4.ks sample_esxi6.ks sample.seed

#找一個centos7-x86_64.cfg檔案 拷貝到/var/lib/cobbler/kickstarts目錄下
[[email protected] kickstarts]# cobbler profile add --name=centos7-basic --distro=centos7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7-x86_64.cfg # #指定ks檔案名稱,匯入鏡像檔案名稱,匯入劇本檔案,把ks檔案和鏡像檔案聯立起來

如果想做多個系統,首先上傳鏡像檔案,產生ks劇本檔案,然後把劇本檔案和鏡像檔案聯立起來

cobbler profile edit --name=centos7-basic --kopts=‘net.ifnames=0 biosdevname=0‘ #修改網卡名稱,使用eth0名稱
#指定
cobbler system add --name=a1 --mac=00:0c:29:6f:b7:4c --profile=centos7-basic --ip-address=192.168.10.20 --subnet=255.255.255.0 --interface=eth0 --static=1 --gateway=192.168.10.2 --hostname=www.wk.com --name-servers="114.114.114.114"
cobbler system list #查看指定主機

自訂安裝系統: #cobble預設使用的是https串連
每次安裝系統都要選擇,比較麻煩,那麼我們指定MAC地址進行安裝,就可以達到自動安裝無需再選擇作業系統,即使有多個作業系統,只要指定作業系統和MAC地址就可以自動安裝
#cobbler WEB端配置:賬戶密碼都是cobbler

選擇--系統--建立新系統

#定義系統資訊

#配置全域網路資訊,網關,DNS

#配置網卡資訊 eth0 eth1
注意選擇 static

cobbler叢集網路裝機

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.