cobbler batch installed

Cobbler Introduction

  • Cobbler is a Linux installation server service, you can start (PXE) way through the network to quickly install, reinstall the physical servers and virtual machines, while also managing DHCP, DNS and so on.
  • Cobbler can use the command line management, but also provides a Web-based interface management tool (cobbler-web), also provides API interface, convenient secondary development.
  • Cobbler is an upgraded version of the earlier kickstart, the advantage is relatively easy to configure, also comes with a web interface is easy to manage.
  • Cobbler built a lightweight configuration management system, but it also supports other configuration management and system integration, such as Puppet, is not supported SaltStack.

1, the necessary components and mounting cobbler

[root@localhost ~]# yum install epel-release -y    ##安装epel源
[root@localhost ~]# yum install  -y \
> cobbler \      ##安装cobbler\
> cobbler-web \    ##网页形式管理
> dhcp \                ##地址分配服务 
> tftp-server \       ##放压缩和引导文件
> pykickstart \      ##Python开发的kickstart
> httpd \               ##网络服务
> rsync \              ##远程同步管理
> xinetd               ##管理平台

2, modify the cobbler's profile

[root@localhost ~]# cd /etc/cobbler/
[root@localhost cobbler]# vim settings  ##修改配置文件

next_server: 192.168.13.140     ##修改服务地址为本地
server: 192.168.13.140
manage_dhcp: 1    ##dhcp开启

[root@localhost cobbler]# systemctl start httpd.service      ##开启http服务
[root@localhost cobbler]# systemctl start cobblerd.service ##开启cobbler服务
[root@localhost cobbler]# systemctl stop firewalld.service  ##关闭防火墙
[root@localhost cobbler]# setenforce 0     ##关闭增强功能

3, optimization cobbler

[root@localhost cobbler]# cobbler check   ##cobbler检测需要优化项
##下面会列出需要优化的东西,根据优化项进项优化即可
[root@localhost cobbler]# vim /etc/xinetd.d/tftp  ##进行tftp优化

service tftp
{
                socket_type             = dgram
                protocol                = udp
                wait                    = yes
                user                    = root
                server                  = /usr/sbin/in.tftpd
                server_args             = -s /var/lib/tftpboot
                disable                 = no     ##此处yes改为no
                per_source              = 11
                cps                     = 100 2
                flags                   = IPv4
}

[root@localhost cobbler]# systemctl enable rsyncd.service  ##优化开启远程同步管理服务
[root@localhost cobbler]# openssl passwd -1 -salt 'abc123' 'abc123'  ##优化设置管理员密码

$1$abc123$9v8z2./E/PZihXrVcy3II0   ##复制此段是盐值加密过后的密文

[root@localhost cobbler]# vim /etc/cobbler/settings  ##修改配置文件
##查找default然后将加密的密文复制到此处
default_password_crypted: "$1$abc123$9v8z2./E/PZihXrVcy3II0"
[root@localhost cobbler]# systemctl start rsyncd.service   ##启动服务
[root@localhost cobbler]# systemctl restart xinetd.service 

4, the dhcp service

[root@localhost cobbler]# vim /etc/cobbler/dhcp.template  ##修改配置文件

subnet 192.168.13.0 netmask 255.255.255.0 {     ##修改网段
         option routers             192.168.13.1;                 ##网关
         option domain-name-servers 192.168.13.2;     ##dns地址
         option subnet-mask         255.255.255.0;
         range dynamic-bootp        192.168.13.100 192.168.13.200;  ##地址池

[root@localhost cobbler]# cobbler sync  ##同步生成DHCP配置文件(/etc/dhcp/dhcpd.conf)
[root@localhost cobbler]# systemctl restart dhcpd.service   ##启动dhcp服务
[root@localhost cobbler]# systemctl start cobblerd.service  ##启动cobbler服务
[root@localhost cobbler]# systemctl start xinetd.service      ##启动管理平台服务

5, the image file into ISO

Connect the image file, and mount to / mnt directory

[root@localhost cobbler]# mount /dev/cdrom /mnt   ##将镜像挂载到/mnt目录下
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost cobbler]# cd /mnt/   
[root@localhost mnt]# ls    ##查看镜像文件
CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7
EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7
EULA             isolinux  repodata  TRANS.TBL

Importing image file

[root@localhost mnt]# cobbler import --path=/mnt/ --name=Centos-7-x86_64 --arch=x86_64
##导入镜像文件指明路径,生成名字
[root@localhost mnt]# cd /var/www/cobbler/ks_mirror/   ##切换到cobbler目录下
[root@localhost ks_mirror]# ls
Centos-7-x86_64  config
[root@localhost ks_mirror]# cobbler list    ##查看文件信息
distros:
     Centos-7-x86_64

profiles:
     Centos-7-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

View compressed kernel and boot files

[root@localhost ks_mirror]# yum install tree -y   ##安装tree工具
[root@localhost ks_mirror]# tree /var/lib/tftpboot/images    ##查看压缩内核和引导文件
/var/lib/tftpboot/images
└── Centos-7-x86_64
        ├── initrd.img    ##引导文件
        └── vmlinuz      ##压缩内核

All restart the service

[root@localhost ks_mirror]# systemctl restart cobblerd.service 
[root@localhost ks_mirror]# systemctl restart dhcpd.service 
[root@localhost ks_mirror]# systemctl restart xinetd.service 
[root@localhost ks_mirror]# systemctl restart httpd.service 

6, the system does not create a virtual machine, open automatically installed system (character interface)

cobbler batch installed
cobbler batch installed

Install a graphical interface

代码:[root@localhost ~]#yum groupinstall "GNOME Desktop"
代码:[root@localhost ~]# yum groupinstall 'KDE Plasma Workspaces" -y
代码:[root@localhost ~]# yum groupinstall "X Window System" 或者"Graphical Administration Tools"

7, using the cobbler's web management

[root@localhost ks_mirror]# vim /etc/cobbler/modules.conf ##配置模块配置文件

module = authn_configfile  ##默认开启

[root@localhost ks_mirror]# htdigest -c /etc/cobbler/users.digest Cobbler adadmin ##创建用户密码
Adding password for adadmin in realm Cobbler.
New password:     ##输入密码
Re-type new password: 
[root@localhost ks_mirror]# systemctl restart cobblerd.service   ##重启cobbler服务
[root@localhost ks_mirror]# systemctl restart httpd.service         ##重启httpd服务

8, web access cobbler's web management

cobbler batch installed
cobbler batch installed

9, enable pam authentication, log on

[root@localhost ks_mirror]# vim /etc/cobbler/modules.conf   ##修改模块配置文件

[authentication]   
module = authn_pam    ##修改成pam认证模块

[authorization]
module = authz_ownership ##指定访问权限

[root@localhost ks_mirror]# useradd webuser  ##创建系统用户
[root@localhost ks_mirror]# passwd webuser   ##设置密码
更改用户 webuser 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。

[root@localhost ks_mirror]# vim /etc/cobbler/users.conf   ##修改cobbler下的users.conf文件

[admins]
admin = ""
cobbler = ""
webuser = ""    ##添加用户

[root@localhost ks_mirror]# systemctl restart httpd.service   ##重启服务
[root@localhost ks_mirror]# systemctl restart cobblerd.service 

10, web management login page

cobbler batch installed
cobbler batch installed

thanks for reading!

Guess you like

Origin blog.51cto.com/14469918/2449884