CentOS+Cobbler安装配置

系统信息:CentOS release 6.5 (Final)

内核信息:2.6.32-431.el6.x86_64


1.安装epel;

[root@cobbler-server apps]# wget http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@cobbler-server apps]# rpm -ivh epel-release-6-8.noarch.rpm

 

2.安装cobbler相关服务;

[root@cobbler-server apps]# yum install -y cobbler httpd tftp-server xinetd dhcp rsync

 

3.启动相关服务并且检查配置;

[root@cobbler-server ~]# chkconfig httpd on
[root@cobbler-server ~]# chkconfig cobblerd on
[root@cobbler-server ~]# chkconfig xinetd on
[root@cobbler-server apps]#/etc/init.d/cobblerd restart
Stopping cobbler daemon:                                   [  OK  ]
Starting cobbler daemon:                                   [  OK  ]
[root@cobbler-server apps]#/etc/init.d/httpd restart
Stopping httpd:                                           [  OK  ]
Starting httpd: httpd:apr_sockaddr_info_get() failed for cobbler-server
httpd: Could not reliably determine theserver's fully qualified domain name, using 127.0.0.1 for ServerName
                                                          [  OK  ]

 

[root@cobbler-server apps]# cobbler check
The following are potential configurationitems that you may want to fix:
 
1 : The 'server' field in /etc/cobbler/settingsmust be set to something other than localhost, or kickstarting features willnot work.  This should be a resolvablehostname or IP for the boot server as reachable by all machines that will useit.
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 missingfrom /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to downloadthem, or, if you only want to handle x86/x86_64 netbooting, you may ensure thatyou have installed a *recent* version of the syslinux package installed and canignore this message entirely.  Files inthis directory, should you want to support all architectures, should includepxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' commandis the easiest way to resolve these requirements.
4 : change 'disable' to 'no' in/etc/xinetd.d/rsync
5 : debmirror package is not installed, itwill be required to manage debian deployments and repositories
6 : ksvalidator was not found, installpykickstart
7 : The default password used by the sampletemplates 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
8 : fencing tools were not found, and arerequired to use the (optional) power management features. install cman or fence-agentsto use them
 
Restart cobblerd and then run 'cobblersync' to apply changes.

根据上面的提示我们一一进行解决:

1)编辑/etc/cobbler/settings文件,找到server选项,修改成服务器实际IP即可(384行左右)。

384  rver: 10.0.1.7

2)编辑/etc/cobbler/settings文件,找到next_server选项,修改成服务器实际IP即可(272行左右)。

272  xt_server: 10.0.1.7

3)执行cobbler get-loaders,系统自动下载loader程序,完成修复工作。

[root@cobbler-server apps]# cobbler get-loaders

4)编辑/etc/xinetd.d/rsync,把文件中disable字段配置yes改成no

[root@cobbler-server apps]# vim /etc/xinetd.d/rsync

service rsync

{

       disable = no

       flags           = IPv6

       socket_type     = stream

       wait            = no

       user            = root

       server          = /usr/bin/rsync

       server_args     = --daemon

       log_on_failure  += USERID

}

5)  提示debmirror没有安装,如果不是debian之类的系统可以忽略。

6)提示需要安装pykickstart

[root@cobbler-server apps]# yum install -y pykickstart

7)修改cobbler默认密码,并且更改/etc/cobbler/settings文件。

[root@cobbler-server apps]# openssl passwd -1 -salt 'random-phrase-here' '123456'

$1$random-p$mzxQ/Sx848sXgvfwJCoZM0
[root@cobbler-server apps]# vim /etc/cobbler/settings 101行)

101 default_password_crypted:"$1$random-p$mzxQ/Sx848sXgvfwJCoZM0"

8)提示需要安装cman

[root@cobbler-server apps]# yum install -y cman

 

4.重启cobbler并且检查配置文件。

[root@cobbler-server apps]#/etc/init.d/cobblerd restart
Stopping cobbler daemon:                                   [  OK  ]
Starting cobbler daemon:                                   [  OK  ]
[root@cobbler-server apps]# cobbler check
The following are potential configurationitems that you may want to fix:
 
1 : debmirror package is not installed, itwill be required to manage debian deployments and repositories
 
Restart cobblerd and then run 'cobblersync' to apply changes.

 

5.导入安装文件;

[root@cobbler-server apps]# ls
CentOS-6.5-x86_64-bin-DVD1.iso  epel-release-6-8.noarch.rpm
[root@cobbler-server apps]#mount -o loop -tiso9660 CentOS-6.5-x86_64-bin-DVD1.iso /mnt
[root@cobbler-server apps]# cobbler import --path=/mnt --name=CentOS-6.5-x86_64-bin-DVD1

 

6.配置DHCP服务;

编辑/etc/cobbler/settings修改242行为1如下:

[root@cobbler-server apps]# vim /etc/cobbler/settings
242 manage_dhcp: 1

 

编辑/etc/cobbler/dhcp.template修改cobbler dhcp管理模板

[root@cobbler-server apps]# vim /etc/cobbler/dhcp.template
修改如下内容:
subnet 10.0.1.0 netmask 255.255.255.0 {
    option routers              10.0.1.254;
     optiondomain-name-servers  202.106.0.20;
    option subnet-mask        255.255.255.0;
    range dynamic-bootp        10.0.1.100 10.0.1.120;
    default-lease-time          21600;
    max-lease-time             43200;
    next-server                $next_server;
 
[root@cobbler-server apps]#/etc/init.d/xinetd restart
Stopping xinetd:                                          [  OK  ]
Starting xinetd:                                          [  OK  ]

7.同步cobbler配置;

[root@cobbler-server apps]# cobbler sync
task started: 2014-09-03_153036_sync
task started (id=Sync, time=Wed Sep  3 15:30:36 2014)
running pre-sync triggers
cleaning trees
removing:/var/www/cobbler/images/CentOS-6.5-bin-DVD1-x86_64
removing:/var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing:/var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/efidefault
removing:/var/lib/tftpboot/grub/grub-x86.efi
removing:/var/lib/tftpboot/images/CentOS-6.5-bin-DVD1-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink/var/lib/cobbler/loaders/grub-x86_64.efi ->/var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink/var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying files for distro:CentOS-6.5-bin-DVD1-x86_64
trying hardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64-bin-DVD1/images/pxeboot/vmlinuz-> /var/lib/tftpboot/images/CentOS-6.5-bin-DVD1-x86_64/vmlinuz
trying hardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64-bin-DVD1/images/pxeboot/initrd.img-> /var/lib/tftpboot/images/CentOS-6.5-bin-DVD1-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: CentOS-6.5-bin-DVD1-x86_64
trying hardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64-bin-DVD1/images/pxeboot/vmlinuz-> /var/www/cobbler/images/CentOS-6.5-bin-DVD1-x86_64/vmlinuz
trying hardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64-bin-DVD1/images/pxeboot/initrd.img-> /var/www/cobbler/images/CentOS-6.5-bin-DVD1-x86_64/initrd.img
Writing template files forCentOS-6.5-bin-DVD1-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro:CentOS-6.5-bin-DVD1-x86_64
cleaning link caches
running post-sync triggers
running python triggers from/var/lib/cobbler/triggers/sync/post/*
running python triggercobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout:
received on stderr:
running: service dhcpd restart
received on stdout: 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 triggercobbler.modules.scm_track
running shell triggers from/var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

 

到此cobbler配置已经完成,可以用虚拟机进行测试。

wKiom1QSVD3iJb-_AADBHhHwPKA114.jpg

8.安装cobbler-web;

[root@cobbler-server ~]# yum install -y cobbler-web
[root@cobbler-server ~]# /etc/init.d/httpd restart
Stopping httpd:                                           [  OK  ]
Starting httpd: httpd:apr_sockaddr_info_get() failed for cobbler-server
httpd: Could not reliably determine theserver's fully qualified domain name, using 127.0.0.1 for ServerName
                                                          [  OK  ]

 

访问地址:http://ip/cobbler_web

Username:cobbler

Password:cobbler

wKioL1QSVKKiBIr9AAFh_GVHAxA392.jpg



登陆之后的界面:

wKiom1QSVNnRo6B-AAIYNJ49-zg420.jpg

你可能感兴趣的:(cobbler,自动部署系统)