cobbler的搭建
install epel源
用的阿里云的epel源
https://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum install cobbler dhcp http -y
vim /etc/xinetd.d/tftp
service tftp
{
disable = no #默认是yes
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -B 1380 -v -s /var/lib/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}
vim /etc/xinetd.d/rsync
service rsync
{
disable = no #默认是yes
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1:80
配置COBBLER
[root@localhost ~]# openssl passwd -1 -salt 'random-phrase-here' '123456' #生成root的密码
$1$random-p$mzxQ/Sx848sXgvfwJCoZM0
[root@localhost ~]# vim /etc/cobbler/settings
manage_dhcp: 1 ## 原为 0
manage_rsync: 1 ## 原为 0
next_server: 192.168.214.10 ## 本机 IP
server: 192.168.214.10 ## 本机 IP
default_password_crypted: "$1$random-p$mzxQ/Sx848sXgvfwJCoZM0" ## 生成的 root 密码
[root@localhost ~]# vim /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.65.0 netmask 255.255.255.0 {
option routers 192.168.65.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.65.100 192.168.65.254;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
[root@localhost ~]# service httpd start
[root@localhost ~]# service xinetd start
[root@localhost ~]# service dhcpd start 提示失败,可以不用管
[root@localhost ~]# service cobblerd start
[root@localhost ~]# cobbler check #检查配置
Traceback (most recent call last):
File "/usr/bin/cobbler", line 36, in <module>
sys.exit(app.main())
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 655, in main
rc = cli.run(sys.argv)
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 270, in run
self.token = self.remote.login("", self.shared_secret)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
return u.close()
File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: "<class 'cobbler.cexceptions.CX'>:'login failed'">
[root@localhost ~]# cobbler get-loaders #解决方法
[root@localhost ~]# cobbler check ## 再次检查
The following are potential configuration items that you may want to fix:
1 : service dhcpd is not running
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.
## 1 :提示 dhcpd 没有运行,先不管
## 2 :提示 debmirror 没有安装。如果不是安装 debian 之类的系统,可以忽略此提示。
(如需安装,下载地址为:http://rpmfind.net/linux/rpm2html/search.php?query=debmirror)
[root@localhost ~]# cobbler sync #同步操作
[root@localhost ~]# mount /dev/cdrom /mnt #挂载镜像,导入安装源
[root@localhost ~]# cobbler import --path=/mnt/ --arch=x86_64 --name=Centos-6.8-minimal
[root@localhost ~]# cobbler list #查看profile文件