2017-3-10 Cobbler实现无人值守安装

   

   之前实习期间用过kickstart安装操作系统,一直不成功,现在回到学校了,无意看到cobbler安装,有些冲动。别看没多少内容,可用了两天时间,终于完成了!

   以后肯定要的着,先记录下。


官方文档:http://cobbler.github.io/
web界面文档:http://cobbler.github.io/manuals/2.6.0/5_-_Web_Interface.html
国内文档:http://www.tuicool.com/articles/NFfi6fv
用户使用手册:http://cobbler.github.io/manuals/2.8.0/

1、基本环境搭建
[root@cobbler ~]# ifconfig eth0 192.168.1.22
[root@cobbler ~]# yum install epel-release -y
[root@cobbler ~]# yum install cobbler cobbler-web -y
[root@cobbler ~]# openssl passwd -1 -salt cobbler
Password:
$1$cobbler$M6SE55xZodWc9.vAKLJs6. ## 安装完系统root密码
[root@cobbler ~]# vim /etc/cobbler/settings
pxe_just_once: 1
next_server: 192.168.1.22
server: 192.168.1.22
manage_dhcp: 1
manage_rsync: 1
default_password_crypted: "$1$cobbler$M6SE55xZodWc9.vAKLJs6."

[root@cobbler ~]# vim /etc/cobbler/dhcp.template ##DHCP服务默认配置好了的
option routers 192.168.1.1

[root@cobbler ks_mirror]# pwd
/var/www/cobbler/ks_mirror
[root@cobbler ks_mirror]# mount -t iso9660 /dev/cdrom /mnt ##去VMware里添加镜像即可。
mount: /dev/sr0 is write-protected, mounting read-only


2、cobber的web界面设置
[root@cobbler ks_mirror]# yum install dhcp -y
[root@cobbler ~]# vim /etc/cobbler/modules.conf
module = authn_configfile
[authorization]
module = authz_allowall
[root@cobbler ~]# htdigest /etc/cobbler/users.digest "Cobbler" cobbler
Changing password for user cobbler in realm Cobbler
New password:
Re-type new password:

3、http服务、tftp服务
[root@cobbler ks_mirror]# vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1
[root@cobbler ks_mirror]# systemctl start httpd.service
[root@cobbler ~]# yum install xinetd -y
[root@cobbler ks_mirror]# vim /etc/xinetd.d/tftp
disable = no
[root@cobbler ~]# yum install xinetd
[root@cobbler ks_mirror]# systemctl start rsyncd.service
[root@cobbler ~]# systemctl start cobblerd.service

4、cobbler检查,这几步必须做的
[root@cobbler ~]# yum install debmirror fence-agents pykickstart ##依赖包安装
[root@cobbler ~]# cobbler check ##非常重要的命令
[root@cobbler ~]# cobber sync
[root@cobbler ks_mirror]# cobbler import --name=fedora17 --arch=x86_64 --path=/mnt ##等15分钟左右

# cobbler distro list
修改profile指定新的KS启动文件在第一次导入系统镜像时,cobbler会给安装镜像指定一个默认的kickstart自动安装文件,
文件位于/var/lib/cobbler/kickstarts/sample.ks

# cobbler profile list ##查看profile列表
# cobbler distro report --name=fedora17-x86_64
$ cobbler system add --name=test --profile=fedora17-x86_64
$ cobbler system list

5、登录到web界面,没啥用处,可以不看
https://192.168.1.22//cobbler_web 用户名和密码都是cobbler
# yum install system-config-kickstart
# yum groupinstall "X Window System" ##安装X Window图形界面
# system-config-kickstart ##运行工具进行配置

报错:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(1)访问web界面居然没有内容?
[root@cobbler conf.d]# curl -I http://192.168.1.22/cobbler_web
HTTP/1.1 403 Forbidden
Date: Thu, 09 Mar 2017 15:43:37 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Type: text/html; charset=iso-8859-1
/usr/share/cobbler/web/cobbler.wsgi failed, reason: SSL connection required
解决:https://192.168.1.22//cobbler_web ##https呀!

(2)始终报出rsyncd的问题,结果是没开启自启而已,郁闷
[root@cobbler tftpboot]# cobbler check
The following are potential configuration items that you may want to fix:
1 : enable and start rsyncd.service with systemctl
解决:[root@cobbler tftpboot]# systemctl enable rsyncd

(3)客户端引导的时候请求DHCP服务的时候找不到引导文件pxelinux.0?
解决:哎呀,忘了把客户端的NAT模式改为桥接了!

(4)客户机引导一大半了,告诉我/dev/root不存在?
解决:这个是内存给的太小了!这个问题真不好排查,是我换了另一个虚拟机安装的

(5)客户机引导时出现选择页面,local 还是fedora17-x86_64?干扰自动部署
解决:# vim /var/lib/tftpboot/pxelinux.cfg/default
去掉Label标签即可,另外把TIMEOUT改为0


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

官网:http://www.xiguagongzi.cn/
原文地址:https://www.cnblogs.com/yue-hong/p/6532957.html