日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > linux >内容正文

linux

Linux自动化安装cobbler

發(fā)布時(shí)間:2023/12/1 linux 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux自动化安装cobbler 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1介紹

1.1 PXE

PXE技術(shù)與RPL技術(shù)不同之處為RPL是靜態(tài)路由,PXE是動(dòng)態(tài)路由。RPL是根據(jù)網(wǎng)卡上的ID號(hào)加上其他記錄組成的一個(gè)Frame(幀)向服務(wù)器發(fā)出請(qǐng)求。而服務(wù)器中已有這個(gè)ID數(shù)據(jù),匹配成功則進(jìn)行遠(yuǎn)程啟動(dòng)。PXE則是根據(jù)服務(wù)器端收到的工件站MAC地址,使用DHCP服務(wù)為這個(gè)MAC地址指定個(gè)IP地址。每次啟動(dòng)可能同一臺(tái)工作站有與上次啟動(dòng)有不同的IP,即動(dòng)態(tài)分配地址。下以客戶端引導(dǎo)過程說明PXE的原理:

客戶端開機(jī)后,PXE BootROM(自啟動(dòng)芯片)獲得控制權(quán)之前執(zhí)行自我測(cè)試,然后以廣播形式發(fā)出一個(gè)請(qǐng)求FIND幀。如果服務(wù)器收到客戶端所送出的要求,就會(huì)送回DHCP回應(yīng),包括用戶端的IP地址、預(yù)設(shè)通信通道,以及開機(jī)映像文件;否則服務(wù)器會(huì)忽略這個(gè)要求。

客戶端收到服務(wù)器發(fā)回的響應(yīng)后則會(huì)回應(yīng)一個(gè)幀,以請(qǐng)求傳送啟動(dòng)所需文件,并把自己的MAC地址寫到服務(wù)器端的Netnames.db文件中。將有更多的消息在客戶端與服務(wù)器之間應(yīng)答,用于決定啟動(dòng)參數(shù)。

BootROM由TFTP通信協(xié)議從服務(wù)器下載開機(jī)映像文檔。

客戶端使用TFTP協(xié)議接收啟動(dòng)文件后,將控制權(quán)轉(zhuǎn)交啟動(dòng)塊以引導(dǎo)操作系統(tǒng),完成遠(yuǎn)程啟動(dòng)。

1.2 KickStart

????KickStart是一種無人職守安裝方式。KickStart的工作原理是通過記錄典型的安裝過程中所需人工干預(yù)填寫的各種參數(shù),并生成一個(gè)名為ks.cfg的文件;在其后的安裝過程中(不只局限于生成KickStart安裝文件的機(jī)器)當(dāng)出現(xiàn)要求填寫參數(shù)的情況時(shí),安裝程序會(huì)首先去查找KickStart生成的文件,當(dāng)找到合適的參數(shù)時(shí),就采用找到的參數(shù),當(dāng)沒有找到合適的參數(shù)時(shí),才需要安裝者手工干預(yù)。這樣,如果KickStart文件涵蓋了安裝過程中出現(xiàn)的所有需要填寫的參數(shù)時(shí),安裝者完全可以只告訴安裝程序從何處取ks.cfg文件,然后去忙自己的事情。等安裝完畢,安裝程序會(huì)根據(jù)ks.cfg中設(shè)置的重啟選項(xiàng)來重啟系統(tǒng),并結(jié)束安裝。

?

1.3 Cobbler

Cobbler是一個(gè)快速網(wǎng)絡(luò)安裝linux的服務(wù),而且在經(jīng)過調(diào)整也可以支持網(wǎng)絡(luò)安裝windows。該工具使用python開發(fā),小巧輕便(才15k行python代碼),使用簡(jiǎn)單的命令即可完成PXE網(wǎng)絡(luò)安裝環(huán)境的配置,同時(shí)還可以管理DHCP、DNS、以及yum倉(cāng)庫(kù)、構(gòu)造系統(tǒng)ISO鏡像。

Cobbler支持命令行管理,web界面管理,還提供了API接口,可以方便二次開發(fā)使用。

Cobbler客戶端Koan支持虛擬機(jī)安裝和操作系統(tǒng)重新安裝,使重裝系統(tǒng)更便捷。

?Cobbler提供以下服務(wù)集成:

* PXE服務(wù)支持

* DHCP服務(wù)管理

* DNS服務(wù)管理

*?電源管理

* Kickstart服務(wù)支持

* yum倉(cāng)庫(kù)管理

2?安裝部署

2.1相關(guān)文件

1.Cobbler配置文件目錄:/etc/cobbler

/etc/cobbler/settings??#cobbler主配置文件

/etc/cobbler/dhcp.template??#DHCP服務(wù)的配置模板

/etc/cobbler/tftpd.template??#tftp服務(wù)的配置模板

/etc/cobbler/rsync.template??#rsync服務(wù)的配置模板

/etc/cobbler/iso?? #iso模板配置文件

/etc/cobbler/pxe?? #pxe模板文件

/etc/cobbler/power? #電源的配置文件

/etc/cobbler/users.conf?? #Web服務(wù)授權(quán)配置文件

/etc/cobbler/users.digest?? #用于web訪問的用戶名密碼配置文件

/etc/cobbler/dnsmasq.template??#DNS服務(wù)的配置模板

/etc/cobbler/modules.conf??#Cobbler模塊配置文件

2.Cobbler數(shù)據(jù)目錄:/var/lib/cobbler

/var/lib/cobbler/config #配置文件

/var/lib/cobbler/triggers?#Cobbler命令

/var/lib/cobbler/kickstarts? #默認(rèn)存放kickstart文件

/var/lib/cobbler/loaders? #存放的各種引導(dǎo)程序

3.系統(tǒng)安裝鏡像目錄:/var/www/cobbler

/var/www/cobbler/ks_mirror #導(dǎo)入的系統(tǒng)鏡像列表

/var/www/cobbler/images? #導(dǎo)入的系統(tǒng)鏡像啟動(dòng)文件

/var/www/cobbler/repo_mirror #yum源存儲(chǔ)目錄

4.日志目錄:/var/log/cobbler

/var/log/cobbler/install.log?#客戶端系統(tǒng)安裝日志

/var/log/cobbler/cobbler.log?#cobbler日志

2.2 Cobbler安裝

2.2.1安裝EPEL源

yum install epel-release

2.2.2安裝cobbler

???yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes cman pykickstart –y

2.2.3配置cobbler

vim /etc/cobbler/settings #Cobbler主配置文件

sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings ?

sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings

# set to 1 to enable Cobbler's DHCP management features.

# the choice of DHCP management engine is in /etc/cobbler/modules.conf

manage_dhcp: 1

# set to 1 to enable Cobbler's RSYNC management features.

manage_rsync: 1

# if using cobbler with manage_dhcp, put the IP address

# of the cobbler server here so that PXE booting guests can find it

# if you do not set this correctly, this will be manifested in TFTP open timeouts.

next_server: 192.168.56.6

# this is the address of the cobbler server -- as it is used

# by systems during the install process, it must be the address

# or hostname of the system as those systems can see the server.

# if you have a server that appears differently to different subnets

# (dual homed, etc), you need to read the --server-override section

# of the manpage for how that works.

server: 192.168.56.6

2.2.4關(guān)閉SELinux、iptables

getsebool

service iptables stop ?

chkconfig iptables off

2.2.5配置tftp、rsync

設(shè)置?'disable'?為?'no' ?

sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp ?

sed -i 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync

2.2.6啟用wsgi模塊

sed -i 's@#LoadModule@LoadModule@g' /etc/httpd/conf.d/wsgi.conf

2.2.7生成密碼

這里生成密鑰和配置默認(rèn)密鑰,ks文件引用

openssl passwd -1 -salt 'random-phrase-here' 'wq'

$1$random-p$29HCOY0msGT.4xVuIl6Gp.?

加入cobbler配置??

vim /etc/cobbler/settings ?

grep default_password_crypted /etc/cobbler/settings#修改為如下配置

default_password_crypted: "$1$random-p$29HCOY0msGT.4xVuIl6Gp."

2.2.8配置DHCP

vim /etc/cobbler/dhcp.template

allow booting;

allow bootp;

ddns-update-style interim;

ignore client-updates;

subnet 192.168.56.0 netmask 255.255.255.0 {

??? range dynamic-bootp??????? 192.168.56.100 192.168.56.254;

??? option domain-name-servers 192.168.0.1;??

??? option routers???????????? 192.168.56.1;

??? option subnet-mask???????? 255.255.255.0;

??? default-lease-time???????? 1800;

??? max-lease-time???????????? 3600;

??? next-server??????????????? 192.168.56.6;

??? filename?????????????????? "pxelinux.0";

}

2.2.9配置服務(wù)

/sbin/service httpd start ?

/sbin/service dhcpd start ?

/sbin/service xinetd start ?

/sbin/service cobblerd start ?

/sbin/chkconfig httpd on

/sbin/chkconfig dhcpd on

/sbin/chkconfig xinetd on

/sbin/chkconfig tftp on

/sbin/chkconfig cobblerd on

2.2.10引導(dǎo)系統(tǒng)文件

cobbler get-loaders

2.2.11配置debmiror(可選)

yum -y install debmirror ?

修改?/etc/debmirror.conf?配置文件,注釋掉?@dists?和?@arches?兩行

sed -i ?'s|@dists=.*|#@dists=|' ?/etc/debmirror.conf ?

sed -i ?'s|@arches=.*|#@arches=|' ?/etc/debmirror.conf

2.2.12檢查配置

cobbler check

The following are potential configuration items that you may want to fix:無需處理

1 : reposync is not installed, need for cobbler reposync, install/upgrade yum-utils?

2 : debmirror package is not installed, it will be required to manage debian deployments and repositories

Restart cobblerd and then run 'cobbler sync' to apply changes.

2.2.13同步配置

cobbler sync

2.3 Cobbler管理

2.3.1命令說明

命令參考

cobbler?--help

cobbler?distro?--help?

cobbler?distro?add?--help

2.3.2配置文件說明

Cobbler配置文件存放在/etc/cobbler下

?

2.3.3鏡像數(shù)據(jù)目錄

導(dǎo)入的系統(tǒng)發(fā)行版,repos鏡像和kickstart文件都放置在/var/www/cobbler

目錄下。確保/var目錄有足夠的空間來存儲(chǔ)這些文件。

?

2.3.4數(shù)據(jù)目錄

此目錄存儲(chǔ)和Cobbler?profiles、systems、distros相關(guān)的配置。

?

2.3.5日志文件

web日志存放點(diǎn):

/var/log/httpd/access_log

/var/log/httpd/error_log

/var/log/httpd/ssl_access_log

/var/log/httpd/ssl_error_log

Cobbler日志:

/var/log/cobbler/cobbler.log

/var/log/cobbler/install.log

通過Cobbler日志可以獲取系統(tǒng)的安裝狀態(tài)

2.3.6導(dǎo)入鏡像

1.?注意下載的ISO文件要核對(duì)文件的md5值,確保數(shù)據(jù)完整性

?? md5sum xx.iso

2.創(chuàng)建目錄

mkdir -p /var/os/Linux/Centos/x86_64/Centos6.7/dvd

3.掛載

mount -o?loop/var/iso/Linux/Centos/x86_64/xx.iso???

/var/os/Linux/Centos/x86_64/Centos6.7/dvd

2.3.7導(dǎo)入數(shù)據(jù)

cobbler import?--path=/xx?--name=centos6.7?--arch=x86_64

cobbler?list??列出配置

cobbler?report?詳細(xì)

cobbler?profile find --distro=centos6.7-x86_64?#查看配置是否存在

cobbler?profile remove --name=centos6.7-x86_64?#刪除配置文件

cobbler?distro?remove?--name=centos6.7-x86_64?#刪除distro

cobbler?profile find?--distro=centos6.7-x86_64?#再查看配置已無

2.3.8自定義ks

ks目錄位置

/var/lib/cobbler/kickstarts/

默認(rèn)的ks位置

/var/lib/cobbler/kickstarts/sample.ks

更改指定系統(tǒng)版本對(duì)應(yīng)的ks配置文件

cp /var/lib/cobbler/kickstarts/ sample.ks centos6.7-x86_64.ks

cobbler?profile?add?--name=centos6.7 --distro= centos6.7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6.7-x86_64.ks

cobbler check

cobbler sync

KS示例:

#platform=x86, AMD64, or Intel EM64T

# Firewall configuration

firewall --disabled

# Install OS instead of upgrade

install

# Use network installation

url --url=$tree

#Root password

rootpw root

# System authorization information

auth? --useshadow--enablemd5

# Use graphical mode install

graphical

# Run the Setup Agent on first boot

firstboot --disable

# System keyboard

keyboard us

# System language

lang en_US

# SELinux configuration

selinux --disabled

# Installation logging level

logging --level=info

# System timezone

timezone? Asia/Shanghai

# Network information

network --bootproto=static --device=eth0 --gateway=192.168.56.1 --ip=192.168.56.99 --nameserver=192.168.56.99 --netmask=255.255.255.0 --hostname=host99 --onboot=on

# System bootloader configuration

bootloader --location=mbr

# Partition clearing information

clearpart --all --initlabel

# Disk partitioning information

part / --fstype="ext4" --ondisk=sda --size=8000

part /boot --fstype="ext4" --ondisk=sda --size=200

part swap --fstype="swap" --size=1000

# Reboot after installation

reboot

# Clear the Master Boot Record

zerombr

%packages

@ X Window System

@ Desktop

@ Development tools

gcc*

%end

?

3?Web管理

Cobbler?web界面是一個(gè)很好的前端,非常容易管理Cobbler。可以添加和刪除system、distro、profile,可以查看、編輯distros、profiles、subprofiles、systems、repos、kickstart文件。

3.1cobbler web管理

3.1.1安裝

yum -y install cobbler-web

3.1.2設(shè)置用戶密碼

為已存在的用戶cobbler重置密碼:

htdigest?/etc/cobbler/users.digest?"Cobbler"?cobbler

添加新用戶:

htdigest?/etc/cobbler/users.digest?"Cobbler"?newname

3.1.3配置登錄

sed -i 's/authn_denyall/authn_configfile/g'?

/etc/cobbler/modules.conf

/etc/init.d/cobblerd?restart?

/etc/init.d/httpd?restart

3.1.4訪問web

瀏覽器訪問登錄頁(yè)面https://192.168.xx.xx/cobbler_web

3.1.5登錄web

3.1.6管理web

cobbler?system?add?--name=xx?--hostname=xx?--mac=xx?

--interface=ethx?--ip-address=xx?--subnet=xx?--gateway=xx?

--static=1?--profile=xx

yum install cman ipmitool -y???電源管理(需要硬件支持)

?

轉(zhuǎn)載于:https://www.cnblogs.com/dongdongwq/p/5377593.html

總結(jié)

以上是生活随笔為你收集整理的Linux自动化安装cobbler的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。