标签:dos 同步数据 snippet vpd img 客户 top path gre
第1章 什么是Cobbler1、服务器表壳标签;
2、软件自动扫描网络获取;
Cobbler是一个Linux系统安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。
?Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
?Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。
yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd python-django
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
systemctl start cobblerd.service
systemctl start httpd.service
cobbler check
操作前先备份文件
cp /etc/cobbler/settings{,.ori}
vim /etc/cobbler/settings
292 pxe_just_once: 1
242 manage_dhcp: 1
sed -i 's/server: 127.0.0.1/server: 172.16.1.202/' /etc/cobbler/settings
sed -i 's/next_server: 127.0.0.1/next_server: 172.16.1.202/' /etc/cobbler/settings
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
sed -ri "/default_password_crypted/s#(.*: ).*#\1\"`openssl passwd -1 -salt 'Mikey' '123456'`\"#" /etc/cobbler/settings
systemctl enable tftp.socket
systemctl start tftp.socket
systemctl restart cobblerd.service
[root@Cobbler ~]# vim /etc/cobbler/dhcp.template
subnet 172.16.1.0 netmask 255.255.255.0 {
option routers 172.16.1.5;
option domain-name-servers 172.16.1.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 172.16.1.100 172.16.1.254;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
说明:客户端的获取(:%s/192.168/172.16/g) 修改的nohi
[root@Cobbler ~]# systemctl enable tftp.socket
[root@Cobbler ~]# systemctl start tftp.socket
[root@Cobbler ~]# systemctl restart cobblerd.service
[root@Cobbler ~]# cobbler sync
task started: 2018-01-09_094526_sync
task started (id=Sync, time=Tue Jan 9 09:45:26 2018)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/images
注意:同步后不要修改此目录。
[root@Cobbler ~]# cat /etc/dhcp/dhcpd.conf
# ******************************************************************
# Cobbler managed dhcpd.conf file
# generated from cobbler dhcp.conf template (Tue Jan 9 01:45:27 2018)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be 修改这个文件
# overwritten.
# ******************************************************************
这样就可以通过web界面操作了
https://10.0.0.202/cobbler_web
登录的密码和账号是cobbler cobbler
[root@Cobbler ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 is write-protected, mounting read-only
[root@Cobbler ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 98G 1.6G 97G 2% /
devtmpfs 903M 0 903M 0% /dev
tmpfs 912M 0 912M 0% /dev/shm
tmpfs 912M 8.8M 903M 1% /run
tmpfs 912M 0 912M 0% /sys/fs/cgroup
/dev/sda1 1014M 135M 880M 14% /boot
tmpfs 183M 0 183M 0% /run/user/0
/dev/sr0 4.3G 4.3G 0 100% /mnt
Actions----àlmportDVD--à填写镜像的一些信息(下图显示详细信息)
说明:Arch必须选择X86_64(其他的不是很稳定,容易出错)
Path选择的是镜像挂载的路径;(必须确定,出错一直挂载导致磁盘空间浪费)
[root@Cobbler ~]# ps -ef|grep rsync
root 12817 1 0 09:20 ? 00:00:00 /usr/bin/rsync --daemon --no-detach
root 13308 12962 15 09:58 ? 00:00:07 rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS7.4-x86_64 --progress
root 13309 13308 0 09:58 ? 00:00:00 rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS7.4-x86_64 --progress
root 13310 13309 12 09:58 ? 00:00:05 rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS7.4-x86_64 --progress
root 13338 12429 0 09:59 pts/1 00:00:00 grep --color=auto rsync
[root@Cobbler ~]# ps -ef|grep rsync
root 12817 1 0 09:20 ? 00:00:00 /usr/bin/rsync --daemon --no-detach
root 13925 12429 0 10:17 pts/1 00:00:00 grep --color=auto rsync
Distros 镜像
Profiles 配置属性
/var/lib/tftpboot/pxelinux.cfg/default默认配置文件
只能修改此目录 /etc/cobbler/pxe/pxedefault.template
说明:默认是选择本地的。
修改默认的KS文件
# Cobbler for Kickstart Configurator for CentOS 7 by Mikey
install
url --url=$tree
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
#Network information
$SNIPPET('network_config')
#network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=CentOS7
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
rootpw --iscrypted $default_password_crypted
clearpart --all --initlabel
part /boot --fstype xfs --size 1024
part swap --size 1024
part / --fstype xfs --size 1 --grow
firstboot --disable
selinux --disabled
firewall --disabled
logging --level=info
reboot
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
%packages
@^minimal
@compat-libraries
@core
@debugging
@development
bash-completion
chrony
dos2unix
kexec-tools
lrzsz
nmap
sysstat
telnet
tree
vim
wget
%end
%post
systemctl disable postfix.service
%end
第二块网卡设置同上(注意添加网卡的MAC地址)
配置完后同步,客户端开始无人值守安装开始。
# Cobbler for Kickstart Configurator for CentOS 6.9 by Mikey
install
url --url=$tree
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# Network information
$SNIPPET('network_config')
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
rootpw --iscrypted $default_password_crypted
clearpart --all --initlabel
part /boot --fstype=ext4 --asprimary --size=200
part swap --size=1024
part / --fstype=ext4 --grow --asprimary --size=200
firstboot --disable
selinux --disabled
firewall --disabled
logging --level=info
reboot
%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
%end
%post
chkconfig postfix off
%end
标签:dos 同步数据 snippet vpd img 客户 top path gre
原文地址:http://blog.51cto.com/qibingtuan/2059137