Cobbler automatically deploys Linux installation (step by step to teach you to install)
table of Contents
- Preface
- 1. Experiment preparation
-
- (1) Cobbler automatic installation service construction steps
-
- 1. Import epel source
- 2. Install Cobbler and its related service packages
- 3. Start related services and close the firewall and selinux
- 4. Use the cobbler check command to check the settings of Cobbler, and query items that need to be changed.
- 5. Configure dhcp service
- 6. Synchronize the configured template file to the configuration file of the DHCP service
- 7. Restart the DHCP service
- 8. Import ISO image file
- 9. Restart all services
- 10. Use cobbler check to check settings for Cobbler
- 11. After all configurations are completed, open the blank host to automatically install the system
Preface
- Cobbler is an open source project developed using Python. It provides a fully automated batch and rapid network installation environment for Linux systems by concentrating all the services involved in the deployment system.
- Cobbler initially supports Fedora, RedHat and derivatives (such as CentOS and Scientific Linux), but also supports Debian, Ubuntu, SuSE, FreeBSD, ESXI, etc.
- Cobbler Chinese translation: Cobbler
- Cobbler provides DHCP management, YUM source management, power management and other functions. In addition, it also supports command line management, WEB interface management, and provides API interfaces to facilitate secondary development.
1. Experiment preparation
l A Linux server (Centos7 system, IP: 192.168.126.10)
l A blank virtual machine
l Need to be connected to the Internet, and all virtual machines use NAT mode
****Related software package: **** Link: https://pan.baidu.com/s/1Cl2H_cufGmbHCWfs_mObCQ Password: desg (The downloaded software package can be directly dragged into xSHELLL to install directly, or look at my previous window Sharing files with Linux can also be installed)
(1) Cobbler automatic installation service construction steps
1. Import epel source
rpm –ivh epel-release-latest-7.noarch.rpm #安装依赖包(刚刚下载好的软件)
yum list #自动加载在线更新
2. Install Cobbler and its related service packages
yum install -y cobbler dhcp tftp-server pykickstart httpd rsync xinetd
`#The functions of each software are as follows`
\#cobbler 用来快速建立Linux网络安装环境
\#dhcp 用来为空白主机自动分配IP地址
\#tftp-server 提供引导镜像文件的下载
\#pykickstart 实现无人值守安装
\#httpd 作为控制台程序运行
\#rsync 实现数据同步
\#xinetd 提供访问控制、加强的日志和资源管理功能
修改cobbler主配置文件
vim /etc/cobbler/settings
修改以下几项
next_server: 192.168.80.10 #指向tftp服务器的IP,即本机IP
server: 192.168.80.10 #指向cobbler服务器的IP,即本机IP
manage_dhcp: 1 #让cobbler管理dhcp服务
manage_rsync: 1 #让cobbler管理rsync服务
manage_tftp: 1 #让cobbler管理tftp服务
Others can be modified one by one according to the requirements, save and exit
3. Start related services and close the firewall and selinux
systemctl start httpd.service #开启http服务
systemctl start cobblerd.service #开启cobbler服务
systemctl stop firewalld
setenforce 0
4. Use the cobbler check command to check the settings of Cobbler, and query items that need to be changed.
cobbler check
(1) Open tftp service and rsync service
修改tftp的配置文件
vim /etc/xinetd.d/tftp
开启服务:
systemctl restart xinetd.service
systemctl start rsyncd.service
下载引导操作系统文件
cobbler get-loaders
(2) Set the initial password of the Cobbler user
使用盐值加密方式生成密钥
openssl passwd -1 -salt 'abc123' 'abc123' (给root用户设置密码)
将生成的密钥加入Cobbler配置文件中
vim /etc/cobbler/settings
5. Configure dhcp service
修改Cobbler管理dhcp服务的模板文件
vim /etc/cobbler/dhcp.template
subnet 192.168.126.0 netmask 255.255.255.0 {
option routers 192.168.126.1; #修改网关
option domain-name-servers 192.168.126.2; #修改DNS,如果网卡使用的是dhcp模式,可通过nslookup 127.0.0.1 | grep server 查询DNS地址(我自己使用的是static模式,通过ens-33配置文件查询也可以)
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.126.88 192.168126.188; #修改地址池
6. Synchronize the configured template file to the configuration file of the DHCP service
cobbler sync
7. Restart the DHCP service
systemctl restart dhcpd.service
8. Import ISO image file
挂载镜像文件
mount /dev/cdrom /mnt
导入iso镜像中的Linux 内核、初始化镜像文件
cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64
`#Parameter description`
\#--path 表示镜像所挂载的目录
\#--name 表示为安装源定义的名字
\#--atch 表示指定安装源的系统位
\#默认导入存放路径为/var/www/cobbler/ks_mirror/CentOS-7-x86_64
Check whether the kernel and initialization files are in the tftp-server shared directory
yum install -y tree #系统默认没有安装,需手动安装tree
tree /var/lib/tftpboot/images #查看文件是否存在
9. Restart all services
systemctl restart cobblerd.service
systemctl restart dhcpd.service
systemctl restart xinetd.service
systemctl restart httpd.service
10. Use cobbler check to check settings for Cobbler
11. After all configurations are completed, open the blank host to automatically install the system
此安装方式为最小化安装,安装的系统只有字符界面
登录账户:root 密码:111111