标签:end 模板 algo and dom note repos ble mini
1.cobbler简介2.cobbler集成的服务:
PXE服务支持
DHCP服务管理
DNS服务管理(可选bind,dnsmasq)
电源管理
Kickstart服务支持
YUM仓库管理
TFTP(PXE启动时需要)
Apache(提供kickstart的安装源,并提供定制化的kickstart配置)
3.cobbler配置文件详解
cobbler配置文件目录在/etc/cobbler
/etc/cobbler/settings | cobbler主配置文件 |
---|---|
/etc/cobbler/iso | iso模板配置文件 |
/etc/cobbler/pxe | pxe模板配置文件 |
/etc/cobbler/power | 电源配置文件 |
/etc/cobbler/user.conf | web服务授权配置文件 |
/etc/cobbler/users.digest | web访问的用户名密码配置文件 |
/etc/cobbler/dhcp.template | dhcp服务器的配置模板 |
/etc/cobbler/dnsmasq.template | dns服务器的配置模板 |
/etc/cobbler/tftpd.template | tftp服务的配置模板 |
/etc/cobbler/modules.conf | 模块的配置文件 |
cobbler数据目录
目录 | 作用 |
---|---|
/var/lib/cobbler/config/ | 用于存放distros,system,profiles等信息配置文件 |
/var/lib/cobbler/triggers/ | 用于存放用户定义的cobbler命令 |
/var/lib/cobbler/kickstart/ | 默认存放kickstart文件 |
/var/lib/cobbler/loaders/ | 存放各种引导程序以及镜像目录 |
/var/lib/cobbler/ks_mirror/ | 导入的发行版系统的所有数据 |
/var/lib/cobbler/images | 导入发行版的kernel和initrd镜像用于远程网络启动 |
/var/www/cobbler/repo_mirror/ | yum仓库存储目录 |
cobbler日志文件
日志文件路径 | 说明 |
---|---|
/var/log/cobbler/installing | 客户端安装日志 |
/var/log/cobbler/cobbler.log | cobbler日志 |
4.cobbler命令详解
cobbler check //核对当前设置是否有问题
cobbler list //列出所有的cobbler元素
cobbler report //列出元素的详细信息
cobbler sync //同步配置到数据目录,更改配置最好都要执行下
cobbler reposync //同步yum仓库
cobbler distro //查看导入的发行版系统信息
cobbler system //查看添加的系统信息
cobbler profile //查看配置信息
5.cobbler服务端部署(演示)
环境 | ip |
---|---|
服务器端 | 192.168.209.12 |
*************************服务器做以下操作**************************8
//关闭防火墙以及selinux
[root@lanzhiyong ~]# systemctl disable firewalld
[root@lanzhiyong ~]# systemctl stop firewalld
[root@lanzhiyong ~]# sed -ri ‘s/^(SELINUX=).*/\1disabled/g‘ /etc/sysconfig/selinux
[root@lanzhiyong ~]# setenforce 0
//配置yum 源
[root@lanzhiyong ~]# cd /etc/yum.repos.d/
[root@lanzhiyong yum.repos.d]# curl -o 163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@lanzhiyong yum.repos.d]# sed -i ‘s/\$releasever/7/g‘ 163.repo
[root@lanzhiyong yum.repos.d]# sed -i ‘s/^enabled=.*/enabled=1/g‘ 163.repo
[root@lanzhiyong ~]# yum install -y epel-release
//安装cobbler以及相关软件
[root@lanzhiyong ~]# yum -y install httpd dhcp tftp python-ctypes cobbler xinetd cobbler-web pykickstart
//启动服务并设置开机自启
[root@lanzhiyong ~]# systemctl start httpd
[root@lanzhiyong ~]# systemctl enable httpd
[root@lanzhiyong ~]# systemctl start cobblerd
[root@lanzhiyong ~]# systemctl enable cobblerd
//修改server的ip地址为本机的ip
[root@lanzhiyong ~]# sed -i ‘s/^server: 127.0.0.1/server: 172.16.12.128/‘ /etc/cobbler/settings
//修改tftp的ip地址为本机ip
[root@lanzhiyong ~]# sed -i ‘s/^next_server: 127.0.0.1/next_server: 172.16.1 2.128/‘ /etc/cobbler/settings
//开启tftp
[root@lanzhiyong ~]# sed -i ‘/disable/s/yes/no/g‘ /etc/xinetd.d/tftp
//下载缺失文件
[root@lanzhiyong ~]# cobbler get-loaders
//启动rsync并设置开机自启
[root@lanzhiyong ~]# systemctl start rsyncd
[root@lanzhiyong ~]# systemctl enable rsyncd
//生成加密的密码
[root@lanzhiyong ~]# openssl passwd -1 -salt "$RANDOM" ‘lanzhiyong123!‘
$1$29572$Kgcy/Dq/5BIFjGXm8.Yfm/ //这是密码加密后的形式
//将生成的加密密码加入到配置文件
[root@lanzhiyong ~]# vim /etc/cobbler/settings
………………………… default_password_crypted: "$1$29572$Kgcy/Dq/5BIFjGXm8.Yfm/"
………………………………
//重启cobbler
[root@lanzhiyong ~]# systemctl restart cobblerd
[root@lanzhiyong ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 5 127.0.0.1:25151 *:*
LISTEN 0 5 *:873 *:*
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 128 :::443 :::*
LISTEN 0 5 :::873 :::*
//通过cobbler check 核对当前设置是否有问题
[root@lanzhiyong ~]# cobbler check
………………这处是两个关于debian系统的错误,请忽略
//这步重启
[root@lanzhiyong ~]# reboot
关闭防火墙*******************
//核对当前设置是否有问题
[root@lanzhiyong ~]# cobbler check
//配置cobbler dhcp 修改cobbler配置文件,让cobbler控制dhcp
[root@lanzhiyong ~]# sed -i ‘/^manage_dhcp/s/0/1/g‘ /etc/cobbler/settings
[root@lanzhiyong ~]# sed -n ‘/^manage_dhcp/p‘ /etc/cobbler/settings
manage_dhcp: 1
//配置dhcp
[root@lanzhiyong ~]# vim /etc/cobbler/dhcp.template
subnet 192.168.209.0 netmask 255.255.255.0 {
option routers 192.168.209.12;
option domain-name-servers 192.168.209.12;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.209.100 192.168.1.250;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
//重启服务并同步配置,改完dhcp必须要sync同步配置
[root@lanzhiyong ~]# systemctl restart cobblerd
[root@lanzhiyong ~]# cobbler sync
//检查dhcp是否正常
[root@lanzhiyong ~]# netstat -anulp | grep dhcp
udp 0 0 0.0.0.0:67 0.0.0.0:*
//导入Centos7镜像
[root@lanzhiyong ~]# mount /dev/cdrom /mnt/
[root@lanzhiyong ~]# cobbler import --path=/mnt --name=Centos-7 --arch=x86_64
//查看cobbler镜像列表
[root@lanzhiyong ~]# cobbler list
//创建kickstarts自动安装脚本
[root@lanzhiyong ~]# cat > /var/lib/cobbler/kickstarts/Centos-7-x86_64.ks <<‘EOF‘
auth --enableshadow --passalgo=sha512
bootloader --location=mbr
clearpart --all --initlabel
part /boot --asprimary --fstype="ext4" --size=500
part swap --fstype="swap" --size=4096
part / --fstype="ext4" --grow --size=15000
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
url --url=http://192.168.209.12/cobbler/ks_mirror/Centos-7- x86_64
$yum_repo_stanza
$SNIPPET(‘network_config‘)
reboot
rootpw --iscrypted $6$DEHzuoHRCJMBjzzK$DKallGno50cVbJ27yEIP5O1M4p3/rwfilgIdpKW9IU25Q4KI8tXmSPwH1JuB2UW/pk3NlayujtEZ9ckfclRM81
selinux --disabled
skipx
timezone Asia/Shanghai --isUtc --nontp
install
zerombr
%packages
@^minimal
@core
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb=‘auto‘
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
EOF
//检查ks文件语法是否错误
[root@lanzhiyong ~]# cobbler validateks
//查看当前cobbler有哪些配置文件
[root@lanzhiyong ~]# cobbler profile list
Centos-7-x86_64
//修改profile将我们新建的ks文件设为默认的kickstarts安装文件
[root@lanzhiyong ~]# cobbler profile edit --name Centos-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/Centos-7-x86_64.ks
//配合网卡名称为传统网卡名称eth0
[root@lanzhiyong ~]# cobbler profile edit --name Centos-7-x86_64 --kopts=‘net.ifnames=0 biosdevname=0‘
//检查当前系统cobbler配置文件信息
[root@lanzhiyong ~]# cobbler profile report
//同步cobbler
[root@lanzhiyong ~]# cobbler sync
//把服务器端所有重启
[root@lanzhiyong ~]# systemctl restart xinetd//超级守护进程
[root@lanzhiyong ~]# systemctl restart cobblerd
[root@lanzhiyong ~]# systemctl restart httpd
[root@lanzhiyong ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 5 127.0.0.1:25151 *:*
LISTEN 0 5 *:873 *:*
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 128 :::443 :::*
LISTEN 0 5 :::873 :::*
*********************************安装客户端********************
在虚拟机新建一个虚拟机 选择Centos7 安装,其他默认
1.不选择光盘
2.内存建议2000MB
3.安装客户端
标签:end 模板 algo and dom note repos ble mini
原文地址:http://blog.51cto.com/13833047/2166236