实验题·cobbler网络装机
设置CentOS 7.6 服务端
[root@localhost opt]# yum -y install epel* ===>安装软件源
[root@localhost ~]# yum -y install cobbler ===>安装需要用到的软件
[root@localhost ~]# yum -y install cobbler-web dhcp tftp-server pykickstart httpd rsync xinetd ===>安装所需软件
[root@localhost ~]# cd /etc/cobbler ===>进入该目录
[root@localhost ~]# vim settings ===>主配置文件(包含dhcp,tftp等等)
......
next_server: 20.0.0.10 ===>指向自己
......
server: 20.0.0.10 ===>指向自己
......
manage_dhcp: 1 ===>开启dhcp
......
[root@localhost cobbler]# systemctl start httpd ===>启动服务
[root@localhost cobbler]# systemctl start cobblerd.service ===>启动服务
[root@localhost cobbler]# systemctl stop firewalld ===>关闭防火墙
[root@localhost cobbler]# setenforce 0 ===>关闭核心防护
[root@localhost cobbler]# cobbler check ===>检测一下(下面的1-3项可以忽略不处理)
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 : 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
[root@localhost cobbler]# vim /etc/xinetd.d/tftp ===>修改tftp配置文件
......
disable = no
.....
[root@localhost cobbler]# systemctl enable rsyncd.service ===>启用服务
[root@localhost cobbler]# systemctl restart cobblerd.service ===>重启一下服务
[root@localhost cobbler]# cobbler check ===>可以在检查一下还需要做哪些操作
[root@localhost cobbler]# openssl passwd -1 -salt '123456' '123456' ===>设置密码
$1$123456$wOSEtcyiP2N/IfIl15W6Z0
[root@localhost cobbler]# vim /etc/cobbler/settings ===>修改主配置文件
......
default_password_crypted: "$1$123456$wOSEtcyiP2N/IfIl15W6Z0" ===>管理员密码
......
[root@localhost cobbler]# systemctl start rsyncd ===>启动服务
[root@localhost cobbler]# systemctl start xinetd ===>启动服务
[root@localhost cobbler]# cd /etc/cobbler/ ===>进入该目录
[root@localhost cobbler]# ls
auth.conf ldap secondary.template
cheetah_macros modules.conf settings
cobbler_bash mongodb.conf tftpd.template
completions named.template users.conf
dhcp.template power users.digest
dnsmasq.template pxe version
genders.template reporting zone.template
import_rsync_whitelist rsync.exclude zone_templates
iso rsync.template
[root@localhost cobbler]# vim dhcp.template ===>修改配置文件
......
subnet 20.0.0.0 netmask 255.255.255.0 {
......
option routers 20.0.0.2;
option domain-name-servers 20.0.0.3;
......
range dynamic-bootp 20.0.0.100 20.0.0.200;
......
[root@localhost cobbler]# cobbler sync ===>进行同步
[root@localhost cobbler]# cobbler get-loaders ===>下载软件(需要联网)
[root@localhost cobbler]# systemctl restart dhcpd ===>开启服务
[root@localhost cobbler]# systemctl restart cobblerd.service ===>开启服务
[root@localhost cobbler]# systemctl restart xinetd.service ===>开启服务
[root@localhost cobbler]# 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 : 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.
[root@localhost cobbler]# vim /var/log/cobbler/cobbler.log ===>日志文件所在位置
[root@localhost cobbler]# mount /dev/cdrom /mnt ===>挂载镜像文件
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost cobbler]# cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64 ===>定义路径名字 将镜像文件导入
[root@localhost cobbler]# cobbler list ===>查看列表
distros:
CentOS-7-x86_64
profiles:
CentOS-7-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
[root@localhost cobbler]# yum -y install tree ===>安装一下软件
[root@localhost cobbler]# tree /var/lib/tftpboot/images ===>查看内核文件跟引导程序
[root@localhost cobbler]# systemctl restart cobblerd.service ===>重新启动下服务
[root@localhost cobbler]# systemctl restart dhcpd.service ===>重新启动下服务
[root@localhost cobbler]# systemctl restart xinetd.service ===>重新启动下服务
[root@localhost cobbler]# systemctl restart httpd.service ===>重新启动下服务
新开一台测试的虚拟机(需要在同一个网段) ===>默认字符界面
默认是root用户,密码是之前设置好的"123456"
第一种cobbler_web进行操作
[root@localhost cobbler]# vim /etc/cobbler/modules.conf ===>进入配置文件无需修改
添加管理用户用web访问
[root@localhost cobbler]# htdigest -c /etc/cobbler/users.digest Cobbler binbin
Adding password for binbin in realm Cobbler.
New password:
Re-type new password:
[root@localhost cobbler]# systemctl restart cobblerd.service ===>重启启动服务
[root@localhost cobbler]# systemctl restart httpd.service ===>重启服务
第二种pam认证
[root@localhost cobbler]# vim /etc/cobbler/modules.conf ===>修改配置文件
......
[authentication]
module = authn_pam
......
[authorization]
module = authz_ownership
......
[root@localhost cobbler]# useradd webuser ===>创建用户
[root@localhost cobbler]# passwd webuser ===>设置密码
[root@localhost cobbler]# vim /etc/cobbler/users.conf ===>修改配置文件
......
[admins]
admin = ""
cobbler = ""
webuser = ""
[root@localhost cobbler]# systemctl restart cobblerd.service ===>重启启动服务
[root@localhost cobbler]# systemctl restart httpd.service ===>重启服务
nf ===>修改配置文件
…