Cobbler 是一个快速网络安装linux 的服务,而且在经过调整也可以支持网络安装windows。
Cobbler支持命令行管理,web 界面管理,还提供了API 接口,可以方便二次开发使用。
和Kickstart 不同的是,使用cobbler 不会因为在局域网中启动了dhcp 而导致有些机器因为默认从pxe启动在重启服务器后加载tftp 内容导致启动终止。
官网:https://fedorahosted.org/cobbler/wiki/UserDocs
官网:https://fedorahosted.org/cobbler/wiki/DownloadInstructions
Cobbler的安装环境准备
1、安装epel源
EPEL源选择地址: https://fedorahosted.org/cobbler/wiki/DownloadInstructions查看cobbler源2、安装DHCP服务3、其它服务的安装
额外需要的服务还有tftp,rsync,xinetd,httpd。DHCP配置,简单配置启用即可,后面可以设置cobbler模板配置DHCPdhcp配置详解: http://www.lishiming.net/thread-5317-1-1.html
启动DHCP
/etc/init.d/dhcpd start
cobbler安装
1、安装cobbler2、cobbler check查看有无报错根据报错修改相应内容
提示debmirror未安装时,如果不是debian系统,可忽略
3、使用cobbler
修改cobbler配置,修改server、next-server为本机IPly, this will be manifested in TFTP open timeouts.
next_server: 127.0.0.1[/code]
4、自动下载loader 程序5、修改 /etc/xinetd.d/tftp 、/etc/xinetd.d/rsync6、修改cobbler 用户的默认密码,可以使用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings 中的密码。生成密码命令:其中“random-phrase-here”为干扰码,可为任意字符
less /etc/cobbler/settings |grep default_password_crypted
如果openssl不好使,可以手动修改执行opssl后会提示一串字符串,替换default_password_crypted后内容
7、全部完成后,重启cobbler8、修改cobbler,让其自动管理dhcp接下来修改/etc/cobbler/dhcp.template,此文件
是cobbler 管理dhcp 的模板
vi /etc/cobbler/dhcp.template ,主要修改内容如下:9、导入系统镜像文件
修改cobbler配置指向,原指向/var/www/cobbler;导入系统ISO时,文件较大,修改指向有足够空间的目录将系统ISO导入 cobbler中,--name后,会在webdir目录下建立相应名字的目录,--path可用系统dir,可以为网上链接
如:cobbler import --path=rsync://mirrors.163.com/centos/6.0/os/i386/ --name=centos-6.0-i386
导入的同时会创建一个名字为centos-5.5的一个发布版本,以及一个名字为centos-5.5的profile文件。
导入命令可通过 cobbler import --help 查看
10、同步cobbler配置cobbler 会自动进行初始化工作,移除已经存在的
启动项,然后根据模板拷贝loader 文件。之后再生成
pxe 的配置文件,生成dhcp 的配置文件,最后再重启
dhcp 服务。
至此,就可以使用虚拟机来测试cobbler 安装了。
11、虚拟机设置PXE方式启动
虚拟机装系统时,使用的kickstart文件为/var/lib/cobbler/kickstarts/sample.ks
12、设置启动项安装过程中报错
1、启动HTTPD里,提示错误原因:模块mod_wsgi.so未启动
编辑/etc/httpd/conf.d/wsgi.conf ,取消注释"LoadModule wsgi_module modules/mod_wsgi.so"后重新启动
2、安装后报错解决办法:重新启动cobbler
/etc/init.d/cobblerd restart
Cobbler支持命令行管理,web 界面管理,还提供了API 接口,可以方便二次开发使用。
和Kickstart 不同的是,使用cobbler 不会因为在局域网中启动了dhcp 而导致有些机器因为默认从pxe启动在重启服务器后加载tftp 内容导致启动终止。
官网:https://fedorahosted.org/cobbler/wiki/UserDocs
官网:https://fedorahosted.org/cobbler/wiki/DownloadInstructions
Cobbler的安装环境准备
1、安装epel源
EPEL源选择地址: https://fedorahosted.org/cobbler/wiki/DownloadInstructions
- rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
- # yum list |grep cobbler
- cobbler.noarch 2.2.3-2.el5 epel
- cobbler-web.noarch 2.2.3-2.el5 epel
- revisor-cobbler.noarch 2.0.5.2-3.el5 epel
- yum -y install dhcp
额外需要的服务还有tftp,rsync,xinetd,httpd。
- yum install -y tftp-server
- yum install -y pykickstart
- cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
启动DHCP
/etc/init.d/dhcpd start
cobbler安装
1、安装cobbler
- yum -y install cobbler
- /sbin/service cobblerd start
- # cobbler check
- The following are potential configuration items that you may want to fix:
- 1 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked
- 2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
- 3 : ksvalidator was not found, install pykickstart
- 4 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
- 5 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
提示debmirror未安装时,如果不是debian系统,可忽略
3、使用cobbler
修改cobbler配置,修改server、next-server为本机IP
- vi /etc/cobbler/settings
- # this is the address of the cobbler server -- as it is used
- # by systems during the install process, it must be the address
- # or hostname of the system as those systems can see the server.
- # if you have a server that appears differently to different subnets
- # (dual homed, etc), you need to read the --server-override section
- # of the manpage for how that works.
- server: 127.0.0.1
- # if using cobbler with manage_dhcp, put the IP address
- # of the cobbler server here so that PXE booting guests can find it
- # if you do not set this correct
next_server: 127.0.0.1[/code]
4、自动下载loader 程序
- #cobbler get-loaders
- disable为no
- disable = no
- openssl passwd -1 -salt 'random-phrasehere' 'your-password-here'
less /etc/cobbler/settings |grep default_password_crypted
如果openssl不好使,可以手动修改执行opssl后会提示一串字符串,替换default_password_crypted后内容
7、全部完成后,重启cobbler
- /etc/init.d/cobblerd restart
- vi /etc/cobbler/settings
- manage_dhcp: 1
是cobbler 管理dhcp 的模板
vi /etc/cobbler/dhcp.template ,主要修改内容如下:
- subnet 192.168.52.0 netmask 255.255.255.0 {
- option routers 192.168.52.254;
- option domain-name-servers 61.135.142.198;
- option subnet-mask 255.255.255.0;
- range dynamic-bootp 192.168.52.87 192.168.52.89;
- filename "/pxelinux.0";
- default-lease-time 21600;
- max-lease-time 43200;
- next-server $next_server;
- }
修改cobbler配置指向,原指向/var/www/cobbler;导入系统ISO时,文件较大,修改指向有足够空间的目录
- vi /etc/cobbler/settings
- webdir = /usr/local/cobbler
- mount -o loop /usr/local/myshare/CentOS5_5.iso /mnt/
- cobbler import --path=/mnt --name=centos-5.5 --arch=x86_64
如:cobbler import --path=rsync://mirrors.163.com/centos/6.0/os/i386/ --name=centos-6.0-i386
导入的同时会创建一个名字为centos-5.5的一个发布版本,以及一个名字为centos-5.5的profile文件。
导入命令可通过 cobbler import --help 查看
10、同步cobbler配置
- # cobbler sync
启动项,然后根据模板拷贝loader 文件。之后再生成
pxe 的配置文件,生成dhcp 的配置文件,最后再重启
dhcp 服务。
至此,就可以使用虚拟机来测试cobbler 安装了。
11、虚拟机设置PXE方式启动
虚拟机装系统时,使用的kickstart文件为/var/lib/cobbler/kickstarts/sample.ks
12、设置启动项
- /sbin/service httpd start
- /sbin/service dhcpd start
- /sbin/service xinetd start
- /sbin/service cobblerd start
- /sbin/chkconfig httpd on
- /sbin/chkconfig dhcpd on
- /sbin/chkconfig xinetd on
- /sbin/chkconfig tftp on
- /sbin/chkconfig cobblerd on
1、启动HTTPD里,提示
- #/etc/init.d/httpd start
- Starting httpd: Syntax error on line 10 of /etc/httpd/conf.d/cobbler.conf:
- Invalid command 'WSGIScriptAliasMatch', perhaps misspelled or defined by a module not included in the server configuration[FAILED]
编辑/etc/httpd/conf.d/wsgi.conf ,取消注释"LoadModule wsgi_module modules/mod_wsgi.so"后重新启动
2、安装后报错
- Traceback (most recent call last):
- File "/usr/bin/cobbler", line 35, in ?
- sys.exit(app.main())
- File "/usr/lib/python2.4/site-packages/cobbler/cli.py", line 558, in main
- rc = cli.run(sys.argv)
- File "/usr/lib/python2.4/site-packages/cobbler/cli.py", line 202, in run
- self.token = self.remote.login("", self.shared_secret)
- File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__
- return self.__send(self.__name, args)
- File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request
- verbose=self.__verbose
- File "/usr/lib64/python2.4/xmlrpclib.py", line 1147, in request
- return self._parse_response(h.getfile(), sock)
- File "/usr/lib64/python2.4/xmlrpclib.py", line 1286, in _parse_response
- return u.close()
- File "/usr/lib64/python2.4/xmlrpclib.py", line 744, in close
- raise Fault(**self._stack[0])
- xmlrpclib.Fault:
/etc/init.d/cobblerd restart
编辑回复