Automatic installation of CentOS based on business requirements
Source: Internet
Author: User
Automatically install CentOS according to business requirements. in a few days, 29 servers will be installed in the data center, and the system will be installed. There are too many machines and you want to install them automatically. because there is no testing machine, the experiment is all implemented on the virtual machine. in order to complete the deployment, you have thought of several solutions. after all, you can go back to the dormitory after the deployment is completed early, don't go to public... information & automatic installation of CentOS based on business customization
In a few days, 29 servers will be mounted in the data center, and the system needs to be installed. There are too many machines and you want to install them automatically. because there is no testing machine, the experiment is all implemented on the virtual machine. in order to complete the deployment, you have thought of several solutions. after all, you can go back to the dormitory after the deployment is completed early, you don't have to go to the company anymore.
The general operation is to find a DVD and install it according to business needs (such as the partition installation package language). after the installation is complete, the system will create an automatic installation system cfg template file, in the/root directory. At the same time, the root directory has an install. the log file records the packages installed in the system. then, based on the file records, extract the required packages from the DVD and reencapsulate them into a new image, copy the automatic installation file under the root directory to the new image directory, and then make a small modification.
Step 1: First mount the DVD image;
[Root @ localhost ~] # Mount/dev/cdrom/mnt ### mount the image to the/mnt Directory
Step 2: create a directory to save the files that require service packages and new images;
[Root @ localhost ~] # Mkdir-p iso/CentOS
[Root @ localhost CentOS] # pwd
/Root/iso/CentOS
Step 3: extract the packages required by the business. The system installation package names mentioned above are recorded in the install. log file of the root directory;
[Root @ localhost ~] # Awk '/Installing/{print $2}' install. log | sed's/^ [0-9] *: // g'> The package.txtpackage.txt file stores all packages installed in the current system;
Step 4: extract the required package from the DVD image based on the package content and put it in the/root/iso/CentOS directory;
[Root @ localhost ~] # Cat cp. sh
#! /Bin/bash
DVD = '/mnt/CentOS' # path of the DVD image storage package
PACKDIR = '/root/package.txt' # records the names of all packages installed in the system.
NEW_DVD = '/root/iso/CentOS/' # storage path of the package required for the new image
While read LINE
Do
Cp $ {DVD}/$ {LINE} *. rpm/$ {NEW_DVD} | echo "$ LINE don't cp ......."
Step 5 of done <package.txt: copy other files required by the image to the iso directory, which is no different from the attached DVD image except for the lack of some packages.
[Root @ localhost CentOS] # rsync-a -- exclude = CentOS/mnt // root/iso # This command is used to remove the/mnt directory from the CentOS directory, other files are copied to the/root/iso directory.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.