标签:pxelinux fifo port command can enforce mem ext Opens
cobbler是一个可以实现批量安装系统的linux应用程序。它有别于pxe+kickstart,cobbler可以实现同个服务器批量安装不同操作系统版本。
cobbler部署安装:
1. 下载相关软件
2. 配置dhcp
3. 配置tftp
4. 启动httpd
5. 启动cobbler
6. cobbler自检
7. 根据提示进行修改
8. cobbler重启及同步
9. 挂载光盘
10. 生成distro
11. 创建kickstart文件
12. 创建profile
13. 删除不包含自定义kickstart文件
给服务机192.168.16.4添加网卡,桥接模式
[root@localhost ~]# ip a 3: ens37: <BROaDCaST,MUlTiCaST,UP,lOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:d0:98:19 brd ff:ff:ff:ff:ff:ff inet 192.168.5.35/24 brd 192.168.5.255 scope global ens37 #桥接ip valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fed0:9819/64 scope link valid_lft forever preferred_lft forever
[root@localhost ~]# setenforce 0 [root@localhost ~]#systemctl stop firewalld
[root@localhost ~]#yum install cobbler dhcp tftp-server xinetd syslinux httpd -y #xinetd:超级守护进程 tftp-server:简单传输协议 syslinux: 提供pxelinux.0这个文件 ,pxelinux.0引导文件引导vmlinux和initrd两个启动文件 #注意: 要在yum源里添加163的镜像 [root@localhost ~]# cd /etc/yum.repos.d [root@localhost yum.repos.d]# vim bendi.repo #添加网易源 [wangyi] name=wangyi enabled=1 gpgcheck=0 baseurl=http://mirrors.163.com/centos/7/os/x86_64/
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf # DHCP Server Configuration file. # see /usr/share/doc/dhcp*/dhcpd.conf.example # see dhcpd.conf(5) man page :r/usr/share/doc/dhcp*/dhcpd.conf.example #拉取文件 subnet 192.168.5.0 netmask 255.255.255.0 { #和桥接地址一个网段 range 192.168.5.10 192.168.5.100; default-lease-time 600; max-lease-time 7200; filename "pxelinux.0"; #寻找pxelinux.0 } :wq
[root@localhost ~]# vim /etc/xinetd.d/tftp service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot disable = no #此处改为no,允许启动 per_source = 11 cps = 100 2 flags = iPv4 } [root@localhost yum.repos.d]# systemctl restart httpd #重启,注意重启顺序 [root@localhost yum.repos.d]# systemctl restart cobblerd [root@localhost yum.repos.d]# systemctl restart dhcpd [root@localhost yum.repos.d]# systemctl restart xinetd
[root@localhost ~]# cobbler check The following are potential configuration items that you may want to fix: 1 : The ‘server‘ field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or iP for the boot server as reachable by all machines that will use it. 2 : For PXE to be functional, the ‘next_server‘ field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the iP of the boot server on the PXE network. 3 : SElinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SElinux environment: https://github.com/cobbler/cobbler/wiki/Selinux 4 : 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. 5 : enable and start rsyncd.service with systemctl 6 : debmirror package is not installed, it will be required to manage debian deployments and repositories 7 : ksvalidator was not found, install pykickstart 8 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to ‘cobbler‘ and should be changed, try: "openssl passwd -1 -salt ‘random-phrase-here‘ ‘your-password-here‘" to generate new one 9 : 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.
一共有9条错误,根据反馈修改文件:
修改配置文件/etc/cobbler/settings
问题1:cobbler文件默认是127.0.0.1本地回环地址,需要更改为提供cobbler服务的ip地址 192.168.182.128,在384行
384 server: 192.168.5.35
问题2:netx_server也是默认本地127.0.0.1回环地址,需要修改为提供cobbler服务的ip地址 192.163.182,128,在272行
272 next_server: 192.168.5.35
问题3:防火已关,不用理会
问题4:可以忽略
问题5:启动rsync(同步程序)
[root@localhost ~]# systemctl restart rsyncd
[root@localhost ~]# systemctl enable rsyncd
问题6:可以忽略
问题7:可以忽略
问题8:根据提示更改密码
[root@localhost ~]# openssl passwd -1 -salt "123" "123456" $1$123$7mft0jKnzzvadU4t0unTG1 #加密密码 #123为随机数,123456为密码 将新生成的加密数据写入/etc/cobbler/settings 101 default_password_crypted: "$1$123$7mft0jKnzzvadU4t0unTG1."
问题9:可以忽略
更改结束后重启并同步
[root@localhost ~]# systemctl restart cobblerd [root@localhost ~]# cobbler sync task started: 2019-04-23_052424_sync task started (id=Sync, time=Tue apr 23 05:24:24 2019) running pre-sync triggers cleaning trees removing: /var/lib/tftpboot/grub/images copying bootloaders copying: /usr/share/syslinux/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0 copying: /usr/share/syslinux/menu.c32 -> /var/lib/tftpboot/menu.c32 copying: /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk copying distros to tftpboot copying images generating PXE configuration files generating PXE menu structure rendering TFTPD files generating /etc/xinetd.d/tftp 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 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 ***
再次检查cobbler
[root@localhost ~]# cobbler check The following are potential configuration items that you may want to fix: 1 : SElinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SElinux environment: https://github.com/cobbler/cobbler/wiki/Selinux 2 : 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. 3 : debmirror package is not installed, it will be required to manage debian deployments and repositories 4 : ksvalidator was not found, install pykickstart 5 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
[root@localhost ~]# mount /dev/cdrom /mnt
1.8 导入数据
[root@localhost ~]# cobbler import --path=/mnt --name="centos7.5" #导入路径在挂载点,并指定name #导入较慢,耐心等待 Found a candidate signature: breed=redhat, version=rhel6 ........... Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos7.5/repodata *** TaSK COMPlETE *** #导入完成
distro : 发行版, 就是我们安装什么版本的linux操作系统的名称
profile : 类似于一个 配置文件,类似于bash_profile, 里面包含可以添加 kernel 参数,对应的kickstart 文件 以及 此profile 对应的 distro 等等.
查看distro
[root@localhost ~]# cobbler distro list centos7.5-x86_64
查看profile
[root@localhost ~]# cobbler profile list centos7.5-x86_64
[root@localhost ~]# cp anaconda-ks.cfg /var/lib/cobbler/kickstarts/ks.cfg #复制ananconda文件到/var/lib/cobbler/kickstarts/到目录下并改名为ks.cfg [root@localhost ~]# vim /var/lib/cobbler/kickstarts/ks.cfg # Use CDROM installation media url --url=http://192.168.5.35/cobbler//ks_mirror//centos7.5/ # Use graphical install #将cdrom改为url,即将光盘启动改为apache启动, 后面接服务机的桥接ip和repodata的路径 [root@localhost ~]# ls /var/www/cobbler//ks_mirror//centos7.5/ repodata :wq
[root@localhost ~]# cobbler profile add --kickstart="/var/lib/cobbler/kickstarts/ks.cfg" --distro="centos7.5-x86_64" --name="centos7.5_zxj" #添加profile 指定配置文件路径和镜像路径,并命名 [root@localhost ~]# cobbler profile list #查看profile centos7.5-x86_64 centos7.5_zxj
[root@localhost ~]# cobbler profile remove --name="centos7.5-x86_64" [root@localhost ~]# cobbler profile list centos7.5_zxj
cobbler部署完成
cobbler部署完成后,新建虚拟机就可以自动部署安装了。在创建虚拟机时需要注意将内存改到3G,否则无法安装系统
标签:pxelinux fifo port command can enforce mem ext Opens
原文地址:https://www.cnblogs.com/ajunyu/p/10883521.html