什么是Cobbler,请查看Cobbler官网和操做手册。node
安装环境CentOS_6.8_x86_64(Desktop),Cobbler 2.8.0python
因为不具有外网环境,采用rpm安装包的方式。linux
rpm包下载地址:cobbler-2.8.0 ,cobbler-web-2.8.0git
一、配置yum本地源安装依赖github
mkdir /media/CentOS mount -t iso9660 /dev/cdrom /media/CentOS
二、配置repo文件web
cd /etc/yum.repos.d mv CentOS-Base.repo CentOS-Base.repo.bak mv CentOS-Vault.repo CentOS-Vault.repo.bak mv CentOS-Vault.repo CentOS-Vault.repo.bak cp CentOS-Media.repo CentOS-Media.repo.bak
修改CentOS-Media.repo,设置enabled=1django
清除缓存json
yum clean all yum makecache
二、安装依赖api
rpm -i cobbler-2.8.0-17.1.noarch.rpm cobbler-web-2.8.0-17.1.noarch.rpm
运行以上命令会报错,显示缺乏依赖,例如:浏览器
error: Failed dependencies: redhat-rpm-config is needed by cobbler-2.8.0-17.1.noarch python-simplejson is needed by cobbler-2.8.0-17.1.noarch syslinux is needed by cobbler-2.8.0-17.1.noarch python-cheetah is needed by cobbler-2.8.0-17.1.noarch PyYAML is needed by cobbler-2.8.0-17.1.noarch mod_wsgi is needed by cobbler-2.8.0-17.1.noarch Django >= 1.4 is needed by cobbler-web-2.8.0-17.1.noarch mod_wsgi is needed by cobbler-web-2.8.0-17.1.noarch
根据提示缺失的依赖进行安装。
例如:
sudo yum install redhat-rpm-config sudo yum install createrepo sudo yum install python-simplejson sudo yum install syslinux sudo yum install python-cheetah sudo yum install PyYAML sudo yum install mod_wsgi
cobbler-web须要依赖Django,若是你不须要web界面,能够不安装Django。
因为yum仓库里没有Django,须要手动安装。推荐使用Django-1.5.12,点此下载Django-1.5.12。(不推荐使用高版本的Django,须要升级python2.7,CentOS 6.8默认的python版本为2.6.6)。
解压Django。
tar xzvf Django-1.5.12.tar.gz
加压后的目录里有个INSTALL文件,根据里面的说明进行安装。
python setup.py install
检查django是否安装成功:
#进入python命令界面 >>> import django >>> print(django.get_version()) 1.5.12
全部依赖安装完毕后,安装cobbler和cobbler-web。
rpm -i cobbler-2.8.0-17.1.noarch.rpm rpm -i --force --nodeps cobbler-web-2.8.0-17.1.noarch.rpm
设置SElinux
sudo setsebool -P httpd_can_network_connect true
若是没设置SElinux,可能后面会遇到一下错误信息:
ProtocolError: <ProtocolError for x.x.x.x:80/cobbler_api: 503 Service Temporarily Unavailable>
启动cobblerd,httpd,并设置成开机启动。
service cobblerd start chkconfig cobblerd on service httpd start service httpd on
检查是否启动
service cobblerd status service http status
检查cobbler是否安装成功
$ cobbler check The following are potential configuration items that you may want to fix: 1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it. 2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network. 3 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment: https://github.com/cobbler/cobbler/wiki/Selinux 4 : missing /etc/xinetd.d/tftp, install tftp-server? 5 : missing configuration file: /etc/xinetd.d/tftp 6 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements. 7 : change 'disable' to 'no' in /etc/xinetd.d/rsync 8 : Apache (httpd) is not installed and/or in path 9 : debmirror package is not installed, it will be required to manage debian deployments and repositories 10 : ksvalidator was not found, install pykickstart 11 : 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 12 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them Restart cobblerd and then run 'cobbler sync' to apply changes.
出现一下提示,安装成功。
进一步设置cobbler-web。
检查配置:/etc/cobbler/modules.conf中一下两项配置
[authentication] module = authn_configfile [authorization] module = authz_allowall
设置web界面登陆用户名cobbler,运行命令后输入密码。
htdigest /etc/cobbler/users.digest "Cobbler" cobbler
打开浏览器,访问127.0.0.1:80/cobbler_web,出现登陆页面,输入用户名cobbler,密码。(上一部设置的)
若是你登陆后,遇到下面的错误
[Errno 13] Permission denied: '/var/lib/cobbler/webui_sessions/sessionid4r8yzmavdexechcw0mta277g5kcfnov3'
解决方法以下:
chcon -R -t httpd_cobbler_rw_content_t /var/lib/cobbler/webui_sessions
从新登陆后,进入操做界面。