Linux中cobbler自动化装机

自动化运维体系链:
一、cobbler实现自动装机
二、saltstack实现工程自动化配置
三、kubernetes实现容器自动化编排
四、zabbix实现自动化监控
五、elastic实现应用日志自动化收集
六、jenkins实现开发持续化交付
 
cobbler简介
Cobbler经过将设置和管理一个安装服务器所涉及的任务集中在一块儿,从而简化了系统配置。至关于Cobbler封装了DHCP、TFTP、XINTED等服务,结合了PXE、kickstart等安装方法,能够实现自动化安装操做系统,而且能够同时提供多种版本,以实如今线安装不一样版本的系统。
 
 
数据库保存了那些信息:
1.用户评论
2.保存了网页链接信息
3.保存了网页文章
4.保存了网页文章的分类信息
5.用户注册信息
6. 其余的一些组件信息
 
那些没被保存的数据库信息
1.图片
2.视频
 
 
 
 
系统环境准备及其下载cobbler
 
一.准备系统环境
服务器开启网卡。仅主机模式或者NAT模式,(不要选桥接模式)主机模式对内提供cobbler服务。
 
 
部署cobbler服务器:
 
1.准备环境
 
 
2.配置yum源
   [root@ken ~]#vim /etc/yum.repos.d/*.repo(原基础上添加)
    [epel]
    name=epel
    enabled=1
    gpgcheck=0
 
    [centos]
    name=centos base
    enabled=1
    gpgcheck=0
 
3.下载相关的软件
[root@ken ~]# yum install httpd cobbler tftp-server xinetd syslinux dhcp pykickstart -y
(pykickstart可下可不下,到后边会要要求下,尽可能提早下)
 
 
4.启动tftp服务
[root@ken ~]# vim /etc/xinetd.d/tftp(是将文件中的信息进行修改)
disable = no
[root@ken ~]# systemctl restart xinetd
 
 
5.配置dhcp服务
[root@ken ~]# vim /etc/dhcp/dhcpd.conf
打开以后在末行输入 :r /usr/share/doc/dhcp*/dhcpd.conf.example
打开这个软件进行配置
subnet 192.168.221.0 netmask 255.255.255.0 {
  range 192.168.221.10 192.168.221.20;(本身用的ip,不要出如今本身配置的网段里)
  default-lease-time 600;
  max-lease-time 7200;
  filename "pxelinux.0";(在最后一行添加)
}
[root@ken ~]# systemctl restart dhcpd
 
 
6.重启httpd
[root@ken ~]# systemctl restart httpd
 
 
7. 启动cobbler
[root@ken ~]# systemctl restart cobblerd
 
 
8.cobbler检测
[root@ken ~]# cobbler check
 
 
9.修改cobbler文件
[root@ken ~]# cobbler check
1 : The ‘server’ field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
[root@ken ~]# vim  /etc/cobbler/settings  (进去修改server)
把server指定的本地IP改成提供cobbler服务的IP地址
 
2 : For PXE to be functional, the ‘next_server’ field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
[root@ken ~]# vim  /etc/cobbler/settings  (进去修改next_server)
把next_server指定的本地IP改成提供cobbler服务的IP地址
 
4 : enable and start rsyncd.service with systemctl(启动同步服务)
[root@ken ~]# systemctl restart rsyncd
[root@ken ~]# systemctl enable rsyncd
 
6 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to ‘cobbler’ and should be changed, try: “openssl passwd -1 -salt ‘random-phrase-here’ ‘your-password-here'” to generate new one
[root@ken ~]# openssl passwd -1 -salt ‘123’ ‘123’(设置密码,生成一个随机数)
$1$123$nE5gIYTYiF1PIXVOFjQaW/
[root@ken ~]# vim  /etc/cobbler/settings(把密码放进去,找default_password_crypted)
而后把密码粘贴过去
 
 
 
10. 重启cobbler并在此检测
[root@ken ~]# systemctl restart cobblerd
[root@ken ~]# cobbler check(重启以后只有三个文件)
The following are potential configuration items that you may want to fix:
1 : Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run ‘cobbler get-loaders’ to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The ‘cobbler get-loaders’ command is the easiest way to resolve these requirements.
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
3 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run ‘cobbler sync’ to apply changes.
 
 
 
11.同步
[root@ken ~]# cobbler sync
 
 
12.导入镜像
[root@ken ~]# mount  /dev/cdrom  /mnt
[root@ken ~]# cobbler import --path=/mnt --name=”centos7″
 
 
13.查看生成的distro
[root@ken ~]# cobbler distro list
centos7-x86_64
 
 
14.查看生成的profile
[root@ken ~]# cobbler profile list
centos7-x86_64
 
 
15.准备kickstart文件
[root@ken ~]# cp anaconda-ks.cfg /var/lib/cobbler/kickstarts/ks.cfg
 
 
16.编辑kickstart文件
[root@ken ~]# vim  /var/lib/cobbler/kickstarts/ks.cfg(在文件的第五行进行修改)
 
 
17.制做本身的profile
[root@ken ~]# cobbler profile add --distro=centos7-x86_64 –kickstart=/var/lib/cobbler/kickstarts/ks.cfg --name=”cent7_pan”
 
 
18. 删除默认的profile
[root@ken ~]# cobbler profile remove --name=centos7-x86_64
[root@ken ~]# cobbler profile list
cent7_pan
 
 
19.开启客户端进行验证
注意:
1.客户端模式须要与服务器模式一致
2. 内存最少3个G
 
 
安装cobbler错误集锦:
若是cobbler检测出现如下问题:
xmlrpclib.Fault: <Fault 1: "cobbler.cexceptions.CX:'login failed'">
查看导入列表,若是报以下内容,须要重启cobbler,并执行cobbler get-loaders.
[root@master src]# service cobblerd restart 
[root@master src]# cobbler get-loaders
相关文章
相关标签/搜索