linux 下使用cobber 批量安装系统
2015-07-04 12:39
567 查看
#####################################################
本文内容来自—王星星
如有转载,请务必保留本文链接及本内容版权信息。
欢迎广大运维同仁一起交流linux/unix网站运维技术!
QQ:1218761836
E-mail:wangxing0122@hotmail.com
#####################################################
QQ群:150181442
#####################################################
使用cobbler批量安装linux系统
kickstart 安装且针对 domain=mydomain.com 进行配置,但每台机器拥有其自己的机器名称。您仍然可以使用 kickstart 模板在不同的域中安装其他机器并使用不同的机器名称。
工作原理:
Server端:
第一步,启动Cobbler服务
第二步,进行Cobbler错误检查,执行cobbler check命令
第三步,进行配置同步,执行cobblersync命令
第四步,复制相关启动文件文件到TFTP目录中
第五步,启动DHCP服务,提供地址分配
第六步,DHCP服务分配IP地址
第七步,TFTP传输启动文件
第八步,Server端接收安装信息
第九步,Server端发送ISO镜像与Kickstart文件
Client端:
第一步,客户端以PXE模式启动
第二步,客户端获取IP地址
第三步,通过TFTP服务器获取启动文件
第四步,进入Cobbler安装选择界面
第五步,客户端确定加载信息
第六步,根据配置信息准备安装系统
第七步,加载Kickstart文件
第八步,传输系统安装的其它文件
第九步,进行安装系统
第二选择yum源
Centos5 64位: rpm -Uvhhttp://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
Centos6 32位: rpm -Uvh'http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-7.noarch.rpm'
Centos6 64位: rpm -Uvh 'http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
--2015-06-2910:13:48-- http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
Resolvingmirrors.ustc.edu.cn... 202.141.176.110, 2001:da8:d800:95::110
Connecting tomirrors.ustc.edu.cn|202.141.176.110|:80... connected.
HTTP requestsent, awaiting response... 200 OK
Length: 12232(12K) [application/x-redhat-package-manager]
Saving to:`epel-release-5-4.noarch.rpm'
100%[====================================================================================================>]12,232 --.-K/s in 0.02s
2015-06-2910:13:52 (484 KB/s) - `epel-release-5-4.noarch.rpm' saved [12232/12232]
[root@localhostsrc]# ls
epel-release-5-4.noarch.rpm
[root@localhostsrc]# rpm -ivh epel-release-5-4.noarch.rpm
warning:epel-release-5-4.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ###########################################[100%]
1:epel-release ########################################### [100%]
[root@localhostsrc]#
[root@localhostsrc]# yum install pykickstart debmirror python-ctypes cman -y 安装cobbler所需的软件包
# NOTE:mod_wsgi can not coexist in the same apache process as
#mod_wsgi_python3. Only load ifmod_wsgi_python3 is not
# alreadyloaded.
<IfModule!wsgi_module>
LoadModulewsgi_module modules/mod_wsgi.so # 取消前面的注释
</IfModule>
[root@localhostsrc]# /etc/init.d/httpd restart
Stoppinghttpd: [FAILED]
Startinghttpd: [ OK ]
[root@localhostsrc]# chkconfig httpd on
# default:off
#description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to bootdiskless \
# workstations, download configuration filesto network-aware printers, \
# and to start the installation processfor some operating systems.
service tftp
{
disable = no ##将no改为no
socket_type = dgram
protocol = udp
wait = yes
user = $user
server = $binary
server_args = -B 1380 -v -s $args
per_source = 11
cps = 100 2
flags = IPv4
}
[root@localhostsrc]# cat /etc/xinetd.d/rsync
# default:off
#description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no ##将yes改为no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
[root@localhostsrc]# /etc/init.d/xinetd start
[root@localhostsrc]# vim /etc/debmirror.conf
注释
#@dists="sid";
#@arches="i386";
$1$osyunwei$sEV8iwXXuR4CqzLXyLnzm
修改 vim /etc/cobber/settings
default_kickstart:/var/lib/cobbler/kickstarts/default.ks
default_password_crypted:"$1$osyunwei$sEV8iwXXuR4CqzLXyLnzm0"
manage_dhcp:1
next_server:192.168.209.128
server:192.168.209.128
ddns-update-styleinterim;
allowbooting;
allow bootp;
ignoreclient-updates;
setvendorclass = option vendor-class-identifier;
optionpxe-system-type code 93 = unsigned integer 16;
subnet192.168.209.0 netmask 255.255.255.0 {
option routers 192.168.209.1;
option domain-name-servers8.8.8.8,8.8.4.4;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.209.100 192.168.209.254;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
[root@localhostks_mirror]# cat /etc/sysconfig/dhcpd
# Commandline options here
DHCPDARGS=eth0
启动dhcp 使用cobber sync 就可以启动dhcp
同步cobber sync 就可以加载dhcp服务启动了
确保这些服务都开启就可以进行测试安装了,
/etc/init.d/xinted start
/etc/init.d/httpd start
/etc/init.d/cobberstart
mkdir -p/var/www/html/os/centos_x64_x86
mount/dev/cdrom /media/
rsync -avP /media/* /var/www/html/os/centos_x64_x86/
使用rsync或者scp
cobblerimport --path=/var/www/html/os/centos_x64_x86/ --name=centos_x64_x86 --arch=x86_64
导入镜像的命令参数
命令格式:cobbler import --path=镜像路径 -- name=安装引导名 --arch=32位或64位,重复上面的操作,把其他的系统镜像文件导入到cobber中,
cobblerdistro list 列出已经安装镜像
进入到kickstarts 模板目录
cd/var/lib/cobbler/kickstarts
[root@localhostkickstarts]# ls
default.ks legacy.ks sample_end.ks sample_esxi5.ks sample.seed
esxi4-ks.cfg pxerescue.ks sample_esx4.ks sample.ks
esxi5-ks.cfg sample_autoyast.xml sample_esxi4.ks sample_old.seed
/etc/init.d/cobblerdrestart
安装kickstart
yum install system-config-kickstart
yumgroupinstall "X Window System"
startx 进入到图形界面生成ks.cf 文件
system-config-kickstart运行生成ks.cf 文件
修改文件名称添加到cobber 中
[root@localhost~]# cobbler profile add --name=centos_x64-x86_64 --distro=centos_x64-x86_64--kickstart=/var/lib/cobbler/kickstarts/cenots5.8_x86_64.cfg
exception onserver: "it seems unwise to overwrite this object, try 'edit'"
添加文件的命令参数
命令:cobbler profile add|edit|remove --name=安装引导名 --distro=系统镜像名--kickstart=kickstart自动安装文件路径
--name:自定义的安装引导名,注意不能重复
--distro:系统安装镜像名,用cobbler distro list可以查看
--kickstart:与系统镜像文件相关联的kickstart自动安装文件
cobbler list
cobblerreport
cobblerprofile report
cobblerdistro list
[root@localhost~]# cobbler list
distros:
centos_x64-x86_64
centos_x64-xen-x86_64
profiles:
centos_x64-x86_64
centos_x64-xen-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
[root@localhost~]# cobbler distro list
centos_x64-x86_64
centos_x64-xen-x86_64
[root@localhost~]#
本文内容来自—王星星
如有转载,请务必保留本文链接及本内容版权信息。
欢迎广大运维同仁一起交流linux/unix网站运维技术!
QQ:1218761836
E-mail:wangxing0122@hotmail.com
#####################################################
QQ群:150181442
#####################################################
使用cobbler批量安装linux系统
第一 cobber 简介
Cobbler 可使用 kickstart 模板。基于 Red Hat 或 Fedora 的系统使用 kickstart 文件来自动化安装流程。通过使用模板,您就会拥有基本的 kickstart 模板,然后定义如何针对一种配置文件或机器配置而替换其中的变量。例如,一个模板可能包含两个变量 $domain和 $machine_name。在 Cobbler 配置中,一个配置文件指定domain=mydomain.com,并且每台使用该配置文件的机器在machine_name变量中指定其名称。该配置文件中的所有机器都使用相同的kickstart 安装且针对 domain=mydomain.com 进行配置,但每台机器拥有其自己的机器名称。您仍然可以使用 kickstart 模板在不同的域中安装其他机器并使用不同的机器名称。
工作原理:
Server端:
第一步,启动Cobbler服务
第二步,进行Cobbler错误检查,执行cobbler check命令
第三步,进行配置同步,执行cobblersync命令
第四步,复制相关启动文件文件到TFTP目录中
第五步,启动DHCP服务,提供地址分配
第六步,DHCP服务分配IP地址
第七步,TFTP传输启动文件
第八步,Server端接收安装信息
第九步,Server端发送ISO镜像与Kickstart文件
Client端:
第一步,客户端以PXE模式启动
第二步,客户端获取IP地址
第三步,通过TFTP服务器获取启动文件
第四步,进入Cobbler安装选择界面
第五步,客户端确定加载信息
第六步,根据配置信息准备安装系统
第七步,加载Kickstart文件
第八步,传输系统安装的其它文件
第九步,进行安装系统
第二选择yum源
2.1 选择 epel源
Centos5 32位: rpm -Uvhhttp://mirrors.ustc.edu.cn/fedora/epel/5/i386/epel-release-5-4.noarch.rpmCentos5 64位: rpm -Uvhhttp://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
Centos6 32位: rpm -Uvh'http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-7.noarch.rpm'
Centos6 64位: rpm -Uvh 'http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
2.2 下载安装yum源
[root@localhost src]# wgethttp://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm--2015-06-2910:13:48-- http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
Resolvingmirrors.ustc.edu.cn... 202.141.176.110, 2001:da8:d800:95::110
Connecting tomirrors.ustc.edu.cn|202.141.176.110|:80... connected.
HTTP requestsent, awaiting response... 200 OK
Length: 12232(12K) [application/x-redhat-package-manager]
Saving to:`epel-release-5-4.noarch.rpm'
100%[====================================================================================================>]12,232 --.-K/s in 0.02s
2015-06-2910:13:52 (484 KB/s) - `epel-release-5-4.noarch.rpm' saved [12232/12232]
[root@localhostsrc]# ls
epel-release-5-4.noarch.rpm
[root@localhostsrc]# rpm -ivh epel-release-5-4.noarch.rpm
warning:epel-release-5-4.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ###########################################[100%]
1:epel-release ########################################### [100%]
[root@localhostsrc]#
2.3 安装cobber
安装软件 yum install cobbler tftptftp-server xinetd dhcp httpd rsync 安装cobbler[root@localhostsrc]# yum install pykickstart debmirror python-ctypes cman -y 安装cobbler所需的软件包
2.4 配置cobbler
2.4.1 设置httpd服务
[root@localhostsrc]# cat /etc/httpd/conf.d/wsgi.conf# NOTE:mod_wsgi can not coexist in the same apache process as
#mod_wsgi_python3. Only load ifmod_wsgi_python3 is not
# alreadyloaded.
<IfModule!wsgi_module>
LoadModulewsgi_module modules/mod_wsgi.so # 取消前面的注释
</IfModule>
[root@localhostsrc]# /etc/init.d/httpd restart
Stoppinghttpd: [FAILED]
Startinghttpd: [ OK ]
[root@localhostsrc]# chkconfig httpd on
2.4.2 设置tftp
[root@localhostsrc]# cat /etc/cobbler/tftpd.template# default:off
#description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to bootdiskless \
# workstations, download configuration filesto network-aware printers, \
# and to start the installation processfor some operating systems.
service tftp
{
disable = no ##将no改为no
socket_type = dgram
protocol = udp
wait = yes
user = $user
server = $binary
server_args = -B 1380 -v -s $args
per_source = 11
cps = 100 2
flags = IPv4
}
[root@localhostsrc]# cat /etc/xinetd.d/rsync
# default:off
#description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no ##将yes改为no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
[root@localhostsrc]# /etc/init.d/xinetd start
[root@localhostsrc]# vim /etc/debmirror.conf
注释
#@dists="sid";
#@arches="i386";
2.4.3 创建用户密码
[root@localhostsrc]# openssl passwd -1 -salt 'osyunwei' '123456'$1$osyunwei$sEV8iwXXuR4CqzLXyLnzm
修改 vim /etc/cobber/settings
default_kickstart:/var/lib/cobbler/kickstarts/default.ks
default_password_crypted:"$1$osyunwei$sEV8iwXXuR4CqzLXyLnzm0"
manage_dhcp:1
next_server:192.168.209.128
server:192.168.209.128
2.4.4 搭建dhcp服务
[root@localhost~]# grep -v "#" /etc/cobbler/dhcp.templateddns-update-styleinterim;
allowbooting;
allow bootp;
ignoreclient-updates;
setvendorclass = option vendor-class-identifier;
optionpxe-system-type code 93 = unsigned integer 16;
subnet192.168.209.0 netmask 255.255.255.0 {
option routers 192.168.209.1;
option domain-name-servers8.8.8.8,8.8.4.4;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.209.100 192.168.209.254;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
[root@localhostks_mirror]# cat /etc/sysconfig/dhcpd
# Commandline options here
DHCPDARGS=eth0
启动dhcp 使用cobber sync 就可以启动dhcp
同步cobber sync 就可以加载dhcp服务启动了
确保这些服务都开启就可以进行测试安装了,
/etc/init.d/xinted start
/etc/init.d/httpd start
/etc/init.d/cobberstart
2.4.5 创建镜像站点
挂载映像文件到httpd的站点目录mkdir -p/var/www/html/os/centos_x64_x86
mount/dev/cdrom /media/
rsync -avP /media/* /var/www/html/os/centos_x64_x86/
使用rsync或者scp
cobblerimport --path=/var/www/html/os/centos_x64_x86/ --name=centos_x64_x86 --arch=x86_64
导入镜像的命令参数
命令格式:cobbler import --path=镜像路径 -- name=安装引导名 --arch=32位或64位,重复上面的操作,把其他的系统镜像文件导入到cobber中,
cobblerdistro list 列出已经安装镜像
2.4.6 创建自动化安装脚本
创建自动化安装脚本进入到kickstarts 模板目录
cd/var/lib/cobbler/kickstarts
[root@localhostkickstarts]# ls
default.ks legacy.ks sample_end.ks sample_esxi5.ks sample.seed
esxi4-ks.cfg pxerescue.ks sample_esx4.ks sample.ks
esxi5-ks.cfg sample_autoyast.xml sample_esxi4.ks sample_old.seed
/etc/init.d/cobblerdrestart
2.3 测试
在这里就可以测试pxe引导安装了安装kickstart
yum install system-config-kickstart
yumgroupinstall "X Window System"
startx 进入到图形界面生成ks.cf 文件
system-config-kickstart运行生成ks.cf 文件
修改文件名称添加到cobber 中
[root@localhost~]# cobbler profile add --name=centos_x64-x86_64 --distro=centos_x64-x86_64--kickstart=/var/lib/cobbler/kickstarts/cenots5.8_x86_64.cfg
exception onserver: "it seems unwise to overwrite this object, try 'edit'"
添加文件的命令参数
命令:cobbler profile add|edit|remove --name=安装引导名 --distro=系统镜像名--kickstart=kickstart自动安装文件路径
--name:自定义的安装引导名,注意不能重复
--distro:系统安装镜像名,用cobbler distro list可以查看
--kickstart:与系统镜像文件相关联的kickstart自动安装文件
2.4 cobbler 帮助
[root@localhost ~]# man cobbler 查看cobbler帮助cobbler list
cobblerreport
cobblerprofile report
cobblerdistro list
[root@localhost~]# cobbler list
distros:
centos_x64-x86_64
centos_x64-xen-x86_64
profiles:
centos_x64-x86_64
centos_x64-xen-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
[root@localhost~]# cobbler distro list
centos_x64-x86_64
centos_x64-xen-x86_64
[root@localhost~]#
相关文章推荐
- linux的hostname修改详解
- window中使用ftp连接linux
- linux进程的用户ID
- linux slub分配器浅析
- linux ftp命令使用
- Linux命令
- linux 多线程一篇挺好的文章(包括参数处理)
- Linux进程管理
- linux解压文件
- CentOS6.3挂载读写NTFS分区
- usermod -g和gpasswd -a的区别
- sync_binlog
- phpStudy for Linux (lnmp+lamp一键安装包) 符合國內
- Win7系统安装Centos7.0双系统(一)
- 设置linux发送email(非sendmail)
- 将mysql数据从Windows迁移到Linux中
- Linux主流桌面环境简单介绍
- Linux命令学习
- Linux解决:svn: Can't connect to host '*.*.*.*': 因为连接的方没有正确回答或连接在以后的时间
- Linux系统下tar命令进行压缩时的绝对路径问题