概述
cobbler安装centos7
- 1.cobbler安装centos7
- 2.定制安装
1.cobbler安装centos7
关闭防火墙和selinux,然后重启
[root@localhost ~]# systemctl disable --now firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@localhost ~]# reboot
//下载epel-release源和相关软件
[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# yum -y install httpd dhcp-* tftp xinetd pykickstart
//开启cobbler仓库,下载cobbler
[root@localhost ~]# yum -y install module enable cobbler
[root@localhost ~]# yum -y install cobbler cobbler-web
//启动httpd、cobbler服务并设置开机自启
[root@localhost ~]# systemctl enable --now httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@localhost ~]# systemctl enable --now cobblerd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
[root@localhost ~]# ss -anltu
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 *:68 *:*
tcp LISTEN 0 128 *:22 *:*
tcp LISTEN 0 100 127.0.0.1:25 *:*
tcp LISTEN 0 5 127.0.0.1:25151 *:*
tcp LISTEN 0 128 [::]:80 [::]:*
tcp LISTEN 0 128 [::]:22 [::]:*
tcp LISTEN 0 100 [::1]:25 [::]:*
tcp LISTEN 0 128 [::]:443 [::]:*
//更改配置文件IP为本机IP
[root@localhost ~]# sed -i 's/^server:.*/server: 192.168.237.131/g' /etc/cobbler/settings
[root@localhost ~]# sed -i 's/^next_server:.*/next_server: 192.168.237.131/g' /etc/cobbler/settings
//生成加密密码替换到配置文件中
[root@localhost ~]# openssl passwd -1
Password:
Verifying - Password:
$1$sR6svS4Z$KyyERbkBKwqXaU82PPsYJ.
[root@localhost ~]# sed -Ei 's/(default_password_crypted:).*/1 "$1$sR6svS4Z$KyyERbkBKwqXaU82PPsYJ."/g' /etc/cobbler/settings
//同步设置
[root@localhost ~]# cobbler sync
//启动rsync服务并开机自启
[root@localhost ~]# systemctl enable --now rsyncd
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.
//重启cobbler服务,配置tftp
[root@localhost ~]# systemctl restart cobblerd.service
[root@localhost ~]# tail -14 /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -B 1380 -v -s /var/lib/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}
//执行检查环境命令
[root@localhost ~]# 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.
//解决办法
1、centos8中的同样目录中的文件移动到/var/lib/cobbler/loaders
[root@localhost cobbler]# rm -rf loaders/
[root@localhost cobbler]# scp -r root@192.168.237.170:/var/lib/cobbler/loaders . //把之前在centos8上部署的文件复制过来
[root@localhost loaders]# cp /usr/share/syslinux/pxelinux.0 . //用本机系统的pxe文件覆盖文件中的pxe文件
cp:是否覆盖"./pxelinux.0"? y
[root@localhost loaders]# cp /usr/share/syslinux/menu.c32 .
cp:是否覆盖"./menu.c32"? y
2、第二个可以忽略不管,此次部署用不到
3、
[root@localhost ~]# yum -y install fence-agents
//重启并同步
[root@localhost ~]# systemctl restart cobblerd.service
[root@localhost ~]# cobbler sync
//打开DHCP功能,配置DHCP模板文件
[root@localhost ~]# sed -i 's/^manage_dhcp:.*/manage_dhcp: 1/g' /etc/cobbler/settings
[root@localhost ~]# vim /etc/cobbler/dhcp.template
subnet 192.168.237.0 netmask 255.255.255.0 {
option routers 192.168.237.131;
option domain-name-servers 192.168.237.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.237.200 192.168.237.254;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
//重启并同步
[root@localhost ~]# systemctl restart cobblerd.service
[root@localhost ~]# cobbler sync
//查看DHCP状态
[root@localhost ~]# netstat -anulp | grep dhcp
udp 0 0 0.0.0.0:67 0.0.0.0:* 31369/dhcpd
//导入镜像
[root@localhost ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# df -h /mnt/
文件系统 容量 已用 可用 已用% 挂载点
/dev/sr0 4.4G 4.4G 0 100% /mnt
[root@localhost ~]# cobbler import --path=/mnt --name=centos-7 --arch=x86_64
task started: 2021-10-14_102416_import
task started (id=Media import, time=Thu Oct 14 10:24:16 2021)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/ks_mirror/centos-7-x86_64:
creating new distro: centos-7-x86_64
trying symlink: /var/www/cobbler/ks_mirror/centos-7-x86_64 -> /var/www/cobbler/links/centos-7-x86_64
creating new profile: centos-7-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/centos-7-x86_64 for centos-7-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos-7-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos-7-x86_64
looking for /var/www/cobbler/ks_mirror/centos-7-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos-7-x86_64/repodata
*** TASK COMPLETE ***
# --path //镜像路径
# --name //为安装源定义一个名字
# --arch //指定安装源平台
//查看镜像列表
[root@localhost ~]# cobbler list
distros:
centos-7-x86_64 //发行版
profiles:
centos-7-x86_64 //配置文件
systems:
repos:
images:
mgmtclasses:
packages:
files:
//配置文件
[root@localhost ~]# ls /var/www/cobbler/ks_mirror/
centos-7-x86_64 config
[root@localhost ~]# ll /var/www/cobbler/ks_mirror/centos-7-x86_64/
总用量 340
-rw-r--r-- 1 root root 14 10月 30 2020 CentOS_BuildTag
drwxr-xr-x 3 root root 35 10月 27 2020 EFI
-rw-rw-r-- 1 root root 227 8月 30 2017 EULA
-rw-rw-r-- 1 root root 18009 12月 10 2015 GPL
drwxr-xr-x 3 root root 57 10月 27 2020 images
drwxr-xr-x 2 root root 198 11月 3 2020 isolinux
drwxr-xr-x 2 root root 43 10月 27 2020 LiveOS
drwxr-xr-x 2 root root 233472 11月 4 2020 Packages
drwxr-xr-x 2 root root 4096 11月 4 2020 repodata
-rw-rw-r-- 1 root root 1690 12月 10 2015 RPM-GPG-KEY-CentOS-7
-rw-rw-r-- 1 root root 1690 12月 10 2015 RPM-GPG-KEY-CentOS-Testing-7
-r--r--r-- 1 root root 2883 11月 4 2020 TRANS.TBL
//创建kickstarts自动安装脚本
[root@localhost ~]# cat /var/lib/cobbler/kickstarts/centos-7-x86_64.ks
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.237.131/cobbler/ks_mirror/centos-7-x86_64
$yum_repo_stanza
reboot
rootpw --iscrypted $6$bzU5qdppmsc7HT.q$q9vymn7ew97NBVXjl2eXfvCjLDEcpEFuSweYzDEu1Rtk8NdPkn6DwXD.Qk1QumVbyK2rPyLBXGZLhG1ryBHzU.
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
//检查ks文件语法
[root@localhost ~]# cobbler validateks
task started: 2021-10-14_103601_validateks
task started (id=Kickstart Validation, time=Thu Oct 14 10:36:01 2021)
----------------------------
osversion: rhel7
checking url: http://192.168.237.131/cblr/svc/op/ks/profile/centos-7-x86_64
running: /usr/bin/ksvalidator -v "rhel7" "http://192.168.237.131/cblr/svc/op/ks/profile/centos-7-x86_64"
received on stdout:
received on stderr:
*** all kickstarts seem to be ok ***
*** TASK COMPLETE ***
//查看cobbler配置文件
[root@localhost ~]# cobbler profile list
centos-7-x86_64
//查看当前使用的配置文件是否为刚才创建的脚本
[root@localhost ~]# cobbler profile report
Name : centos-7-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : centos-7-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/sample_end.ks
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Owners : ['admin']
Parent Profile :
Internal proxy :
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Repos : []
Server Override : <<inherit>>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : kvm
//修改kickstart脚本为刚才创建的脚本
[root@localhost ~]# cobbler profile edit --name centos-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos-7-x86_64.ks
//回归传统网卡命令
[root@localhost ~]# cobbler profile edit --name centos-7-x86_64 --kopts='net.ifnames=0 biosdevname=0'
//kickstart和内核已经设置完成
[root@localhost ~]# cobbler profile report
Name : centos-7-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : centos-7-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {'biosdevname': '0', 'net.ifnames': '0'}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/centos-7-x86_64.ks
......
//同步
[root@localhost ~]# cobbler sync
task started: 2021-10-14_105337_sync
task started (id=Sync, time=Thu Oct 14 10:53:37 2021)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos-7-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/centos-7-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
copying: /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
copying distros to tftpboot
copying files for distro: centos-7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos-7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos-7-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: centos-7-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos-7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos-7-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos-7-x86_64/initrd.img
Writing template files for centos-7-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: centos-7-x86_64
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout:
received on stderr:
running: service dhcpd restart
received on stdout:
received on stderr: Redirecting to /bin/systemctl restart dhcpd.service
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.manage_genders
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
//重启所有服务
[root@localhost ~]# systemctl restart xinetd.service
[root@localhost ~]# systemctl restart cobblerd.service
[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]# ss -anltu
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp LISTEN 0 5 127.0.0.1:25151 *:*
tcp LISTEN 0 5 *:873 *:*
tcp LISTEN 0 128 *:22 *:*
tcp LISTEN 0 100 127.0.0.1:25 *:*
tcp LISTEN 0 5 [::]:873 [::]:*
tcp LISTEN 0 128 [::]:80 [::]:*
tcp LISTEN 0 128 [::]:22 [::]:*
tcp LISTEN 0 100 [::1]:25 [::]:*
tcp LISTEN 0 128 [::]:443 [::]:*
安装centos7
镜像不选,网络选择NAT模式
安装成功
2.定制安装
定制安装步骤:
- 统计服务器mac地址
- 配置cobbler
- 安装
登录web界面
新建文件系统
选择配置文件
输入MAC地址和IP
同步和重启服务
[root@localhost ~]# cobbler sync
[root@localhost ~]# systemctl restart xinetd.service
[root@localhost ~]# systemctl restart cobblerd.service
[root@localhost ~]# systemctl restart httpd.service
打开刚才创建的虚拟机
安装完成,IP是网页配置的
最后
以上就是美满大叔为你收集整理的cobbler安装centos7的全部内容,希望文章能够帮你解决cobbler安装centos7所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复