Cobbler for automatic installation of CentOS
Outline
Objective
Cobbler Introduction
Experimental topology
Experimental steps
Test
Summarize
Objective
In the production environment we may need to install the operating system in bulk, we can of course install one by one, but 运维工作应该标准化、流程化、自动化,降低对特定人员的依赖,节省专业人员的宝贵时间和精力,这样才能有更多的时间去学习新的知识和提升。
– turn from: Chenming Blog
Then we should use the OPS tool to help us automate the installation quickly and in batches. Now the more popular solution is Cobbler
, this article describes the steps to Cobbler
implement batch auto-install Cenos 6.7
Cobbler Introduction
Cobbler
is a software that automates the building and deployment of systems, Cobbler
simplifies the operation of administrators through automated implementations and can be repeatedly deployed through templates, and enables Cobbler
virtualized deployments
Working components of the Cobbler
650) this.width=650; "class=" Alignnone size-full wp-image-122 "title=" Cobbler implementation of CentOS automatic Installation "src=" http://anyisalin.com /wp-content/uploads/2016/05/cobbler%e5%ae%9e%e7%8e%b0centos%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85.png "alt=" Cobbler implementation of the CentOS automatic installation "width=" 880 "height=" 494 "style=" Height:auto; "/>
Experimental topology
650) this.width=650; "class=" Alignnone size-full wp-image-121 "src=" http://anyisalin.com/wp-content/uploads/2016/05 /%e4%b8%8b%e8%bd%bd-4.png "alt=" Download (4) "width=" 922 "height=" 475 "style=" Height:auto; "/>
Experimental steps
Installation configuration DHCP and TFTP
DHCP configuration
[[email protected] ~]# Yum install DHCP Tftp-server-y[[email protected] ~]# vim/etc/dhcp/dhcpd.conf option Domain-name " anyisalin.com "; option domain-name-servers 172.16.1.1;subnet 172.16.1.0 netmask 255.255.255.0 {range 172.16.1.10 17 2.16.1.20; Option routers 172.16.1.1;} Next-server 172.16.1.7;filename= "pxelinux.0";
TFTP and Sync configuration
[[email protected] ~]# 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}[[email protected] ~]# vim /etc/xinetd.d/rsync service rsync{ disable = no flags = IPv6 socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure = userid}
Start TFTP, rsync, and DHCP
[[Email protected] ~]# service DHCPD startstarting dhcpd: [OK][[email Prote CTED] ~]# service xinetd startstarting xinetd: [OK]
Installing Cobbler
We need epel source [[email protected] ~]# Wget-o/etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo[[email Protected] ~]# yum install cobbler Cobbler-web pykickstart debmirror-y
Start and test Cobbler
[[Email protected] ~]# service cobblerd startstarting Cobbler daemon: [OK][[email PR Otected] ~]# Pkill cobbler #不知道为什么, first boot to kill the process [[email protected] ~]# service Cobblerd start #重新启动Starting Cobbler D Aemon: [OK]
Modifying the Cobbler configuration file
[Email protected] ~]# vim/etc/cobbler/settings #修改以下两项server: 172.16.1.7next_server:172.16.1.7default_password_ crypted: "$1$13b50228$tdxyyyr9hhxqkusgmiovf/" #指定默认的密码, using OpenSSL passwd-1-salt ' OpenSSL rand-hex 4 ' Build
Download the PXE boot file
[[email protected] ~]# Cobbler get-loaders #如果不能连接互联网, install Syslinux First, then copy/USR/SHARE/SYSLINUX/{PXELINUX.0,MEMU.C32} file to/var/lib/cobbler/loaders/directory; [email protected] ~]# cp/var/lib/cobbler/loaders/*/var/lib/tftpboot/# Copy files from the loaders directory to Tftproot
Provision of software repositories
[Email protected] ~]# mount/dev/sr0/mnt/#挂载本地光盘;
Provide KS files
[Email protected] ~]# grep-v \\\ ' ^[[:space:]]*#\\\ ' ks2.cfg #按自己需要自行修改firewall--enabled--service=sshinstallurl--ur l= $treerootpw--iscrypted $1$pn/zbyoq$p3jwvhjzfpwz6la3k.led.auth--useshadow--passalgo=sha512graphicalfirstboot-- Disablekeyboard Uslang en_usselinux--enforcinglogging--level=infotimezone america/new_yorknetwork--bootproto=dhcp --device=eth0--onboot=onbootloader--append= "Crashkernel=auto rhgb quiet"--location=mbr--driveorder= "SDA" Zerombrclearpart--all--initlabel part/boot--fstype= "Ext4"--size=200part/--fstype= "EXT4"--grow--size=1%packages- -nobase@core%end
Add distro and Profile
[Email protected] ~]# Cobbler import--name=centos-6.7--path=/mnt/#出现TASK complete stands for success [[email protected] ~]# Cobbler Distro list #可以查看到当前的distro Centos-6.7-x86_64[[email protected] ~]# CP ks2.cfg/var/lib/cobbler/kickstarts/#将ks文件复制到 Specify directory [[email protected] ~]# Cobbler profile add--name cenos-6.5-minal--distro=centos-6.7-x86_64--kickstart=/var/lib/ Cobbler/kickstarts/ks2.cfg #添加profile [[email protected] ~]# Cobbler profile list #查看profile cenos-6.5-minal centos- 6.7-x86_64# #由于centos7做法差不多, so it doesn't show up.
Test
650) this.width=650; "class=" Alignnone size-full wp-image-118 "src=" http://anyisalin.com/wp-content/uploads/2016/05 /gif.gif "alt=" GIF "width=" 1179 "height=" 691 "style=" Height:auto; "/>
Summarize
The use of Cobbler
installation systems increases the efficiency of our operations, so that more time is available to learn new knowledge and improve.
The content of the article is a scratch, we have better ideas can be put forward
Author: Anyisailn qq:1449472454
Thank you: mageedu
This article is from the "Road of Operations Engineers" blog, please be sure to keep this source http://anyisalin.blog.51cto.com/10917514/1773493
Cobbler for automatic installation of CentOS