这篇文章主要为大家展示了“cobbler如何实现自动化无人值守安装”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“cobbler如何实现自动化无人值守安装”这篇文章吧。
专注于为中小企业提供成都网站设计、做网站服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业大关免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了成百上千企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
root@localhost ~]# yum install epel-release -y ##安装源码包 ##安装必要组件 yum install -y \ cobbler \ ##安装cobbler\ cobbler-web \ ##网页形式管理 dhcp \ ##地址分配服务 tftp-server \ ##放压缩和引导文件 pykickstart \ ##Python开发的kickstart httpd \ ##网络服务 rsync \ ##远程同步管理 xinetd ##管理平台
[root@localhost ~]# cd /etc/cobbler/ [root@localhost cobbler]# ls auth.conf import_rsync_whitelist pxe users.conf cheetah_macros iso reporting users.digest cobbler_bash ldap rsync.exclude version completions modules.conf rsync.template zone.template dhcp.template MongoDB.conf secondary.template zone_templates DNSmasq.template named.template settings genders.template power tftpd.template [root@localhost cobbler]# vim settings 278 next_server: 192.168.136.179 ##修改地址为服务器地址 279 server: 192.168.136.179 ##添加服务器地址 280 manage_dhcp: 1 ##开启dhcp [root@localhost cobbler]# systemctl start httpd.service ##开启http服务 [root@localhost cobbler]# systemctl start cobblerd.service ##开启cobbler服务 [root@localhost cobbler]# systemctl stop firewalld.service ##关闭防火墙 [root@localhost cobbler]# setenforce 0 ##关闭增强功能
[root@localhost cobbler]# cobbler check [root@localhost cobbler]# 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 cobbler]# systemctl enable rsyncd.service ##优化开启远程同步管理服务 [root@localhost cobbler]# openssl passwd -1 -salt 'abc123''abc123' ##设置管理员密码 Password: $1$abc123ab$Z6awNYIN3LrF2YlvXPh6N. ##复制此段是盐值加密过后的密文 [root@localhost cobbler]# vim /etc/cobbler/settings 101 default_password_crypted: "$1$abc123ab$Z6awNYIN3LrF2YlvXPh6N." ##第101行把我们刚才设置的 密码的密文复制到此处 [root@localhost cobbler]# systemctl start rsyncd.service ##启动服务 [root@localhost cobbler]# systemctl restart xinetd.service
[root@localhost cobbler]# vim /etc/cobbler/dhcp.template subnet 192.168.136.0 netmask 255.255.255.0 { ##修改本地服务器的网段 option routers 192.168.136.1; option domain-name-servers 192.168.136.1; option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.136.100 192.168.136.254; ##地址池 [root@localhost cobbler]# cobbler sync ##同步生成dhcp配置文件(/etc/dhcp/dhcp.conf) task started: 2019-11-15_154150_sync task started (id=Sync, time=Fri Nov 15 15:41:50 2019) running pre-sync triggers cleaning trees [root@localhost cobbler]# systemctl restart dhcpd.service ##启动dhcp服务 [root@localhost cobbler]# systemctl start cobblerd.service ##启动cobbler服务 [root@localhost cobbler]# systemctl start xinetd.service ##启动管理平台服务
[root@localhost cobbler]# mount /dev/cdrom /mnt/ ##将镜像挂载到mnt目录 mount: /dev/sr0 写保护,将以只读方式挂载 [root@localhost cobbler]# cd /mnt/ [root@localhost mnt]# ls CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7 EFI images Packages RPM-GPG-KEY-CentOS-Testing-7 EULA isolinux repodata TRANS.TBL [root@localhost mnt]# cobbler import --path=/mnt/ --name=Centos-7-x86_64 --arch=x86_64
[root@localhost ks_mirror]# ls Centos-7-x86_64 config [root@localhost ks_mirror]# cobbler list ##查看文件信息 distros: Centos-7-x86_64 profiles: Centos-7-x86_64 systems: repos: images: mgmtclasses: packages: files:
[root@localhost ks_mirror]# yum install tree -y ##安装tree工具 [root@localhost ks_mirror]# tree /var/lib/tftpboot/images ##查看压缩内核和引导文件 /var/lib/tftpboot/images └── Centos-7-x86_64 ├── initrd.img ##引导文件 └── vmlinuz ##压缩内核
[root@localhost ks_mirror]# systemctl restart cobblerd.service [root@localhost ks_mirror]# systemctl restart dhcpd.service [root@localhost ks_mirror]# systemctl restart xinetd.service [root@localhost ks_mirror]# systemctl restart httpd.service
代码:[root@localhost ~]#yum groupinstall "GNOME Desktop" 代码:[root@localhost ~]# yum groupinstall 'KDE Plasma Workspaces" -y 代码:[root@localhost ~]# yum groupinstall "X Window System" 或者"Graphical Administration Tools"
[root@localhost ks_mirror]# vim /etc/cobbler/modules.conf ##配置模块配置文件 module = authn_configfile ##默认开启 [root@localhost ks_mirror]# htdigest -c /etc/cobbler/users.digest Cobbler adadmin ##创建用户密码 Adding password for adadmin in realm Cobbler. New password: ##输入密码 Re-type new password: [root@localhost ks_mirror]# systemctl restart cobblerd.service ##重启cobbler服务 [root@localhost ks_mirror]# systemctl restart httpd.service ##重启httpd服务
[root@localhost ks_mirror]# vim /etc/cobbler/modules.conf ##修改模块配置文件 [authentication] module = authn_pam ##修改成pam认证模块 [authorization] module = authz_ownership ##指定访问权限 [root@localhost ks_mirror]# useradd webuser ##创建系统用户 [root@localhost ks_mirror]# passwd webuser ##设置密码 更改用户 webuser 的密码 。 新的 密码: 无效的密码: 密码少于 8 个字符 重新输入新的 密码: passwd:所有的身份验证令牌已经成功更新。 [root@localhost ks_mirror]# vim /etc/cobbler/users.conf ##修改cobbler下的users.conf文件 [admins] admin = "" cobbler = "" webuser = "" ##添加用户 [root@localhost ks_mirror]# systemctl restart httpd.service ##重启服务 [root@localhost ks_mirror]# systemctl restart cobblerd.service
以上是“cobbler如何实现自动化无人值守安装”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!