Cobbler安裝手冊

什麼是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

從新登陸後,進入操做界面。

相關文章
相關標籤/搜索