CentOS 7搭建Cobbler批量自动安装系统
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7搭建Cobbler批量自动安装系统相关的知识,希望对你有一定的参考价值。
1.简介
1.1Cobbler
linux系统安装服务,可以通过网络启动(PXE)方式快速安装、重装物理服务器和虚拟机,同时管理DNS、DHCP等。既可以使命令行方式管理,也可以给予web界面管理工具。同时提供API接口,可以方便二次开发使用,是较早的kickstart的升级版,比较容易配置,自带web界面比较易于管理。
2.环境准备
[[email protected] 7 ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[[email protected] 7 ~]# uname -r
3.10.0-327.el7.x86_64
[[email protected] 7 ~]# getenforce
Disabled
[[email protected] 7 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
[[email protected] 7 ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.201 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::20c:29ff:fe40:1a4e prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:40:1a:4e txqueuelen 1000 (Ethernet)
RX packets 684 bytes 133847 (130.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 198 bytes 24620 (24.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.1.201 netmask 255.255.255.0 broadcast 172.16.1.255
inet6 fe80::20c:29ff:fe40:1a58 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:40:1a:58 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10 bytes 744 (744.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
3.部署Cobbler服务
3.1添加yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
3.2安装相关服务
[[email protected] 7 ~]# yum install -y cobbler cobbler-web dhcp tftp-server pykickstart httpd python-django
3.3修改/etc/cobbler/settings中的server项
[[email protected] 7 ~]# sed -i 's#server: 127.0.0.1#server: 172.16.1.201#' /etc/cobbler/settings
3.4修改/etc/cobbler/settings中的next_server项
[[email protected] 7 ~]# sed -i 's/next_server: 127.0.0.1/next_server: 172.16.1.202/' /etc/cobbler/settings
3.5下载所有需要的网络启动文件(需要先启动cobbler服务,国外网站,下载速度巨慢,或者下载失败)
cobbler get-loaders
3.6修改密码
[[email protected] 7 ~]# sed -ri "/default_password_crypted/s#(.*: ).*#\1\"`openssl passwd -1 -salt 'fengyu' '123456'`\"#" /etc/cobbler/settings
3.7配置Cobbler统一管理DHCP
[email protected] 7 ~]# sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings
3.8防止误重装
[[email protected] 7 ~]# sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
3.9配置DHCP Cobbler模板
[[email protected] 7 ~]# sed -i.ori 's#192.168.1#172.16.1#g;22d;23d' /etc/cobbler/dhcp.template
3.10启动相关服务
[[email protected] 7 ~]# systemctl start rsyncd
[[email protected] 7 ~]# systemctl start tftp.socket
[[email protected] 7 ~]# systemctl start cobblerd.service
[[email protected] 7 ~]# cobbler sync
4.web界面操作
4.1浏览器访问https://10.0.0.201/cobbler_web
以上是关于CentOS 7搭建Cobbler批量自动安装系统的主要内容,如果未能解决你的问题,请参考以下文章
Centos6.7安装部署cobbler完成无人值守化安装部署
使用cobbler工具实现centos 6,7系统的自动化安装