您好,登录后才能下订单哦!
这篇文章主要为大家展示了“怎么使用Cobbler快速安装系统”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“怎么使用Cobbler快速安装系统”这篇文章吧。
Cobbler 可以用来快速建立 Linux 网络安装环境,它已将 Linux 网络安装的技术门槛,从大专以上文化水平,成功降低到初中以下,连补鞋匠都能学会。
CentOS Linux release 7.6.1810 VMware Workstation Pro 14
查看默认的 ks 文件
[root@Jaking ~]# cobbler reportdistros: ========== Name : CentOS-7.6-x86_64 Architecture : x86_64 TFTP Boot Files : {} Breed : redhat Comment : Fetchable Files : {} Initrd : /var/www/cobbler/ks_mirror/CentOS-7.6-x86_64/images/pxeboot/initrd.img Kernel : /var/www/cobbler/ks_mirror/CentOS-7.6-x86_64/images/pxeboot/vmlinuz Kernel Options : {} Kernel Options (Post Install) : {} Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS-7.6-x86_64'} Management Classes : [] OS Version : rhel6 Owners : ['admin'] Red Hat Management Key : Red Hat Management Server : Template Files : {} profiles: ========== Name : CentOS-7.6-x86_64 TFTP Boot Files : {} Comment : DHCP Tag : default Distribution : CentOS-7.6-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 : Name Servers : [] Name Servers Search Path : [] Owners : ['admin'] Parent Profile : Internal proxy : Red Hat Management Key : Red Hat Management Server : Repos : [] Server Override : 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
注: distros 是发行版本,即光盘镜像信息。 profiles 指的是 ks 应答文件。 systems 是指通 Cobbler 安装好的物理机名称。
[root@Jaking ~]# cd /var/lib/cobbler/kickstarts/[root@Jaking kickstarts]# lsdefault.ks legacy.ks sample_esx4.ks sample.ks esxi4-ks.cfg pxerescue.ks sample_esxi4.ks sample_old.seed esxi5-ks.cfg sample_autoyast.xml sample_esxi5.ks sample.seed install_profiles sample_end.ks sample_esxi6.ks sample.seed.28
可以看到有很多默认的配置文件。
上传 CentOS7.ks 到 Cobbler 服务器上。CentOS7.ks 这个配置文件里面安装了开发工具相关软件包。
[root@Jaking kickstarts]# rz[root@Jaking kickstarts]# lsCentOS7.ks install_profiles sample_end.ks sample_esxi6.ks sample.seed.28 default.ks legacy.ks sample_esx4.ks sample.ks esxi4-ks.cfg pxerescue.ks sample_esxi4.ks sample_old.seed esxi5-ks.cfg sample_autoyast.xml sample_esxi5.ks sample.seed [root@Jaking kickstarts]# cat CentOS7.ks# Cobbler for Kickstart Configurator for CentOS 7 by clsninstall url --url=$treetext 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=CentOS7timezone --utc Asia/Shanghai authconfig --enableshadow --passalgo=sha512 rootpw --iscrypted $default_password_cryptedclearpart --all --initlabel part /boot --fstype xfs --size 1024 part swap --size 1024 part / --fstype xfs --size 1 --grow firstboot --disableselinux --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 @additional-devel @development @platform-devel bash-completion chrony dos2unix kexec-tools lrzsz sysstat tree vim wget git net-tools %end %post systemctl disable postfix.service %end [root@Jaking kickstarts]# cobbler profile list #查看当前启动项,使用的配置文件 CentOS-7.6-x86_64
修改 name 是 CentOS-7.6-x86_64 的 kickstart 文件为 CentOS7.ks
[root@Jaking kickstarts]# cobbler profile edit --name CentOS-7.6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7.ks[root@Jaking kickstarts]# cobbler report | grep KickstartKickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS-7.6-x86_64'} Kickstart : /var/lib/cobbler/kickstarts/CentOS7.ks Kickstart Metadata : {}
通过给内核传参数,修改网卡名称为 eth0
[root@Jaking kickstarts]# cobbler profile edit --name CentOS-7.6-x86_64 --kopts='net.ifnames=0 biosdevname=0'
配置文件内容如下:
[root@Jaking kickstarts]# vim CentOS7.ks #查看配置文件中的,默认就可以,不需要修改# Cobbler for Kickstart Configurator for CentOS 7 by clsnInstall #安装系统url --url=$tree #url 地址为 Cobbler 内置变量text #文本方式安装,修改为图形界面则为 Graphicallang en_US.UTF-8 #语言keyboard us #键盘zerombr #该参数用于清除引导信息,需要让其生效可以在参数后添加 yes 即可。可选项,一般不用。bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"#指定引导装载程序怎样被安装.对于安装和升级,这个选项都是必需的.#Network information$SNIPPET('network_config') #该参数表示使用下方%pre 中的脚本来配置网络,相关脚本存放于/var/lib/cobbler/snippets#如果不需要脚本配置可启用以下配置#network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6--hostname=CentOS7 timezone --utc Asia/Shanghai #时区authconfig --enableshadow --passalgo=sha512 #加密 shadowrootpw --iscrypted $default_password_crypted #设置 root 密码clearpart --all --initlabel #--all 初除所有分区,后者将磁盘标签初始化为缺省值设置。part /boot --fstype xfs --size 1024 #boot分区大小part swap --size 1024 #swap分区大小part / --fstype xfs --size 1 --grow #根分区大小firstboot --disable #决定是否在系统第一次引导时启动"设置代理”,禁用。selinux --disabled #在系统里设置 SELinux 状态firewall --disabled #在系统狸设置而防火墙状态logging --level=info #这个命令控制安装过程中anaconda的错误日志,它对安装好的系统没有影响。reboot #安装后重启%pre #pre 中定了前面使用的具体脚本名称。$SNIPPET('log_ks_pre')$SNIPPET('kickstart_start')$SNIPPET('pre_install_network_config')# Enable installation monitoring$SNIPPET('pre_anamon') %end %packages #自定义安装内容,这里可以可以自行生成 ks 文件然后把对应的配置复制到这里。当前配置为最小化安装,以及安装系统常用工具。@additional-devel @development @platform-devel bash-completion chrony dos2unix kexec-tools lrzsz sysstat tree vim wget git net-tools %end %post #安装后执行操作,可以执行脚本也可以直接执行命令。systemctl disable postfix.service %end
定制 Cobbler 引导菜单(名称、超时时间、默认启动菜单)
[root@Jaking kickstarts]# vim /etc/cobbler/pxe/pxedefault.templateDEFAULT menu PROMPT 0 MENU TITLE Jaking #菜单名称TIMEOUT 100 #超时时间TOTALTIMEOUT 6000 ONTIMEOUT $pxe_timeout_profileLABEL local MENU LABEL (local) MENU DEFAULT LOCALBOOT -1 $pxe_menu_items #该变量是我自定义的引导菜单,复制到 LABEL local 配置项上方,否则默认启动还是 local。MENU end
同步 Cobbler 配置
[root@Jaking kickstarts]# systemctl restart cobblerd[root@Jaking kickstarts]# cobbler synctask started: 2020-01-04_050537_sync task started (id=Sync, time=Sat Jan 4 05:05:37 2020) running pre-sync triggers cleaning trees removing: /var/www/cobbler/images/CentOS-7.6-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.6-x86_64 removing: /var/lib/tftpboot/s390x/profile_list copying bootloaders 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.6-x86_64 trying hardlink /var/www/cobbler/ks_mirror/CentOS-7.6-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/CentOS-7.6-x86_64/vmlinuz trying hardlink /var/www/cobbler/ks_mirror/CentOS-7.6-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/CentOS-7.6-x86_64/initrd.img copying images generating PXE configuration files generating PXE menu structure copying files for distro: CentOS-7.6-x86_64 trying hardlink /var/www/cobbler/ks_mirror/CentOS-7.6-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/CentOS-7.6-x86_64/vmlinuz trying hardlink /var/www/cobbler/ks_mirror/CentOS-7.6-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/CentOS-7.6-x86_64/initrd.img Writing template files for CentOS-7.6-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.6-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 ***
新建虚拟机进行测试。
注意:内存要足够大,网络模式要和 Cobbler 服务端的网络模式一致。
创建过程省略,直接来到开机启动界面:
可以看到,需要安装 1262 个包,不再是原来的最小化安装了。
安装成功后,默认启动命令行模式 输入 root 123456 登录系统:
设置默认启动模式为图形化模式 graphical.target
[root@localhost ~]# systemctl get-defaultmulti-user.target[root@localhost ~]# systemctl set-default graphical.targetRemoved symlink /etc/systemd/system/default.target.Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.[root@localhost ~]# systemctl get-default graphical.target[root@localhost ~]# reboot
不能正常启动图形化模式
安装图形化软件
[root@localhost ~]# yum install -y xorg* gnome* glx*
切换到图形化模式
[root@localhost ~]# init 5
以上是“怎么使用Cobbler快速安装系统”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。