cobbler安装系统(基于网络)

cobbler

cobbler的安装配置,搭建环境centos7.4
1.检查当前环境的selinux和iptables是否关闭,相关命令getenforce、setenforce、systemctl  status firewalld。
2.安装配置cobbler需要连接外网,需首先配置yum源,保证能从互联网上下载安装包。
3.安装cobbler、dhcp、tftp和http,因为有些安装包和cobbler有依赖性,所以会自动安装上,执行命令yun install -y cobbler dhcp。
4.使用rpm -ql cobbler查看cobbler相关的服务,cobbler的服务名叫cobblerd。
5.把相关的服务设为开机启动,systemctl enable cobblerd dhcpd httpd tftp。
6.把服务都启动起来,systemctl start cobblerd httpd tftp,dhcp服务因为没有配置而无法启动,使用ss -ntl查看相关端口已经开启。
6.执行cobbler check,进行检查当前环境缺少哪些东西
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.
修改/etc/cobbler/settings文件中的server地址,修改这个地址为本机的IP地址
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.
修改/etc/cobbler/settings文件中的next_server地址,修改这个地址为本机的IP地址
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
本机的selinux是关闭的不用管这一项
4) : change ‘disable’ to ‘no’ in /etc/xinetd.d/tftp
这一项是说把tftp的服务启动起来,由于开始就启动了,所以这一项也不用管
5) : 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.
执行cobbler get-loaders命令,把需要的东西下载到/var/lib/cobbler/loaders/文件夹下,然后再执行命令cobbler sync命令,把文件拷贝到/var/lib/tftpboot文件夹下
6) : enable and start rsyncd.service with systemctl
和当前的服务关系不大,可以不用理会
7) : debmirror package is not installed, it will be required to manage debian deployments and repositories
缺少安装包,但是不是在centos环境中,所以这个也不用管
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
在/etc/cobbler/settings中有一项default_password_crypted默认密码是cobbler,需要手工创建密码,并且把加密后的密码再放到这个地方,使用工具openssl passwd -1,
9) : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
不需要做这一项,和电源和集群有关
7.通过cobbler管理dhcp服务,启动dhcp服务,在/etc/cobbler/settings中找到manage_dhcp这一项,默认为零改为1
8.把上面的都做完之后重启服务,systemctl restart cobblerd
9.修改dhcp的配置模板,通过这个模板会自动生成dhcp的配置文件,vim /etc/cobbler/dhcp.template(和dhcp的配置文件格式相似,按照之前的修改就行)
10.修改完以后就可以同步一下cobbler sync,使用ss -ntl查看dhcp的服务器端口67是否启动。
11.准备把光盘挂载上去,可以同时挂载几个盘,并重启服务systemctl restart cobblerd。
12.把光盘中的内容导入系统,新建/mnt/cdrom0和/mnt/cdrom1分别把光盘挂载上去,执行命令cobbler import –path=/mnt/cdrom1 –name=centos-6.9-x86_64(系统盘的名称) –arch=x86_64(基于的架构) cobbler import –path=/mnt/cdrom0 –name=centos-7.4-x86_64 –arch=x86_64,导入的光盘都放到/var/www/cobbler/ks_mirror目录下,导入以后系统默认生成的有最小化安装的应答文件
==========================================================================
至此,就可以实现安装了,新开个虚拟机网络安装就可以了,默认是采用逻辑卷分区安装,如果不设置密码的的话,默认的密码是cobbler
==========================================================================cobbler的相关命令

cobbler check检查配置环境

cobbler distro list 查看导入的系统信息
cobbler distro remove –name=”使用list查看的名称”
cobbler profile list 查看应答文件的信息
cobbler profile remove –name=”使用应答文件查看的名称” 相当于删除菜单中的对应项。注意:要先删除profile再删除distro
cobbler profile report –name=”使用profile list查看的名称” 了解菜单项的详细信息
=============================
在cobbler上绑定自己的应答文件
=============================
菜单上的设置有可能不是我们所要的,所以要绑定自己的菜单上去
把应答文件上传到/var/lib/cobbler/kickstarts/文件夹中
把应答文件的–url=改为–url=$tree
执行命令cobbler profile add –name=centos-6.9-x86_64_Mini –distro=centos-6.9-x86_64 –kickstart=/var/lib/cobbler/kickstarts/ks6_mini.cfg

====================
实现cobbler的web界面
====================
1.安装cobbler-web软件包,yum install cobbler-web -y
2.重新启动http服务,systemctl restart httpd
3.使用浏览器输入https://192.168.30.27/cobbler_web/就可以访问web界面了,但是需要输入账号和密码,需要后台创建账号和密码,在文件/etc/cobbler/modules.conf中查看调用的模块是authn_configfile,这个模块用/etc/cobbler/users.digest文件定义了账号和密码
4.使用命令生成账号和密码,htdigest -c /etc/cobbler/users.digest Cobbler test1回车后输入两遍密码就可以了
5.还可以使用pam模块验证,在/etc/cobbler/modules.conf文件中修改验证模块为module=authn_pam,pam模块调用了/etc/cobbler/users.conf文件,新建linxu用户useradd -s /sbin/nologin test2;echo magedu | passwd –stdin test2,然后把test2添加到/etc/cobbler/users.conf文件的管理员处,然后在重启cobbler服务,systemctl restart cobblerd

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/99616

联系我们

400-080-6560

在线咨询

工作时间:周一至周五,9:30-18:30,节假日同时也值班

QR code