【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>
Cobbler的自动化安装操作系统
服务器端操作
安装 epel 源
[epel]
name=sohu centos epel 7
baseurl=http://mirrors.sohu.com/fedora-epel/7/x86_64/
gpgcheck=1
gpgkey=http://mirrors.sohu.com/fedora-epel/RPM-GPG-KEY-EPEL-7
安装 cobbler,dhcp,启动服务
yum install cobbler dhcp
systemctl start cobblerd tftp httpd
查看说明书
cobbler check
设置 cobbler
vim /etc/cobbler/settings
server: 192.168.209.19
next_server: 192.168.209.19
default_password_crypted: "$1$pvpwDnVy$5Dw1DWnZA/TcNfPwboHEE/" //用下面命令生成的密码
manage_dhcp: 1
openssl passwd -1
Password:
Verifying - Password:
$1$pvpwDnVy$5Dw1DWnZA/TcNfPwboHEE/
重新启动cobbler,下载 bootloader 等文件
systemctl restart cobblerd
cobbler get-loaders
配置 dhcp,同步到 dhcp的配置文件中,启动 dhcpd 服务,再次进行同步
vim /etc/cobbler/dhcp.template
subnet 192.168.209.0 netmask 255.255.255.0 {
option routers 192.168.209.2;
option domain-name-servers 192.168.209.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.209.100 192.168.209.254;
cobbler sync
systemctl restart dhcpd
cobbler sync
添加 yum源
mount /dev/sr0 /mnt/cdrom
cobbler import --path=/mnt/cdrom --name=CentOS7.6-x86_64 --arch=x86_64
此时,就可以自动化安装操作系统了,但提供的是默认的,功能较少,不符合生产需求。
添加自己定制的应答文件,提供更多的功能
cobbler profile add --name CentOS6.10-x86_64_mini --distro=CentOS6.10-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks6_mini.cfg
cobbler 相关命令
客户端测试
多台裸机从网卡启动
cobbler的web管理实现
[root@CentOS7 ~]# yum install cobbler-web
扩展了 httpd 的配置文件 /etc/httpd/conf.d/cobbler_web.conf
[root@CentOS7 ~]# systemctl restart httpd
浏览器:https://192.168.209.19/cobbler_web
Username cobbler
Password cobbler
/etc/cobbler/modules.conf //验证方式配置文件
基于文件验证用户名密码
vim /etc/cobbler/users.digest
cobbler:Cobbler:a2d6bae81669d707b72c0bd9806e01f3 //用户名,领域(realm),密码
[root@CentOS7 ~]# htdigest /etc/cobbler/users.digest Cobbler xuepeng //创建 cobbler 用户 xuepeng
htdigest -c /etc/cobbler/users.digest Cobbler xuepeng1 //创建 cobbler 用户 xuepeng1,会覆盖掉 users.digest所有记录
基于pam验证用户密码
vim /etc/cobbler/modules.conf //修改验证方式
[authentication]
# module = authn_configfile
module = authn_pam
vim /etc/cobbler/users.conf
[admins]
admin = "xue" //要对应一个系统帐户,这个用户为 cobbler 的管理员
cobbler = ""
[root@CentOS7 ~]# useradd -s /sbin/nologin xue
[root@CentOS7 ~]# echo 123 |passwd --stdin xue
[root@CentOS7 ~]# systemctl restart cobblerd
vim /etc/cobbler/users.conf
[admins]
admin = "xue"
cobbler = "common"
[root@CentOS7 ~]# useradd -s /sbin/nologin common
[root@CentOS7 ~]# echo 123 |passwd --stdin common
[root@CentOS7 ~]# systemctl restart cobblerd
来源:oschina
链接:https://my.oschina.net/u/4270793/blog/3154082