参考网上的一下教程,整理一下便于日后用
一、安装第三方rpmforge包
下载网址:http://www.rpmfind.net/linux/rpm2html/search.php?query=rpmforge-release
shell>wget http://www.rpmfind.net/linux/rpm2html/search.php?query=rpmforge-release
wget ftp://195.220.108.108/linux/dag/redhat/el5/en/x86_64/dag/RPMS/rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm
shell>rpm –ivh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
(Centos5 64位: rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm)
二、安装cobblerhttpd rsync tftp-server xinetd dhcp服务
shell>yum install –y install cobbler httpdrsync tftp-server xinetd dhcp -y
检查syslinux是否已经安装
shell>yum install syslinux –y
三、手动开启wsgi模块
vim /etc/httpd/conf.d/wsgi.conf
#LoadModule wsgi_module modules/mod_wsgi.so 前面#去掉即可
四、启动相关服务
shell>service cobblerd restart
shell>service httpd restart
设置服务开机自启动,开启服务,如果在chkconfig –list中没有的服务,需要手动添加
chkconfig –list 查看相关服务有没有列出来,如dhcpd没有在列表中,则执行下一下命令:
chkconfig –add dhcpd
chkconfig –level 345 dhcpd on
确保服务开机自启动
chkconfig httpd on
chkconfig dhcpd on
chkconfig xinetd on
chkconfig cobblerd on
chkconfig rsync on
service httpd start
挂载镜像文件到mnt文件目录
shell> mount -o loop /data/iso/CentOS-5.5-x86_64-bin-DVD-1of2/mnt/cdrom/ #挂载光盘镜像
在虚拟机中可以设置:可移动设备->cd/dvd(sata)->连接(先设置iso文件),然后执行命令
mount /dev/cdrom /mnt -r #挂载cdrom下的光盘镜像到/mnt 下
接着执行命令cobblerdistro list查看是否有导入的文件
导入OS镜像:
mkdir /mnt/centos_iso
mount -o loop ./iso/CentOS-6.5-x86_64-minimal.iso /mnt/centos_iso
cobbler import --arch=x86_64 --path=/mnt/centos_iso--name=CentOS-6.5
再次同步修改:
cobbler sync
制作cobbler启动菜单
shell> cobbler import --path=/data/iso/ --name=CentOS-5.5-x86_64
五、修改配置文件
修改rsync配置文件修改
#vi /etc/xinetd.d/rsync
disable = yes 改成no //开启rsync
修改tftp配置文件
#vi /etc/xinetd.d/tftp
disable = yes 改成no //开启tfpt
修改cobbler配置文件
vi /etc/cobbler/settings
next_server: '127.0.0.1' //改成本机IP:192.168.1.102
server: '127.0.0.1' //改成本机IP:192.168.1.102
manage_dhcp: 0 //改成1 //开启管理DHCP服务
manage_tftpd: 0 //改成1 //开启管理DHCP服务
default_password_crypted:"$1$mF86/UHC$WvcIcX2t6crBz2onWxyac." //root用户密码,可以用命令行得到加密的密码,具体用法如下:
shell> openssl passwd -apr1 -salt 'openssl rand -hex 4'
Password: #输入密码
$apr1$openssl $aA7bNBhsYJPhUH8z6mKS3/
修改 dhcp的配置
#vi /etc/cobbler/dhcp.template
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
subnet 192.168.1.0 netmask 255.255.255.0 {
#option routers 192.168.1.1;
#option domain-name-server 192.168.0.100;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.2 192.168.1.200;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
……………………
编辑ks文件 模板文件位置位于/var/lib/cobbler/kickstarts/目录下
vi /etc/cobbler/default.ks
……
六、同步cobbler配置使之生效
shell> service cobblerd restart
shell> service httpd restart
shell> service xinetd restart
shell> cobbler sync
shell> service dhcpd restart
至此服务器的配置工作完成客户端开机
在检查cobbler中,发现一下错误:
shell>cobbler check
错误:
1 : 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 youhave 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.
2 : debmirror package is not installed, it will be required tomanage debian deployments and repositories
3 : ksvalidator was not found, install pykickstart
4 : The default password used by the sample templates for newlyinstalled machines (default_password_crypted in /etc/cobbler/settings) is stillset 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
第1个问题解决办法:执行命令cobblerget-loaders或者到/usr/share/syslinux/目录中复制相应的文件到/var/lib/cobbler/loaders/即可。
第2个问题解决办法:debian 安装用,暂时可以不管;如果需要安装,下载地址为:http://rpmfind.net/linux/rpm2html/search.php?query=debmirror
第3个问题解决办法:安装pykickstart软件,yum install pykickstart –y
第4个问题解决办法:对root密码修改
shell>openssl passwd -apr1 -salt 'openssl rand -hex 4'
Password: #输入密码
$apr1$openssl $/vGgWVz8WEUqzbz6kBoVb0
shell>vim/etc/cobbler/setting
default_password_crypted: "$/vGgWVz8WEUqzbz6kBoVb0" //将引号中的内容替换成上面的字符串
第5个问题解决办法:执行命令# yuminstall cman fence-agents –y
安装完之后再次启动cobblerd服务,并用cobblersync命令进行同步,再检查
cobbler check
安装cobbler的WEB管理
yum -y cobbler-web
vim /etc/cobbler/modules.conf
[authentication]
module = authn_pam
添加cobbler用户添加cobbler密码
>useradd cobbleradmin
>passwd cobbleradmin
编辑/etc/cobbler/users.conf配置文件
[admins]
admin = “cobbleradmin”
Cobbler = “”
重启cobblerd
service cobblerd restart
重启一下httpd
service httpd restart