System deployment of operation and maintenance automation (semi automation)

Posted by beckjo1 on Fri, 18 Feb 2022 07:09:11 +0100

Make a semi-automatic deployment system today (install CentOS7 with CentOS8 as the service platform)

Prepare in advance to boot Files with ISO suffix or files with NEtinstall suffix.

If you want to deploy the system automatically, you need to use the response file, which is the document of the operation steps when installing the system. You can refer to the ". cfg" file under the BOOT.

[root@localhost ~]#vim ks.cfg 

#platform=x86, AMD64, or Intel EM64T     ##X86 architecture platform
#version=DEVEL
# Install OS instead of upgrade          ##Install the system, not upgrade the system
install
# Keyboard layouts
keyboard 'us'                ##country
# Root password
rootpw --plaintext 666666     ##root password
# System language
lang en_US                ##Keyboard standard
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use text mode install
text                 ##Non graphical installation, text mode
firstboot --disable         ##Disable firewall
# SELinux configuration
selinux --disabled      ##Disable SELinux


# Firewall configuration
firewall --disabled
# Network information
network  --bootproto=dhcp --device=eth0       ##adapter name
# Reboot after installation
reboot                 ##Restart after successful installation
# System timezone
timezone Africa/Abidjan
# Use network installation
url --url="http://10.0.0.66/centos/7/ "## specify image service
# System bootloader configuration
bootloader --append="net.ifnames=0" --location=mbr      ##Change the network card name to "eth0"
# Clear the Master Boot Record
zerombr                           ##Clear primary boot partition
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information          ##Partition, create your own partition, and specify the size in MB.
part / --fstype="xfs" --size=102400
part /boot --fstype="ext4" --size=1024
part /data --fstype="xfs" --size=51200
part swap --fstype="swap" --size=2048

%post
mkdir /etc/yum,repos.d/bak                ##Post installation script, local yum source
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
cat > /etc/yum.repos.d/base.repo <<EOF
[base]
name=CentOS
baseurl=http://10.0.0.66/centos/$releasever/
        https://mirrors.huaweicloud.com/centos/$releasever/os/$basearch/
        https://mirrors.cloud.tencent.com/centos/$releasever/os/$basearch/
        https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=0


[extras]
name=extras
baseurl=https://mirrors.huaweicloud.com/centos/$releasever/ertxas/$basearch/
        https://mirrors.cloud.tencent.com/centos/$releasever/ertxas/$basearch/
        https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/ertxas/$basearch/
gpgcheck=0
enabled=1


[epel]
name=epel
baseurl=https://mirrors.huaweicloud.com/epel/$releasever/$basearch/
        https://mirrors.cloud.tencent.com/epel/$releasever/$basearch/
        https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/$basearch/
gpgcheck=0
enabled=1

EOF

%end

Another way is to need a CentOS7 machine to make an answer file and install the "system config kickstart" tool. This tool has been cancelled in CentOS8 because red hat charges

This tool is a graphical tool. You need to install the "Xmanager" tool on the PC side

View the ports of Xmanager

[root@localhost ~]#export DISPLAY=10.0.0.1:0.0    ##Use this command to take effect
[root@localhost ~]#system-config-kickstart        ##Use this command to open the tool

It looks like this. If you can't understand it, just translate it. I can't understand it either. You can remember it after a few times. It is similar to that in the graphical installation system.

After configuring the answer file, verify whether the syntax of the answer file is correct

[root@centos7 ~]#ksvalidator ks7.cfg    ##If the grammar is correct or wrong without prompt, study it by yourself

After the response file is completed, it needs to be placed on the server,

[root@centos8 ~]#cd /var/www/html     ##In this directory of the server, create the KS folder. If there is no path, create the path
[root@centos8 /var/www/html]#mkdir ks
[root@centos8 /var/www/html]#ls
centos  ks

Remote copy file

[root@centos7 ~]#scp ks.cfg 10.0.0.66:/var/www/html/ks/centos7.cfg     ##Copy the file and rename it CentOS 7 cfg

Then copy the response file to the file directory just created on the server

[root@centos8 /var/www/html]#ls ks           ##After the exam, the file will be in this directory
centos7.cfg

Verify whether the answer file can access "if you need to open the httpd service on the server, please search the article about opening the httpd service"

After the above preparations are completed, you can install the system and take the next step all the way

 

 

Because we haven't done some network services yet, we still need to do some manual CD-ROM startup, but we don't need a complete image package boot or Netlmstall image package is OK.

Open the machine} this interface and press "esc"

When this interface appears, enter , enter the guidance position , enter , and he will start automatic installation,

He will restart automatically and directly enter the account login interface

Because a local yum source configuration is written in the post installation script in the answer file. Check that,,, have been configured

The above is semi-automatic installation. Companies with small demand can use this method, but large enterprises need pure automatic deployment and installation.

 

Topics: Linux Operation & Maintenance