- Cobbler是一個Linux服務(wù)器安裝的服務(wù),可以通過網(wǎng)絡(luò)啟動(PXE)的方式來快速安裝、重裝物理服務(wù)器和虛擬機(jī),同時還可以管理DHCP,DNS等。
- Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),還提供了API接口,可以方便二次開發(fā)使用。
- Cobbler是較早前的kickstart的升級版,優(yōu)點(diǎn)是比較容易配置,還自帶web界面比較易于管理。
- Cobbler內(nèi)置了一個輕量級配置管理系統(tǒng),但它也支持和其它配置管理系統(tǒng)集成,如Puppet,暫時不支持SaltStack。
[root@localhost ~]# yum install epel-release -y ##安裝epel源
[root@localhost ~]# yum install -y \
> cobbler \ ##安裝cobbler\
> cobbler-web \ ##網(wǎng)頁形式管理
> dhcp \ ##地址分配服務(wù)
> tftp-server \ ##放壓縮和引導(dǎo)文件
> pykickstart \ ##Python開發(fā)的kickstart
> httpd \ ##網(wǎng)絡(luò)服務(wù)
> rsync \ ##遠(yuǎn)程同步管理
> xinetd ##管理平臺
[root@localhost ~]# cd /etc/cobbler/
[root@localhost cobbler]# vim settings ##修改配置文件
next_server: 192.168.13.140 ##修改服務(wù)地址為本地
server: 192.168.13.140
manage_dhcp: 1 ##dhcp開啟
[root@localhost cobbler]# systemctl start httpd.service ##開啟http服務(wù)
[root@localhost cobbler]# systemctl start cobblerd.service ##開啟cobbler服務(wù)
[root@localhost cobbler]# systemctl stop firewalld.service ##關(guān)閉防火墻
[root@localhost cobbler]# setenforce 0 ##關(guān)閉增強(qiáng)功能
[root@localhost cobbler]# cobbler check ##cobbler檢測需要優(yōu)化項
##下面會列出需要優(yōu)化的東西,根據(jù)優(yōu)化項進(jìn)項優(yōu)化即可
[root@localhost cobbler]# vim /etc/xinetd.d/tftp ##進(jìn)行tftp優(yōu)化
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
}
[root@localhost cobbler]# systemctl enable rsyncd.service ##優(yōu)化開啟遠(yuǎn)程同步管理服務(wù)
[root@localhost cobbler]# openssl passwd -1 -salt 'abc123' 'abc123' ##優(yōu)化設(shè)置管理員密碼
$1$abc123$9v8z2./E/PZihXrVcy3II0 ##復(fù)制此段是鹽值加密過后的密文
[root@localhost cobbler]# vim /etc/cobbler/settings ##修改配置文件
##查找default然后將加密的密文復(fù)制到此處
default_password_crypted: "$1$abc123$9v8z2./E/PZihXrVcy3II0"
[root@localhost cobbler]# systemctl start rsyncd.service ##啟動服務(wù)
[root@localhost cobbler]# systemctl restart xinetd.service
[root@localhost cobbler]# vim /etc/cobbler/dhcp.template ##修改配置文件
subnet 192.168.13.0 netmask 255.255.255.0 { ##修改網(wǎng)段
option routers 192.168.13.1; ##網(wǎng)關(guān)
option domain-name-servers 192.168.13.2; ##dns地址
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.13.100 192.168.13.200; ##地址池
[root@localhost cobbler]# cobbler sync ##同步生成DHCP配置文件(/etc/dhcp/dhcpd.conf)
[root@localhost cobbler]# systemctl restart dhcpd.service ##啟動dhcp服務(wù)
[root@localhost cobbler]# systemctl start cobblerd.service ##啟動cobbler服務(wù)
[root@localhost cobbler]# systemctl start xinetd.service ##啟動管理平臺服務(wù)
[root@localhost cobbler]# mount /dev/cdrom /mnt ##將鏡像掛載到/mnt目錄下
mount: /dev/sr0 寫保護(hù),將以只讀方式掛載
[root@localhost cobbler]# cd /mnt/
[root@localhost mnt]# ls ##查看鏡像文件
CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
EULA isolinux repodata TRANS.TBL
[root@localhost mnt]# cobbler import --path=/mnt/ --name=Centos-7-x86_64 --arch=x86_64
##導(dǎo)入鏡像文件指明路徑,生成名字
[root@localhost mnt]# cd /var/www/cobbler/ks_mirror/ ##切換到cobbler目錄下
[root@localhost ks_mirror]# ls
Centos-7-x86_64 config
[root@localhost ks_mirror]# cobbler list ##查看文件信息
distros:
Centos-7-x86_64
profiles:
Centos-7-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
[root@localhost ks_mirror]# yum install tree -y ##安裝tree工具
[root@localhost ks_mirror]# tree /var/lib/tftpboot/images ##查看壓縮內(nèi)核和引導(dǎo)文件
/var/lib/tftpboot/images
└── Centos-7-x86_64
├── initrd.img ##引導(dǎo)文件
└── vmlinuz ##壓縮內(nèi)核
[root@localhost ks_mirror]# systemctl restart cobblerd.service
[root@localhost ks_mirror]# systemctl restart dhcpd.service
[root@localhost ks_mirror]# systemctl restart xinetd.service
[root@localhost ks_mirror]# systemctl restart httpd.service
代碼:[root@localhost ~]#yum groupinstall "GNOME Desktop"
代碼:[root@localhost ~]# yum groupinstall 'KDE Plasma Workspaces" -y
代碼:[root@localhost ~]# yum groupinstall "X Window System" 或者"Graphical Administration Tools"
[root@localhost ks_mirror]# vim /etc/cobbler/modules.conf ##配置模塊配置文件
module = authn_configfile ##默認(rèn)開啟
[root@localhost ks_mirror]# htdigest -c /etc/cobbler/users.digest Cobbler adadmin ##創(chuàng)建用戶密碼
Adding password for adadmin in realm Cobbler.
New password: ##輸入密碼
Re-type new password:
[root@localhost ks_mirror]# systemctl restart cobblerd.service ##重啟cobbler服務(wù)
[root@localhost ks_mirror]# systemctl restart httpd.service ##重啟httpd服務(wù)
高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。