码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS 7搭建Cobbler批量自动安装系统

时间:2018-03-20 18:05:38      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:枫雨

1.简介

1.1Cobbler

  linux系统安装服务,可以通过网络启动(PXE)方式快速安装、重装物理服务器和虚拟机,同时管理DNS、DHCP等。既可以使命令行方式管理,也可以给予web界面管理工具。同时提供API接口,可以方便二次开发使用,是较早的kickstart的升级版,比较容易配置,自带web界面比较易于管理。


2.环境准备

[root@CentOS 7 ~]# cat /etc/redhat-release 

CentOS Linux release 7.2.1511 (Core) 

[root@CentOS 7 ~]# uname -r

3.10.0-327.el7.x86_64

[root@CentOS 7 ~]# getenforce 

Disabled

[root@CentOS 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)

[root@CentOS 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安装相关服务

[root@CentOS 7 ~]# yum install -y cobbler cobbler-web dhcp tftp-server pykickstart httpd python-django


3.3修改/etc/cobbler/settings中的server项

[root@CentOS 7 ~]# sed -i 's#server: 127.0.0.1#server: 172.16.1.201#' /etc/cobbler/settings


3.4修改/etc/cobbler/settings中的next_server项

[root@CentOS 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修改密码

[root@CentOS 7 ~]# sed -ri "/default_password_crypted/s#(.*: ).*#\1\"`openssl passwd -1 -salt 'fengyu' '123456'`\"#" /etc/cobbler/settings


3.7配置Cobbler统一管理DHCP

root@CentOS 7 ~]# sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings


3.8防止误重装

[root@CentOS 7 ~]# sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings


3.9配置DHCP Cobbler模板

[root@CentOS 7 ~]# sed -i.ori 's#192.168.1#172.16.1#g;22d;23d' /etc/cobbler/dhcp.template


3.10启动相关服务

[root@CentOS 7 ~]# systemctl start rsyncd

[root@CentOS 7 ~]# systemctl start tftp.socket

[root@CentOS 7 ~]# systemctl start cobblerd.service

[root@CentOS 7 ~]# cobbler sync


4.web界面操作


4.1浏览器访问https://10.0.0.201/cobbler_web

技术分享图片


CentOS 7搭建Cobbler批量自动安装系统

标签:枫雨

原文地址:http://blog.51cto.com/13520761/2089048

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!