We are currently using kickstart
to semi-automate the installation of CentOS 6
on several physical servers.However, because I don't know how to debug well, I burn and install the DVD every time I update the configuration file, and it takes about 30 minutes at a time.
Is there a more efficient (if possible) and easier way to validate?(For example, chef
can be used to install CentOS6
on a physical machine.)
Virtual machine construction is relatively common in the article, but I would appreciate it if you could tell me how to build physical machines automatically.I've heard keywords like Baremetal Deployment
but I think it's too much and complicated for a few configurations.
This physical server is the first machine in the local network, and you will be building a DNS, DHCP, or web server on it (although it may only be possible to temporarily prepare them on a development laptop when building a physical server).
linux centos
It may take a long time to build, but I immediately thought of doing an automatic installation using kickstart via PXE boot.
If you don't know, on PXE boot, ~ is what we call an installation from a network boot.
On this screen, you can boot up and install the operating system if you are instructed by DHCP.
Leave the necessary resources, such as the OS install image, on an http-accessible server.
The kickstart file will be placed in the same place, so even if you recreate the kickstart file, you only need to update the http server file, so once you rebuild it, it will be more efficient than re-burning the DVD.
However, it takes time (especially in the beginning) to create a PXE boot environment (*1), so it might take more time with a few.
(*1) PXE booting will be directed by the DHCP server, so you will need to build a DHCP server, tftp, http server, etc.
Can't we use this method?
For example, how about the following ks.cfg?
#Kickstart file automatically generated by anaconda.
# version = DEVEL
install
nfs --server=192.168.44.151 --dir=/images/cent6
langen_US.UTF-8
keyboard jp106
%include/tmp/network-ks.cfg
rootpw -- plaintext password
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux -- enforcement
timezone --utc Asia/Tokyo
zero br
bootloader --location=partition --driveorder=sda --append="crashkernel=auto"
clearpart --all --drives=sda --initlabel
part/boot/efi --ftype=efi --grow --maxsize=200 --size=50
part/boot --ftype=ext4 --size=500
part pv.vol1 --grow --size=1
volgroup vg_vol1 --pesize=4096 pv.vol1
logvol /--ftype=ext4--name=lv_root--vgname=vg_vol1--grow--size=1024--maxsize=51200
logvol swap --name=lv_swap --vgname=vg_vol1 --grow --size=1638 --maxsize=1638
repo --name="CentOS" --baseurl=nfs:192.168.44.151:/images/cent6 --cost=100
%packages
@core
@ server-policy
@workstation-policy
nfs-utils
%end
%pre--log=/root/anaconda-pre.log
#!/bin/bash
exec</dev/tty6>/dev/tty62>&1
chvt6
echo"===Please input this server information==="
read-p "Enter hostname:"NEWHOSTNAME
read-p "Enter IP address:"NEWIPADDR
read-p "Enter netmask:"NEWNETMASK
read-p "Enter default gw:"NEWGATEWAY
read-p "Enter DNS server IP:"NEWDNS
echo "network--bootproto=static--ip=${NEWIPADDR}--netmask=${NEWNETMASK}--gateway=${NEWGATEWAY}--nameserver=${NEWDNS}--device=eth0--onboot=yes--hostname=${NEWHOSTNAME}}">tmp/kfwork.cg
chvt1
%end
%post --log=root/anaconda-post.log --erroronfail
echo "192.168.44.151 master" >>/etc/hosts
mkdir/mnt2
mount-tnfs192.168.44.151:/images/work/mnt2
rpm-ivh/mnt2/chef-11.12.2-1.el6.x86_64.rpm
mkdir-p/etc/chef
cp/mnt2/validation.pem/etc/chef/validation.pem
chmod0600/etc/chef/validation.pem
cp/mnt2/client.rb/etc/chef/client.rb
/usr/bin/chef-client
%end
#reboot
As for the first setting, I have no choice but to use physical media, so I think USB or DVD is easy.Also, I think USB is more convenient to repeat.
First, prepare an imaging environment.If you haven't already built it, create an environment where you can automatically create a DVD image.This environment can also be used for PXEBOOT images described by someone else, so it would be convenient to have one.Also, it would be convenient to use the same image creation environment to create a USB.
I think there are many ways to go from here.Also, there may be many conditions such as a lot or little of the package configuration, or only changing the configuration file, but you may want to separate 1) setting the base part fast, 2) adding packages and 3) replacing the configuration file.
For example, you can create a disk image and store it in USB, copy the image (change the partition size if necessary) and install it on top of it.Overwrite 2) and 3) on it.If you take the step of merging the results of 2) and 3) once it stabilizes to a certain extent, you will be able to save a lot of time.
Of course, it takes a lot of time and debugging, so I hope it's worth the effort.
© 2024 OneMinuteCode. All rights reserved.