码迷,mamicode.com
首页 > 其他好文 > 详细

在centos上cobbler实现pxe的自动化安装

时间:2018-06-15 13:10:30      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:man   图形   mount   菜单   sys   $1   mask   复制   httpd   

实验1:在centos7上cobbler实现pxe的自动化安装
(1)A机器,搭建cobbler的配置
yum install cobbler cobbler-web 安装时依赖安装的包有tftp-server、httpd
yum install dhcp
systemctl enable httpd
systemctl start httpd
systemctl enable tftp
systemctl start tftp
rpm -ql cobbler|grep service
systemctl start cobblerd
cobbler check
vim /etc/cobbler/settings
server: 172.18.62.60
systemctl restart cobblerd
cobbler check
vim /etc/cobbler/settings
next_server: 172.18.62.60
systemctl restart cobblerd
cobbler check
openssl passwd -1 生成加密的密码
vim /etc/cobbler/settings 复制密码
default_password_crypted: "$1$9CWphr2E$deIQsrb3oZPmQ/7YkZoC30"
systemctl restart cobblerd
cobbler check
cobbler get-loaders
systemctl restart cobblerd
cobbler check
yum install pykickstart
systemctl restart cobblerd
cobbler check
vim /etc/cobbler/settings
manage_dhcp: 1 必须启用,否则不能自动生成dhcp配置文件
vim /etc/cobbler/dhcp.template
option routers 172.18.62.5;
option domain-name-servers 114.114.114.114,8.8.8.8;
option subnet-mask 255.255.0.0;
range dynamic-bootp 172.18.62.90 172.18.62.200;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server; 变量自动获取地址
systemctl restart cobblerd
cobbler check
cobbler sync
ss -nutl
systemctl enable dhcpd
fconfig ens37 down
systemctl start dhcpd
systemctl status dhcpd
ss -nutl
ls /var/lib/tftpboot/
tree /var/www/
mkdir /mnt/centos6
添加centos6的光盘
echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan
echo "- - -" > /sys/class/scsi_host/host2/scan
mount /dev/sr1 /mnt/centos6
ls /mnt/centos6
cobbler import --path=/mnt/centos7/ --name=Centos7.4 将光盘导入cobbler中,并
设置默认应答文件;
cobbler import --path=/mnt/centos6/ --name=centos6.9 --arch=x86_64
cobbler profile list
cobbler distro list
cd /var/lib/cobbler/
cd kickstarts/
rz 将自定义的ks应答文件导入到此目录
chmod 644 * 设置ks文件可读
vim ks7-pxe-desktop.cfg
url --url=$tree 变量自动找到系统镜像的路径
vim ks6-pxe-desktop.cfg
url --url=$tree 变量自动找到系统镜像的路径
cobbler profile list 显示启动菜单项
cobbler distro list 显示系统镜像
cobbler profile add --name=Centos7.4-x86_64-desktop --distro=Centos7.4-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks7-pxe-desktop.cfg 添加启动菜单项
cobbler profile add --name=Centos6.9-x86_64-desktop --distro=centos6.9-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks6-pxe-desktop.cfg 添加启动菜单项

(2)要安装的机器的配置
关闭自动获取本地dhcp选项
设置网络模式
设置硬盘大小以适应ks中的分区
设置内存大小以防centos7图形安装内存不够
进入启动项界面,选择网络引导,以安装系统
实验2:centos6上实现cobbler自动化安装系统
(1)A机器搭建cobbler配置
yum install dhcp httpd syslinux tftp-server
cd /etc/yum.repos.d/
vim epel.repo
[epel]
name=epel_centos6
baseurl=https://mirrors.aliyun.com/epel/6/x86_64/
gpgcheck=0
yum repolist
yum install cobbler cobbler需要epel源提供包
service cobblerd start
chkconfig cobblerd on
chkconfig tftp on
service xinetd start
chkconfig --list
rpm -ql tftp-server
service httpd restart
vim /etc/cobbler/dhcp.template
option routers 172.18.62.5;
option domain-name-servers 223.5.5.5,8.8.8.8;
option subnet-mask 255.255.0.0;
range dynamic-bootp 172.18.62.200 172.18.62.254;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
vim /etc/cobbler/settings
manage_dhcp: 1 必须有
next_server: 172.18.62.50
server: 172.18.62.50
default_password_crypted: "$1$K1U0gpRl$BXEnaaYVdarbjYbHP6WVh0"
注意:默认密码需要用openssl passwd -1命令生成
cobbler check
cobbler get-loaders
yum install pykickstart -y
vim /etc/xinetd.d/rsync
disable = no
service cobblerd restart
cobbler check
cobbler sync
ss -nutl
mkdir /mnt/centos6
mount /dev/sr0 /mnt/centos6
mkdir /mnt/centos7
mount /dev/sr1 /mnt/centos7
cobbler import --path=/mnt/centos6/ --name=Centos6.9-x86_64 --arch=x86_64
cobbler import --path=/mnt/centos7/ --name=Centos7.4-x86_64 --arch=x86_64
du -sh /var/www/cobbler/ks_mirror/
cobbler profile list
cobbler distro list
cobbler profile remove --name=Centos6.9-x86_64
cobbler profile add --name=Centos6.9-x86_64 --distro=Centos6.9-x86_64
cobbler profile --help
cobbler profile rename --help
cobbler profile rename --name=Centos6.9-x86_64 --newname=Centos6.9-mini-x86_64
重命名启动菜单;
cobbler profile rename --name=Centos7.4-x86_64 --newname=Centos7.4-mini-x86_64
重命名启动菜单;
cd /var/lib/cobbler/kickstarts/
rz 导入ks应答文件
vim ks6-pxe-desktop.cfg
url --url=$tree
vim ks7-pxe-desktop.cfg
url --url=$tree
cobbler profile add --name=Centos7.4-desktop-x86_64 --distro=Centos7.4-x86_64 --kickstart=ks7-pxe-desktop.cfg 添加启动菜单
cobbler profile add --name=Centos7.4-desktop-x86_64 --distro=Centos7.4-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks7-pxe-desktop.cfg 添加启动菜单
cobbler profile add --name=Centos6.9-desktop-x86_64 --distro=Centos6.9-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks6-pxe-desktop.cfg 添加启动菜单
cat /var/lib/tftpboot/pxelinux.cfg/default 查看添加菜单后的启动菜单文件

(2)要安装的机器的配置
关闭自动获取本地dhcp选项
设置网络模式
设置硬盘大小以适应ks中的分区
设置内存大小以防centos7图形安装内存不够
进入启动项界面,选择网络引导,以安装系统

在centos上cobbler实现pxe的自动化安装

标签:man   图形   mount   菜单   sys   $1   mask   复制   httpd   

原文地址:http://blog.51cto.com/angwoyufengtian/2129775

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!