1、配置系统
- 升级操作系统
yum -y update
- 升级完的操作系统
cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
- 关闭selinux(修改完重启)
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
reboot
2、安装cobbler
- 安装epel源
yum -y install epel-release
- 安装cobbler
yum install -y cobbler cobbler-web tftp dhcp cman pykickstart debmirror syslinux net-tools
- 安装cobbler依赖包
yum install -y ed patch perl perl-Compress-Zlib perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perl fence-agents
- 设置服务开机启动
systemctl enable httpd.service
systemctl enable dhcpd.service
systemctl enable xinetd.service
systemctl enable cobblerd.service
查看
systemctl list-unit-files
3、配置服务
- 配置web
sed -i 's/#ServerName www.example.com:80/ServerName 127.0.0.1:80/' /etc/httpd/conf/httpd.conf
systemctl restart httpd.service
- 配置cobbler
sed -i 's/server: 127.0.0.1/server: 192.168.200.1/g' /etc/cobbler/settings
- 修改cobbler用户的默认密码,
使用生成后的密码替换/etc/cobbler/settings中的密码
openssl passwd -1 -salt 'hscloud' 'ilikeit'
$1$cloud$jzs4341pIR4fU.9bYMMR2/
vi /etc/cobbler/settings(修改以下内容)
default_password_crypted: "$1$cloud$jzs4341pIR4fU.9bYMMR2/"
- 配置cobber_web
useradd admin
passwd admin
sed -i 's/admin = ""/admin = "admin"/' /etc/cobbler/users.conf
sed -i 's/module = authn_configfile/module = authn_pam/' /etc/cobbler/modules.conf
- 配置xinetd
sed -i '14s/yes/no/' /etc/xinetd.d/tftp
service xinetd restart
systemctl restart rsyncd.service
systemctl enable rsyncd.service
- 配置dhcp,pxe
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
vi /etc/cobbler/dhcp.template
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.101;
option domain-name-servers 202.106.0.20;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.10.101 192.168.10.250;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
subnet 192.168.11.0 netmask 255.255.255.0 {
option routers 192.168.11.1;
option subnet-mask 255.255.255.0;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
启动服务
systemctl restart cobblerd.service
systemctl restart xinetd.service
cobbler sync
防火墙设置
firewall-cmd --permanent --add-port=67/udp
firewall-cmd --permanent --add-port=68/udp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --reload
firewall-cmd --permanent --list-ports
登录cobbler_web界面
https://10.0.0.200/cobbler_web
用户名:admin
密码: 系统admin的密码