CentOS 6.5 x86_64 custom automatic system deployment

Source: Internet
Author: User

CentOS 6.5 x86_64 custom automatic system deployment

I. Prepare the production environment
Lab environment:
VMware Workstation
CentOS-6.5-x86_64-minimal minimal installation
After installation, we will use the install. log and anaconda-ks.cfg files under the system/root directory (which is easier to modify)

1.1 customization steps
1. Install the minimal operating system, including basic systems and required tools.
For example, for http, mysql, and other software, it is recommended to install it by compiling and then package it in to reduce the trouble of many dependent packages.
2. After installing the system, collect the software packages installed in the system and use scripts to uniformly store them in a directory.
3. Copy the images image on the installation disc and start centos from the disc to install the required files.
4. define your own kickstart installation script.
5. Re-generate the report information of the CD based on the previously stored software (rpm) package.
6. Package and generate an ISO file and an MD5 verification code.

1.2 install the required Toolkit
[Root @ bkjia ~] # Yum-y install anaconda repodata createrepo mkisofs rsync

1.3 download CentOS 6.5 Image

To facilitate production, we can install it in virtual environments such as VMware, vbox, and xen. Here we choose VMware as the production environment. We can download the CentOS image file from the official website or other close image sites. CentOS-6.4-x86_64-minimal.iso

Ii. Custom System
2.1 CD directory structure

* The isolinux directory stores the installation interface information when the CD is started.
* The images directory contains the necessary startup image files.
* The Packages directory stores the installation package and information.
* The discinfo file is the identifier of the installation price.
 
MediaCentOS directory stores the media center installation package
Store rpm package dependency information in the Repodata directory
 
5. x Series, boot. iso exists in the images/directory.
6. x Series, stored in the/isolinux directory
6. Download The netinstall. iso image file from the official website.

2.2 mount and copy files

Directory planning:
Mount Directory:/mnt

Custom CD file directory:/root/iso

[Root @ bkjia ~] # Pwd
/Root
[Root @ bkjia ~] # Mkdir iso # create an iso file directory
[Root @ bkjia ~] # Mkdir-p./iso/{Packages, repodata} # create the package directory and repodata directory
[Root @ bkjia ~] # Mount/dev/cdrom/mnt # mount a DVD
Mount: block device/dev/sr0 is write-protected, mounting read-only

# Copy all files in the Packages and repodata directories of the source DVD image to the iso directory.
[Root @ bkjia ~] #/Usr/bin/rsync-a -- exclude = Packages -- exclude = repodata/mnt/./iso/
[Root @ bkjia ~] # Ls iso
CentOS_BuildTag GPL Packages RPM-GPG-KEY-CentOS-6 RPM-GPG-KEY-CentOS-Testing-6
EFI images RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Debug-6 TRANS. TBL
EULA isolinux repodata RPM-GPG-KEY-CentOS-Security-6

# Copy the installation package of the current system
[Root @ bkjia ~] # Awk '/Installing/{print $2}' install. log | xargs-I cp/mnt/Packages/{}. rpm./iso/Packages/
[Root @ bkjia ~] # Ls iso/Packages/| wc-l
205

# Execute the createrepo program to generate the comps. xml file under repodata (important)
# The comps. xml file contains all rpm-related content that the user sees during installation. It checks
# RPM package dependency. If the dependency package is missing during installation, it will prompt you which RPM package requires which dependent libraries.

[Root @ bkjia ~] # Pwd
/Root
# Edit the shell script and execute
#! /Bin/bash

ISO_DIR =/root/iso
Cd $ {ISO_DIR}
Declare-x discinfo = $(head-1. discinfo)

Cp/mnt/repodata/*-minimal-x86_64.xml $ {ISO_DIR}/repodata/minimal-x86_64.xml

Createrepo-g $ {ISO_DIR}/repodata/minimal-x86_64.xml $ {ISO_DIR}

Createrepo-u "media: // $ discinfo"-g $ {ISO_DIR}/repodata/*-minimal-x86_64.xml $ {ISO_DIR}

###
The comps. xml file and other associated files have been regenerated to the repodata directory.
Tips2: If you have added or deleted the RPM package in the Packages directory, generate a new comps. xml file.


3. Create a ks. cfg script
The ks file is modified by the anaconda-ks.cfg created by the system installation, of course, it can also be made with the system-config-kickstart tool. Here you need to modify according to the actual situation:
Default root User Password: 123456

Static retrieval address

Hard Disk at least 15 GB

[Root @ bkjia ~] # Pwd
/Root
[Root @ bkjia ~] # Cp anaconda-ks.cfg./iso/isolinux/ks. cfg
[Root @ bkjia ~] # Vim./iso/isolinux/ks. cfg
# Make adjustments based on actual conditions

# Kickstart file automatically generated byanaconda.

# Version = DEVEL
Install
Cdrom
Lang en_US.UTF-8
Keyboard us
Network -- onboot yes -- device eth0 -- bootproto static -- noipv6 -- ip = 192.168.3.132 -- netmask = 255.255.255.0 -- gateway = 192.168.3.254
Rootpw -- iscrypted $6 $ 060kt9rryFXbrlgx $ response. JsNbgnMylQVbFRThPZwSdRKJcrAml7LQDdR00
Firewall -- service = ssh
Authconfig -- enableshadow -- passalgo = sha512
Selinux -- disabled
Timezone -- utc Asia/Chongqing

Text
Firstboot -- disable
Logging -- level = info
Reboot


Bootloader -- location = mbr -- driveorder = sda -- append = "crashkernel = auto rhgb quiet"
Zerombr

# The following is the partitioninformation you requested
# Note that any partitions you deleted arenot expressed
# Here so unless you clear all partitionsfirst, this is
# Not guaranteed to work
# Clearpart -- none

# Part/boot -- fstype = ext4 -- size = 200
# Part swap -- size = 2048
# Part/-- fstype = ext4 -- grow -- size = 200

Clearpart -- all -- initlabel
Part/boot -- fstype = ext4 -- size = 200
Part swap -- size = 2048
Part/-- fstype = ext4 -- size = 10240
Part/data -- fstype = ext4 -- size = 1 -- grow

# Repo -- name = "CentOS" -- baseurl = cdrom: sr0 -- cost = 100

% Packages -- nobase
@ Core
% End


4. Modify the isolinux. cfg configuration file and specify the ks path
Note: To edit this file, you must save it forcibly. : Wq!
[Root @ bkjia ~] # Vi./iso/isolinux. cfg

Default vesamenu. c32
# Prompt 1
Timeout 600

Display boot. msg

Menu background splash.jpg
Menu title Welcome to CentOS 6.5!
Menu color border 0 # ffffffff #00000000
Menu color sel 7 # ffffffff # ff000000
Menu color title 0 # ffffffff #00000000
Menu color tabmsg 0 # ffffffff #00000000
Menu color unsel 0 # ffffffff #00000000
Menu color hotsel 0 # ff000000 # ffffffff
Menu color hotkey 7 # ffffffff # ff000000
Menu color scrollbar 0 # ffffffff #00000000

Label linux
Menu label ^ Install or upgrade an existing system
Menu default
Kernel vmlinuz
Append initrd = initrd. img ks = cdrom:/isolinux/ks. cfg # Just modify it here.
Label vesa
Menu label Install system with ^ basic video driver
Kernel vmlinuz
Append initrd = initrd. img xdriver = vesa nomodeset
Label rescue
Menu label ^ Rescue installed system
Kernel vmlinuz
Append initrd = initrd. img rescue
Label local
Menu label Boot from ^ local drive
Localboot 0 xffff
Label memtest86
Menu label ^ Memory test
Kernel memtest
Append-

5. generate an iso image and generate an MD5 Verification Code
# Note the Directory
[Root @ bkjia ~] # Pwd
/Root
[Root @ bkjia ~] # Cd iso
[Root @ bkjia iso] # pwd
/Root/iso
[Root @ bkjia iso] # mkisofs-o CentOS-6.4_64.iso-input-charset UTF-8-B isolinux/isolinux. bin-c isolinux/boot. cat-no-emul-boot-load-size 4-boot-info-table-R-J-v-T-joliet-long/root/iso

Genisoimage 1.1.9 (Linux)
Scanning/root/iso
Excluded:/root/iso/TRANS. TBL
Scanning/root/iso/repodata
Scanning/root/iso/isolinux
Excluded:/root/iso/isolinux/TRANS. TBL
Excluded by match:/root/iso/isolinux/boot. cat
Scanning/root/iso/EFI
Excluded:/root/iso/EFI/TRANS. TBL
Scanning/root/iso/EFI/BOOT
Excluded:/root/iso/EFI/BOOT/TRANS. TBL
Scanning/root/iso/images
Excluded:/root/iso/images/TRANS. TBL
Scanning/root/iso/images/pxeboot
Excluded:/root/iso/images/pxeboot/TRANS. TBL
Scanning/root/iso/Packages
Using RPM_G000.; 1 for/RPM-GPG-KEY-CentOS-Debug-6 (RPM-GPG-KEY-CentOS-Security-6)
Using RPM_G001.; 1 for/RPM-GPG-KEY-CentOS-Security-6 (RPM-GPG-KEY-CentOS-6)
Using RPM_G002.; 1 for/RPM-GPG-KEY-CentOS-6 (RPM-GPG-KEY-CentOS-Testing-6)
Using CE2D6000. GZ; 1 for/root/iso/repodata/ce2d698b9fb1413b668443e88835a0642cea8f387c7f25cc946f56dd93f109bb-34bae2d3c9c78e04ed2429923bc095005af1b166d1a354422c4c04274bae0f59-minimal-x86_64.xml.gz labels)
Using NSS_S000.RPM; 1 for/root/iso/Packages/nss-softokn-freebl-3.14.3-9.el6.x86_64.rpm (nss-softokn-3.14.3-9.el6.x86_64.rpm)
Using OPENS000.RPM; 1 for/root/iso/Packages/openssh-5.3p1-94.el6.x86_64.rpm (openssh-clients-5.3p1-94.el6.x86_64.rpm)
Using DEVIC000.RPM; 1 for/root/iso/Packages/device-mapper-persistent-data-0.2.8-2.el6.x86_64.rpm (device-mapper-event-libs-1.02.79-8.el6.x86_64.rpm)
Using FIPSC000.RPM; 1 for/root/iso/Packages/fipscheck-1.2.0-7.el6.x86_64.rpm (fipscheck-lib-1.2.0-7.el6.x86_64.rpm)
Using DEVIC001.RPM; 1 for/root/iso/Packages/device-mapper-event-libs-1.02.79-8.el6.x86_64.rpm (device-mapper-multipath-libs-0.4.9-72.el6.x86_64.rpm)
Using CRYPT000.RPM; 1 for/root/iso/Packages/cryptsetup-luks-1.2.0-7.el6.x86_64.rpm (cryptsetup-luks-libs-1.2.0-7.el6.x86_64.rpm)
Using DEVIC002.RPM; 1 for/root/iso/Packages/device-mapper-multipath-libs-0.4.9-72.el6.x86_64.rpm (device-mapper-libs-1.02.79-8.el6.x86_64.rpm)
Using IPTAB000.RPM; 1 for/root/iso/Packages/iptables-1.4.7-11.el6.x86_64.rpm (iptables-ipv6-1.4.7-11.el6.x86_64.rpm)
Using LIBSE000.RPM; 1 for/root/iso/Packages/libselinux-utils-2.0.94-5.3.el6_4.1.x86_64.rpm (libselinux-2.0.94-5.3.el6_4.1.x86_64.rpm)
Using NCURS000.RPM; 1 for/root/iso/Packages/ncurses-libs-5.7-3.20090208.el6.x86_64.rpm (ncurses-5.7-3.20090208.el6.x86_64.rpm)
Using DEVIC003.RPM; 1 for/root/iso/Packages/device-mapper-libs-1.02.79-8.el6.x86_64.rpm (device-mapper-event-1.02.79-8.el6.x86_64.rpm)
Using DEVIC004.RPM; 1 for/root/iso/Packages/device-mapper-event-1.02.79-8.el6.x86_64.rpm (device-mapper-multipath-0.4.9-72.el6.x86_64.rpm)
Using NCURS001.RPM; 1 for/root/iso/Packages/ncurses-5.7-3.20090208.el6.x86_64.rpm (ncurses-base-5.7-3.20090208.el6.x86_64.rpm)
Using SELIN000.RPM; 1 for/root/iso/Packages/selinux-policy-3.7.19-231.el6.noarch.rpm (selinux-policy-targeted-3.7.19-231.el6.noarch.rpm)
Using E2FSP000. RPM; 1 for/root/iso/Packages/e2fsprogs-libs-1.41.12-18.el6.x86_64.rpm (e2fsprogs-1.41.12-18.el6.x86_64.rpm)
Using COREU000.RPM; 1 for/root/iso/Packages/coreutils-8.4-31.el6.x86_64.rpm (coreutils-libs-8.4-31.el6.x86_64.rpm)
Using CYRUS000.RPM; 1 for/root/iso/Packages/cyrus-sasl-2.1.23-13.el6_3.1.x86_64.rpm (cyrus-sasl-lib-2.1.23-13.el6_3.1.x86_64.rpm)
Using P11_K000.RPM; 1 for/root/iso/Packages/p11-kit-trust-0.18.5-2.el6.x86_64.rpm (p11-kit-0.18.5-2.el6.x86_64.rpm)
Using OPENS001.RPM; 1 for/root/iso/Packages/openssh-clients-5.3p1-94.el6.x86_64.rpm (openssh-server-5.3p1-94.el6.x86_64.rpm)
Using PLYMO000.RPM; 1 for/root/iso/Packages/plymouth-core-libs-0.8.3-27.el6.centos.x86_64.rpm (plymouth-0.8.3-27.el6.centos.x86_64.rpm)
Using CRACK000.RPM; 1 for/root/iso/Packages/cracklib-dicts-2.8.16-4.el6.x86_64.rpm (cracklib-2.8.16-4.el6.x86_64.rpm)
Using DEVIC005.RPM; 1 for/root/iso/Packages/device-mapper-multipath-0.4.9-72.el6.x86_64.rpm (device-mapper-1.02.79-8.el6.x86_64.rpm)
Using PLYMO001.RPM; 1 for/root/iso/Packages/plymouth-0.8.3-27.el6.centos.x86_64.rpm (plymouth-scripts-0.8.3-27.el6.centos.x86_64.rpm)
Writing: Initial Padblock Start Block 0
Done with: Initial Padblock Block (s) 16
Writing: Primary Volume Descriptor Start Block 16
Done with: Primary Volume Descriptor Block (s) 1
Writing: Eltorito Volume Descriptor Start Block 17
Size of boot image is 4 sectors-> No emulation
Done with: Eltorito Volume Descriptor Block (s) 1
Writing: Joliet Volume Descriptor Start Block 18
Done with: Joliet Volume Descriptor Block (s) 1
Writing: End Volume Descriptor Start Block 19
Done with: End Volume Descriptor Block (s) 1
Writing: Version block Start Block 20
Done with: Version block (s) 1
Writing: Path table Start Block 21
Done with: Path table Block (s) 4
Writing: Joliet path table Start Block 25
Done with: Joliet path table Block (s) 4
Writing: Directory tree Start Block 29
Done with: Directory tree Block (s) 27
Writing: Joliet directory tree Start Block 56
Done with: Joliet directory tree Block (s) 18
Writing: Directory tree cleanup Start Block 74
Done with: Directory tree cleanup Block (s) 0
Writing: Extension record Start Block 74
Done with: Extension record Block (s) 1
Writing: The File (s) Start Block 75
2.48% done, estimate finish Sat Apr 4 23:51:32 2015
4.95% done, estimate finish Sat Apr 4 23:51:12 2015
7.43% done, estimate finish Sat Apr 4 23:51:05 2015
9.90% done, estimate finish Sat Apr 4 23:51:02 2015
12.37% done, estimate finish Sat Apr 4 23:51:08 2015
14.85% done, estimate finish Sat Apr 4 23:51:05 2015
17.32% done, estimate finish Sat Apr 4 23:51:03 2015
19.80% done, estimate finish Sat Apr 4 23:51:07 2015
22.28% done, estimate finish Sat Apr 4 23:51:09 2015
24.75% done, estimate finish Sat Apr 4 23:51:08 2015
27.22% done, estimate finish Sat Apr 4 23:51:06 2015
29.69% done, estimate finish Sat Apr 4 23:51:05 2015
32.17% done, estimate finish Sat Apr 4 23:51:07 2015
34.64% done, estimate finish Sat Apr 4 23:51:06 2015
37.12% done, estimate finish Sat Apr 4 23:51:08 2015
39.59% done, estimate finish Sat Apr 4 23:51:07 2015
42.07% done, estimate finish Sat Apr 4 23:51:08 2015
44.54% done, estimate finish Sat Apr 4 23:51:07 2015
47.02% done, estimate finish Sat Apr 4 23:51:06 2015
49.49% done, estimate finish Sat Apr 4 23:51:08 2015
51.97% done, estimate finish Sat Apr 4 23:51:09 2015
54.44% done, estimate finish Sat Apr 4 23:51:08 2015
56.91% done, estimate finish Sat Apr 4 23:51:09 2015
59.39% done, estimate finish Sat Apr 4 23:51:08 2015
61.86% done, estimate finish Sat Apr 4 23:51:09 2015
64.34% done, estimate finish Sat Apr 4 23:51:09 2015
66.81% done, estimate finish Sat Apr 4 23:51:08 2015
69.29% done, estimate finish Sat Apr 4 23:51:07 2015
71.76% done, estimate finish Sat Apr 4 23:51:07 2015
74.24% done, estimate finish Sat Apr 4 23:51:06 2015
76.71% done, estimate finish Sat Apr 4 23:51:06 2015
79.18% done, estimate finish Sat Apr 4 23:51:05 2015
81.66% done, estimate finish Sat Apr 4 23:51:05 2015
84.14% done, estimate finish Sat Apr 4 23:51:05 2015
86.61% done, estimate finish Sat Apr 4 23:51:05 2015
89.09% done, estimate finish Sat Apr 4 23:51:05 2015
91.56% done, estimate finish Sat Apr 4 23:51:06 2015
94.04% done, estimate finish Sat Apr 4 23:51:05 2015
96.51% done, estimate finish Sat Apr 4 23:51:05 2015
98.98% done, estimate finish Sat Apr 4 23:51:05 2015
Total translation table size: 63812
Total rockridge attributes bytes: 28361
Total directory bytes: 49152
Path table size (bytes): 112
Done with: The File (s) Block (s) 201838
Writing: Ending Padblock Start Block 201913
Done with: Ending Padblock Block (s) 150
Max brk space used 5e000
202063 extents written (394 MB)

# OK, an image file named CentOS-6.4_64.iso will be created in the/root/iso directory
[Root @ bkjia iso] # ls *. iso
CentOS-6.4_64.iso

### MD5 Verification Code
[Root @ bkjia iso] # pwd
/Root/iso
[Root @ bkjia iso] # ls
CentOS-6.4_64.iso EULA isolinux repodata RPM-GPG-KEY-CentOS-Security-6
CentOS_BuildTag GPL Packages RPM-GPG-KEY-CentOS-6 RPM-GPG-KEY-CentOS-Testing-6
EFI images RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Debug-6 TRANS. TBL

[Root @ bkjia iso] #/usr/bin/implantisomd5 CentOS-6.4_64.iso
Inserting md5sum into iso image...
Md5 = 90d069e78dddfb79877b4ab1_ff2d50
Inserting fragment md5sums into iso image...
Fragmd5 = bytes
Frags = 20
Setting supported flag to 0
[Root @ bkjia iso] #

Vi. installation and testing
You can use Filezilla, winscp, and other software to upload an iso image. Then you can use the Virtual Machine installation test. If the test is normal, you can burn it into a CD.
Use VMware Workstation to create a virtual machine and then use the image we just created. Then start the virtual machine and it will be automatically installed. Is it so easy...

Three methods for configuring IP addresses in CentOS 6.5

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.