cobbler自定义安装Centos-7.2

一、安装两台虚拟机

1.要求:

第一台:

主机ip-----10.0.0.135
主机名-----cobbler-test-01
子网掩码-----255.255.255.0
网关-----10.0.0.2

dns-----10.0.0.2


第二台:

主机ip-----10.0.0.136
主机名-----cobbler-test-02
子网掩码-----255.255.255.0
网关-----10.0.0.2
dns-----10.0.0.2
2.新建两台虚拟机,获取mac地址



cobbler-test-01 mac地址--------00:50:56:34:4E:88

cobbler-test-02 mac地址--------00:50:56:28:FD:98


扫描二维码关注公众号,回复: 1581278 查看本文章





3.cobbler配置系统信息(这里使用的是前面配置好的centos-7.2iso)


cobbler-test-01:

[root@liang ~]# cobbler system add --name=cobbler-test-01 \
--mac=00:50:56:34:4E:88 --profile=Centos-7.2-x86_64 \
--ip-address=10.0.0.135 --subnet=255.255.255.0 --gateway=10.0.0.2 \
--interface=eth0 --static=1 --hostname=cobbler-test-01 \
--name-servers="10.0.0.2" 


cobbler-test-02:
[root@liang ~]# cobbler system add --name=cobbler-test-02 \
--mac=00:50:56:28:FD:98 --profile=Centos-7.2-x86_64 \
--ip-address=10.0.0.136 --subnet=255.255.255.0 --gateway=10.0.0.2 \
--interface=eth0 --static=1 --hostname=cobbler-test-02 \
--name-servers="10.0.0.2" 

4.查看配置的系统列表

[root@liang ~]# cobbler system list
   cobbler-test-01
   cobbler-test-02

5.修改ks.cfg文件,增加内容(否则会出错)

%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
#Enable installation monitoring
$SNIPPET('pre_anamon')
%end

6.同步

 [root@liang ~]# cobbler sync

7.开启虚拟机测试

7.1全部自动化,不需要选择



7.2安装完成后,查看虚拟机信息





8.ks文件内容

[root@liang ~]# cat /var/lib/cobbler/kickstarts/ks.cfg 
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
#rootpw --iscrypted $1$eSOV7j.U$/8fVRwXLfG7WvjJ8hb1kU.
rootpw --iscrypted $default_password_crypted
# System timezone
timezone Asia/Shanghai
# Use network installation
#url --url="http://10.0.0.134/Centos-7.2/"
url --url=$tree
# System language
lang en_US
# Firewall configuration
firewall --disabled
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --disabled


# Network information
#network  --bootproto=dhcp --device=eth0
$SNIPPET('network_config')
# Reboot after installation
reboot
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="xfs" --size=200
part swap --fstype="swap" --size=4096
part / --fstype="xfs" --grow --size=1
#cobbler自动执行的脚本
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
#Enable installation monitoring
$SNIPPET('pre_anamon')
%end
#最小化安装
%packages --nobase 


@core 


%end

猜你喜欢

转载自blog.csdn.net/liang_operations/article/details/80640500