自动化-cobbler

Posted 赵SIR

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自动化-cobbler相关的知识,希望对你有一定的参考价值。

cobbler功能

安装环境
centos7

安装步骤[

root@cabbler ~]# systemctl stop firewalld.service

[root@cabbler yum.repos.d]# rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm   安装epel源

 yum install -y httpd dhcp tftp  cobbler 安装包

 [root@cabbler yum.repos.d]# systemctl start httpd

[root@cabbler yum.repos.d]# systemctl start cobblerd

[root@cabbler yum.repos.d]# cobbler check   ##安装他需要装的东西以及【配置】

[root@cabbler yum.repos.d]# cobbler get-loaders

[root@cabbler ~]# yum install xinetd -y

[root@cabbler ~]# openssl passwd -1 -salt \'123456\' \'123456\'     ############配置一个初始的默认密码

$1$123456$wOSEtcyiP2N/IfIl15W6Z0

[root@cabbler ~]# vi /etc/cobbler/settings 修改配置文件

101 default_password_crypted: "$1$123456$wOSEtcyiP2N/IfIl15W6Z0"    ##########把密码放到这

第384 改成cobbler服务器IP     384行 修改 server: 10.0.0.61

第272行   272行修改  next_server: 10.0.0.61

[root@cabbler ~]# vim /etc/xinetd.d/tftp    改成  disable                 = no

[root@cabbler ~]# systemctl start rsyncd

[root@cabbler ~]# systemctl restart xinetd

[root@cabbler ~]# systemctl enable rsyncd

[root@cabbler ~]# yum install pykickstart -y

配置dhcp

[root@cabbler /]# vim /etc/cobbler/settings

manage_dhcp: 1  改成1 启用

[root@cabbler /]# vim /etc/cobbler/dhcp.template    配置路由以及地址段

     option routers             192.168.1.1;
     option domain-name-servers 192.168.1.1;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.1.200 192.168.1.254;

[root@cabbler /]# cobbler sync   ###改cobbler配置文件就要同步

挂载个镜像挂载到/mnt/centos7下

 [root@cabbler /]# cobbler import --path=/mnt/centos7/ --name=centos7 --arch=x86_64   #### 找到挂载的镜像,起个名字,指定是多少位

[root@cabbler kickstarts]# cd /var/lib/cobbler/kickstarts

[root@cabbler kickstarts]# vim centos7_cobbler.cfg

#obbler for Kickstart Configurator for CentOS 7 by zhao 
install
url --url=$tree  
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader --location=mbr 
# Network information
$SNIPPET(\'network_config\')
timezone --utc Asia/Shanghai
rootpw  --iscrypted $default_password_crypted
clearpart --all --initlabel
part /boot --fstype xfs --size 1024 
part swap --size 1024 
part / --fstype xfs --size 1 --grow 
auth --useshadow --enablemd5
reboot
firstboot --disable
selinux --disabled
logging --level=info
skipx
%pre
$SNIPPET(\'log_ks_pre\')
$SNIPPET(\'kickstart_start\')
$SNIPPET(\'pre_install_network_config\')
# Enable installation monitoring
$SNIPPET(\'pre_anamon\')
%end
%packages
@base
@compat-libraries
@debugging
@development
tree
nmap
sysstat
lrzsz
dos2unix
telnet
iptraf
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
screen
%end
%post
systemctl disable postfix.service
%end

 [root@cabbler kickstarts]# cobbler profile list
   centos7-x86_64
[root@cabbler kickstarts]# cobbler profile edit --name centos7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7_cobbler.cfg  ###修改参数

[root@cabbler kickstarts]# cobbler profile edit --name centos7-x86_64 --kopts=\'net.ifnames=0 biosdevname=0\'    ##更改网卡参数变成eth0

[root@cabbler kickstarts]# cobbler sync   ##时刻注意同步

[root@cobbler ~]# yum install cobbler-web -y  ###安装cobblerweb

[root@cobbler ~]# systemctl restart httpd

https://192.168.1.102/cobbler_web     #######输入账号密码  

 [root@cobbler ~]# vim /etc/cobbler/users.conf   ##账号文件

[root@cobbler ~]# vim /etc/cobbler/users.digest    ####密码文件

[root@cobbler ~]# htdigest /etc/cobbler/users.digest "Cobbler" cobbler  输入账号密码

[root@cobbler config]# cobbler repo add --name=Centos-7 --mirror=https://mirrors.aliyun.com/epel/7Server/x86_64/ --arch=x86_64 --breed=yum   ####创建YUM仓库   指定名字-----路径-------X86_64架构#

[root@cobbler config]# cobbler reposync  #####自动下载镜像并自动构建仓库

 [root@cobbler cobbler]# cobbler system add --name=linux-node1 --mac=00:50:56:3D:CB:D7 \\ --profile=centos7-x86_64 \\ --ip-address=10.0.0.11 --subnet=255.255.255.0 \\ --gateway=10.0.0.1 --interface=eth0 \\ --static=1 --hostname=linux-node1.example.com \\ --name-servers="114.114.114.114 8.8.8.8" \\ --kickstart=/var/lib/cobbler/kickstarts/centos7_cobbler.cfg  ##通过MAC指定安装

[root@cobbler cobbler]# yum install -y koan         ###重新安装系统需要安装koan   需要EPEL源

[root@cobbler cobbler]# koan --server=192.168.1.102 --list=profiles

[root@cobbler config]# koan --replace-self --server=192.168.1.102 --profile=centos7-x86_64               指定安装

以上是关于自动化-cobbler的主要内容,如果未能解决你的问题,请参考以下文章

运维自动化之Cobbler系统安装使用详解

cobbler自动安装linux

自动化运维平台之系统自动化安装Cobbler系统使用详解

自动化运维装机平台

cobbler自动化安装平台

cobbler自动化安装操作系统