epel源安装
rpm -ivh epel-release-6-8.noarch.rpm
yum -y install cobbler httpd rsync tftp-server xinetd dhcp cobbler-web koan pykickstart* fence-agents* debmirror syslinux
$$$$$$$$$$$启动cobbler服务
/etc/init.d/cobblerd start
$$$$$$$$启动httpd服务
/etc/init.d/httpd start
$$$$$$$$$$检测
cobbler check
$$$$$$$$$$$$$问题1:
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 657, 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‘">
$$$$$$$$$$$$解决方法:
service cobblerd restart
cobbler get-loaders
$$$$$$$$$$$$$$$$$$$问题2:
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 : 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.
4 :you need to set some SELinux content rules to ensure cobbler works correctly in your SELinux environment, run the following:
/usr/sbin/semanage fcontext -a -t public_content_t "/tftpboot/.*" && \
/usr/sbin/semanage fcontext -a -t public_content_t "/var/www/cobbler/images/.*"
5 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/rsync
change ‘disable‘ to ‘no‘ in /etc/xinetd.d/tftp
6 : comment out ‘dists‘ on /etc/debmirror.conf for proper debian support
comment out ‘arches‘ on /etc/debmirror.conf for proper debian support
7 :since iptables may be running, ensure 69, 80, and 25151 are unblocked
8 : The default pass<a href="http://www.it165.net/edu/ebg/" target="_blank" class="keylink">word</a> used by the sample templates for newly installed machines (default_pass<a href="http://www.it165.net/edu/ebg/" target="_blank" class="keylink">word</a>_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
Restart cobblerd and then run ‘cobbler sync‘ to apply changes.
9,debmirror package is not installed, it will be required to manage debian deployments and repositories
$$$$$$$$$$$$$$$$$$$$$上面这段信息大意就是:
1,编辑/etc/cobbler/settings文件,找到 server:选项,修改为适当的ip地址,本实例配置ip为:192.168.10.1
2,编辑/etc/cobbler/settings文件,找到 next_server:选项,修改为适当的ip地址,本实例配置ip为:192.168.10.1
4,SELinux的设置。如果上面已经关闭了SELinux就不用管了,SELinux的设置。如果上面已经关闭了SELinux就不用管了
3,执行 cobbler get-loaders,系统将自动下载loader程序,完成提示4的修复工作。
5,编辑/etc/xinetd.d/tftp文件,将文件中的disable字段的配置由yes改为no
编辑/etc/xinetd.d/rsync文件,将文件中的disable字段的配置由yes改为no
6. 在/etc/debmirror.conf文件中注释dists和arches
7,在iptables中将69,80,25151端口打开。如果仅仅只是在内部环境中使用,建议直接将防火墙关掉
9,提示说debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略,如果需要安装,下载地址为:
http://rpmfind.net/linux/rpm2html/search.php?query=debmirror
CentOS 6使用RHEL 5的包就可以。
8,修改cobbler用户的默认密码,可以使用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings (default_password_crypted: )中的密码。生成密码命令:
openssl passwd -1 -salt ‘用户‘ ‘密码‘
其中“random-phrase-here”为干扰码
$$$$$$$$$$$$$$$$$$$$$解决方案:
1.vim /etc/cobbler/settings
server: 192.168.1.20
2.vim /etc/cobbler/settings
next_server: 192.168.1.20
3. cobbler get-loaders
4.vim /etc/sysconfig/selinuc
SELINUX=disabled
5. vim /etc/xinetd.d/rsync
disable = no
vim /etc/xinetd.d/tftp
disable = no
service xinetd start
6.vim /etc/debmirror.conf
#@dists="sid";
#@arches="i386";
7./etc/init.d/iptables stop或
iptables -F
iptables -X
/etc/init.d/iptables save
8. openssl passwd -1 -salt ‘maishujie‘ ‘123456‘
$1$maishujie$MqApDf9CDu.SNuvbG/ju70
vim /etc/cobbler/settings
default_password_crypted: "$1$maishujie$MqApDf9CDu.SNuvbG/ju70"
9.忽略
如遇到其他问题根据错误提示解决
/etc/init.d/cobbler restart
cobbler sync
cobbler check
显示No configuration problems found. All systems go.及为正常
$$$$$$$$$$$$$$查询启动端口netstat -ntulp
######################cobbler的使用
vim /etc/cobbler/settings
mange_dhcp: 1
mange_tftpd:1
pxe_just_once:1
$$$$$$$$$$$$$$$$$$$$定制dhcp模板(Ifconfig eth0:0 192.168.10.254/24)
vi /etc/cobbler/dhcp.template
subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.254;
option domain-name-servers 202.106.0.20;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.10.100 192.168.10.200;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}
}
$$$$$$$$$$$$$$$$重启服务器 /etc/init.d/cobbler restart
cobbler sync
more /etc/dhcp/dhcpd.conf 验证模板更新
more /etc/xinetd.d/tftp
$$$$$$$$$$$建立目录
yum -y install lrzsz
放置ios文件目录mkdir -pv /data/iso
rz选择iso文件上传
挂载目录mkdir /data/sys/centos6.4_64
挂载 mount -o loop /data/iso/CentOS-6.4-x86_64-bin-DVD1.iso /data/centos6.4_64
ks文件放置目录mkdir /data/ks/centos6.4_64
rz选择ks文件上传
$$$$$$$$$$$$导入安装文件
cobbler import --path=/data/sys/centos6.4_64/ --name=centos6.4_64 --kickstart=/data/ks/centos6.4_64/ks.cfg --arch=x86_64
显示
task started: 2015-08-14_010049_import
task started (id=Media import, time=Fri Aug 14 01:00:49 2015)
Found a candidate signature: breed=redhat, version=rhel6
Found a matching signature: breed=redhat, version=rhel6
Adding distros from path /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64:
creating new distro: centos6.4-x86_64
trying symlink: /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64 -> /var/www/cobbler/links/centos6.4-x86_64
creating new profile: centos6.4-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64 for centos6.4-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64
looking for /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos6.4_i386-x86_64/repodata
*** TASK COMPLETE ***
从上面显示信息所知,cobbler会将镜像中的拷贝到本地一份,放在/var/www/cobbler/ks_mirrors下的centos- 6.0-i386目录下。同时会创建一个名字为centos-6.0-i386的一个发布版本,以及一个名字为centos-6.0-i386的 profile文件。
service xinetd restart
$$$$$$$$$$$$$$$同步cobbler配置
# cobbler sync
显示
ask started: 2011-08-11_170706_sync
task started (id=Sync, time=Thu Aug 11 17:07:06 2011)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos-6.0-i386
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/images/centos-6.0-i386
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
copying distros
copying files for distro: centos-6.0-i386
trying hardlink /var/www/cobbler/ks_mirror/centos-6.0-i386/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos-6.0-i386/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos-6.0-i386/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos-6.0-i386/initrd.img
trying hardlink /var/www/cobbler/ks_mirror/centos-6.0-i386/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos-6.0-i386/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos-6.0-i386/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos-6.0-i386/initrd.img
copying images
generating PXE configuration files
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
cleaning link caches
generating PXE menu structure
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout:
received on stderr:
running: /etc/rc.d/init.d/dhcpd restart
received on stdout: Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
received on stderr:
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
cobbler会自动进行初始化工作,移除已经存在的启动项,然后根据模板拷贝loader文件。之后再生成pxe的配置文件,生成dhcp的配置文件,最后再重启dhcp服务。
至此,就可以使用虚拟机来测试cobbler安装了。