标签:批量安装
1.系统环境2.安装Cobbler
[root@localhost ~]# yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd
[root@localhost ~]# rpm -ql cobbler # 查看安装的文件,下面列出部分。
/etc/cobbler # 配置文件目录
/etc/cobbler/settings # cobbler主配置文件,这个文件是YAML格式,Cobbler是python写的程序。
/etc/cobbler/dhcp.template # DHCP服务的配置模板
/etc/cobbler/tftpd.template # tftp服务的配置模板
/etc/cobbler/rsync.template # rsync服务的配置模板
/etc/cobbler/iso # iso模板配置文件目录
/etc/cobbler/pxe # pxe模板文件目录
/etc/cobbler/power # 电源的配置文件目录
/etc/cobbler/users.conf # Web服务授权配置文件
/etc/cobbler/users.digest # 用于web访问的用户名密码配置文件
/etc/cobbler/dnsmasq.template # DNS服务的配置模板
/etc/cobbler/modules.conf # Cobbler模块配置文件
/var/lib/cobbler # Cobbler数据目录
/var/lib/cobbler/config # 配置文件
/var/lib/cobbler/kickstarts # 默认存放kickstart文件
/var/lib/cobbler/loaders # 存放的各种引导程序
/var/www/cobbler # 系统安装镜像目录
/var/www/cobbler/ks_mirror # 导入的系统镜像列表
/var/www/cobbler/images # 导入的系统镜像启动文件
/var/www/cobbler/repo_mirror # yum源存储目录
/var/log/cobbler # 日志目录
/var/log/cobbler/install.log # 客户端系统安装日志
/var/log/cobbler/cobbler.log # cobbler日志
1.3 配置Cobbler
[root@localhost ~]# cobbler check
cp /etc/cobbler/settings{,.ori} #备份
sed -i ‘s/server: 127.0.0.1/server: 192.168.252.130/‘ /etc/cobbler/settings #服务端IP
sed -i ‘s/next_server: 127.0.0.1/next_server: 192.168.252.130/‘ /etc/cobbler/settings #服务端IP
sed -i ‘s/manage_dhcp: 0/manage_dhcp: 1/‘ /etc/cobbler/settings #dhcp只获取一次
sed -i ‘s/pxe_just_once: 0/pxe_just_once: 1/‘ /etc/cobbler/settings #cobbler只执行一遍
sed -ri "/default_password_crypted/s#(.*: ).*#\1\"`openssl passwd -1 -salt ‘admin‘ ‘123456‘`\"#" /etc/cobbler/settings #设置密码为123456
sed -i ‘s#yes#no#‘ /etc/xinetd.d/rsync #xinet 管理rsync
sed -i ‘s#yes#no#‘ /etc/xinetd.d/tftp #xinet 管理tftp
cobbler get-loaders #下载
sed -i ‘s#192.168.1#192.168.252#g;22d;23d‘ /etc/cobbler/dhcp.template # 修改dhcp配置文件
cobbler sync #写入磁盘
/etc/init.d/xinetd restart #启动三个必须启动的服务。详情请看kickstart
/etc/init.d/cobblerd restart
/etc/init.d/httpd restart
cobbler sync # 同步
挂载光盘:
[root@localhost ~]# mount /dev/cdrom /mnt/
制作镜像导入到 cobbler
[root@localhost ~]# cobbler import --path=/mnt/ --name=CentOS-6-x86_64 --arch=x86_64
--path= 路径
--name=名称
--arch=系统位数32 or 64
导入的位置
[root@localhost ks_mirror]# pwd
/var/www/cobbler/ks_mirror
[root@localhost ks_mirror]# ls
CentOS-7-x86_64 config
查看 cobbler命令
[root@localhost /]# cobbler profile
usage
=====
cobbler profile add
cobbler profile copy
cobbler profile dumpvars
cobbler profile edit
cobbler profile find
cobbler profile getks
cobbler profile list
cobbler profile remove
cobbler profile rename
cobbler profile report
查看镜像
[root@localhost /]# cobbler profile list
CentOS-6-x86_64
查看系统详细信息
[root@localhost /]# cobbler profile report
kickstarts文件放在/var/lib/cobbler/kickstarts下面
[root@localhost ~]# cd /var/lib/cobbler/kickstarts/
[root@localhost kickstarts]# rz -
自定义kickstarts文件
我们使用cobbler profile report命令看到Kickstart默认在/var/lib/cobbler/kickstarts/sample_end.ks
我们直接使用命令进行修改,我们修改6的kickstarts
[root@localhost /]# cobbler profile edit --name=CentOS-6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-6-x86_64.cfg
同步配置
[root@localhost /]# cobbler sync
CentOS-6.8-x86_64.cfg 配置文件
install
url --url=$tree
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
$SNIPPET(‘network_config‘)
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=123456
rootpw --iscrypted $123456
clearpart --all --initlabel
part /boot --fstype=ext4 --asprimary --size=200
part swap --size=1024
part / --fstype=ext4 --grow --asprimary --size=200
firstboot --disable
selinux --disabled
firewall --disabled
logging --level=info
reboot
%pre
$SNIPPET(‘log_ks_pre‘)
$SNIPPET(‘kickstart_start‘)
$SNIPPET(‘pre_install_network_config‘)
# Enable installation monitoring
$SNIPPET(‘pre_anamon‘)
%end
%packages
@base
@compat-libraries
@debugging
@development
tree
nmap
sysstat
lrzsz
dos2unix
telnet
%end
%post --nochroot
$SNIPPET(‘log_ks_post_nochroot‘)
%end
%post
$SNIPPET(‘log_ks_post‘)
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET(‘post_install_kernel_options‘)
$SNIPPET(‘post_install_network_config‘)
$SNIPPET(‘func_register_if_enabled‘)
$SNIPPET(‘download_config_files‘)
$SNIPPET(‘koan_environment‘)
$SNIPPET(‘redhat_register‘)
$SNIPPET(‘cobbler_register‘)
# Enable post-install boot notification
$SNIPPET(‘post_anamon‘)
# Start final steps
$SNIPPET(‘kickstart_done‘)
# End final steps
%end
标签:批量安装
原文地址:http://blog.51cto.com/zailushang/2104948