基于cobbler实现自动安装系统
说明:安装cobbler、dhcp、tftp的虚拟机两块网卡eth0:10.220.5.117(桥接)用于连接xshell,eth1:192.168.100.86(vmnet3)作为自动安装系统的服务器使用。
一、安装配置cobbler
cobbler安装和基本配置
二、安装配置dhcp
1.安装dhcp
[root@BIGboss ~]# yum install dhcp dhcp-common -y2.配置dhcp
root@BIGboss ~]# vim /etc/dhcp/dhcpd.conf【只需要如下内容,其他的都可以删除】 option domain-name "example.org"; option domain-name-servers ns1.example.org, ns2.example.org; default-lease-time 600; max-lease-time 7200; log-facility local7; subnet 192.168.100.0 netmask 255.255.255.0 {range 192.168.100.200 192.168.100.220;option routers 192.168.100.86;option domain-name-servers 8.8.8.8;filename "pxelinux.0"; }3.重启dhcp
[root@BIGboss ~]# service dhcpd restart三、安装配置tftp
1.安装
[root@BIGboss ~]# yum install tftp tftp-server xinetd -y2.启动
[root@BIGboss ~]# service xinetd restart [root@BIGboss ~]# chkconfig xinetd on [root@BIGboss ~]# chkconfig tftp on [root@BIGboss ~]# chkconfig --list | grep tftptftp: on四、以导入的方式创建repo
1.挂在光盘
[root@BIGboss ~]# mount /dev/cdrom /mnt/2.在cobbler中导入镜像数据
[root@BIGboss ~]# cobbler import --path=/mnt/ --name=centos6.7_x86-64导入需要一定时间耐心等待一下
3.执行一次sync
[root@BIGboss ~]# cobbler sync五、创建repo和distro
导入了镜像会自动生成与之对应的profile和distro
[root@BIGboss ~]# cobbler distro listcentos6.7-64-x86_64 [root@BIGboss ~]# cobbler profile listcentos6.7-64-x86_64补充:
1.导入镜像就是将镜像中的文件复制到/var/www/cobbler/ks_mirror/centos6.7_x86-64/
2.安装了cobbler之后,会自动生成一个apache的子配置文件cobbler.conf,用于将上面的目录发布出去,在这个文件中定义了别名,实现可以通过http://ip/cobbler就可以访问cobble的镜像资源
测试所导入的镜像
通过浏览器访问:http://10.220.5.117/cobbler
六、准备kickstart文件
1.ks1.cfg
此时安装树文件所在位置http://192.168.100.86/cobbler/ks_mirror/centos6.7_x86-64/
所以应该把ks1.cfg模板中的url --url=http://192.168.100.85/installtree/
改为http://192.168.100.86/cobbler/ks_mirror/centos6.7_x86-64/
2.将ks文件放在规定的位置
[root@BIGboss ~]# mv ks1.cfg /var/lib/cobbler/kickstarts/七、创建profile
1.创建profile
[root@BIGboss ~]# cobbler distro listcentos6.7-64-x86_64 [root@BIGboss ~]# cobbler profile add --distro=centos6.7-64-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks1.cfg --name=profile_for_centos62.执行一次sync
[root@BIGboss ~]# cobbler sync八、测试
新开一台虚拟机,设置网络连接为vmnet3,开机就会自动安装系统了
《新程序员》:云原生和全面数字化实践50位技术专家共同创作,文字、视频、音频交互阅读总结
以上是生活随笔为你收集整理的基于cobbler实现自动安装系统的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: cobbler安装和基本配置
- 下一篇: ssh实现基于密钥方式登录系统