Customize your own linux release to streamline centos

Source: Internet
Author: User
Tags ossec

I have already succeeded in referring to this article, so I will record it here. I hope you can build your own linux version ..

To do well, you must first sharpen your tools. Before creating the release version, you need to install some software. The simplest method is to use CentOS yum!
# Yum-y install anaconda-runtime createrepo yum-utils anaconda-help busybox-anaconda mkisofs
 
After the tool is installed, you can start to create linux.
 
To create an opportunity for CentOS linux, you must install CentOS again. During installation, select the necessary packages, such as base, develop-tools, and text-internet, for others, it is best not to choose anything that is not available. The system created in this way can ensure the volume.
 
I installed CentOS for the first time on vmware workstation. After the installation is complete, you can find the anaconda-ks.cfg file in the/root/directory, you can use the cat command to view the content of this file, you will know the software packages installed before.
 
# Cat anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.
 
Install
Cdrom
Lang en_US.UTF-8
Keyboard us
Network -- device eth0 -- bootproto dhcp
Rootpw -- iscrypted $1 $ mrG7rARX $ 2zkvd4WLl2Lh5sD9aNP5Q.
Firewall -- enabled -- port = 22: tcp
Authconfig -- enableshadow -- enablemd5
Selinux -- enforcing
Timezone -- utc Asia/Shanghai
Bootloader -- location = mbr -- driveorder = sda
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# Here so unless you clear all partitions first, this is
# Not guaranteed to work
# Clearpart -- all -- drives = sda
# Part/boot -- fstype ext3 -- size = 100 -- ondisk = sda
# Part pv.2 -- size = 0 -- grow -- ondisk = sda
# Volgroup VolGroup00 -- pesize = 32768 pv.2
# Logvol swap -- fstype swap -- name = LogVol01 -- vgname = VolGroup00 -- size = 1024 -- grow -- maxsize = 2048
# Logvol/-- fstype ext3 -- name = LogVol00 -- vgname = VolGroup00 -- size = 1024 -- grow
 
% Packages
@ Development-libs
@ Editors
@ Text-internet
@ Legacy-network-server
@ Dialup
@ Core
@ Base
@ Network-server
@ Admin-tools
@ Development-tools
Kexec-tools
Device-mapper-multipath
Imake
 
With the above information, we have a background when making linux.
 
After completing the preceding operations, you can create directories in the/directory to store the files required by the linux release. For example, if I name my system RiceOS, I create a rice directory under the/directory to store the files required for the linux release.
 
P.s. The system here can be considered as a re-release version, so you can define it by yourself without being rigid.
 
# Mkdir/rice
 
We need to mount the CentOS dvd to linux. We can mount the optical drive or the iso file. before mounting, we first create a directory under the/mnt/directory, used for mounting.
 
# Mkdir/mnt/cdrom
 
# Mount-t iso9660-o loop/dev/cdrom/mnt/cdrom // mount the optical drive
 
# Mount-t iso9660-o loop/xxx/CentOS-5.3-i386-bin-DVD.iso/mnt/cdrom // mount the iso file, where xxx is the absolute path of the CentOS-5.3-i386-bin-DVD.iso file.
 
After mounting, use the tar command to copy all files in the optical drive to the/rice directory:
 
# Cd/mnt/cdrom
 
# Tar-cf-. | (cd/rice; tar-xvpf -)
 
After the copy is complete, go to the rice directory and click ls-al:
 
# Ls-al
 
Drwxr-xr-x 7 root 6144 03-21.
Drwxr-xr-x 4 root 4096 08-12 ..
Drwxr-xr-x 2 ossec 407552 03-21 CentOS
-Rw-r -- 1 root 112 03-21 23:05. discinfo
-Rw-r -- 7 root 212 2008-06-15 EULA
-Rw-r -- 7 root 18009 2008-06-15 GPL
Drwxr-xr-x 4 root 2048 03-21 23:04 images
Drwxr-xr-x 2 root 2048 03-21 isolinux
Drwxr-xr-x 2 root 12288 03-17 NOTES
-Rw-r -- 2 root 655 03-09 11: 12 RELEASE-NOTES-cs
-Rw-r -- 2 root 1401 03-09 RELEASE-NOTES-cs.html
-Rw-r -- 2 root 839 03-09 11: 12 RELEASE-NOTES-de
-Rw-r -- 2 root 1571 03-09 RELEASE-NOTES-de.html
-Rw-r -- 2 root 694 03-09 11: 12 RELEASE-NOTES-en
-Rw-r -- 2 root 1367 03-09 RELEASE-NOTES-en.html
-Rw-r -- 2 root 694 03-09 RELEASE-NOTES-en_US
-Rw-r -- 2 root 1367 03-09 RELEASE-NOTES-en_US.html
-Rw-r -- 2 root 788 03-09 11: 12 RELEASE-NOTES-es
-Rw-r -- 2 root 1619 03-09 RELEASE-NOTES-es.html
-Rw-r -- 2 root 852 03-09 11: 12 RELEASE-NOTES-fr
-Rw-r -- 2 root 1641 03-09 RELEASE-NOTES-fr.html
-Rw-r -- 2 root 766 03-09 11: 12 RELEASE-NOTES-ja
-Rw-r -- 2 root 1565 03-09 RELEASE-NOTES-ja.html
-Rw-r -- 2 root 706 03-09 11: 12 RELEASE-NOTES-nl
-Rw-r -- 2 root 1433 03-09 RELEASE-NOTES-nl.html
-Rw-r -- 2 root 752 03-09 RELEASE-NOTES-pt_BR
-Rw-r -- 2 root 1480 03-09 RELEASE-NOTES-pt_BR.html
-Rw-r -- 2 root 801 03-09 11: 12 RELEASE-NOTES-ro
-Rw-r -- 2 root 1473 03-09 RELEASE-NOTES-ro.html
Drwxr-xr-x 2 root 2048 03-21 22: 35 repodata
-Rw-r -- 7 root 1512 2008-06-15 RPM-GPG-KEY-beta
-Rw-r -- r-2 root 1504 2008-06-15 RPM-GPG-KEY-CentOS-5
-R -- 1 root 7048 03-21 23:05 TRANS. TBL
-Rw-r -- 2 root 413 03-21 23:04. treeinfo
 
In these files, only the files or directories marked with red in the display results can be deleted. By the way, the rpm packages are stored in the CentOS directory, during this operation, all content under the CentOS directory is deleted (the CentOS directory is retained and will be useful later ).
 
After deleting unnecessary files, run the ls-al command to check the structure of the/rice/directory:
 
# Ls-al
 
Drwxr-xr-x 2 ossec 155648 09-03 CentOS
-Rw-r -- 1 root 112 03-21 23:05. discinfo
Drwxr-xr-x 4 root 4096 03-21 23:04 images
Drwxr-xr-x 2 root 4096 09-03 :51 isolinux
Drwxr-xr-x 2 root 4096 09-03 19: 47 repodata
-Rw-r -- 1 root 1318 2009-09-04 TRANS. TBL
-Rw-r -- 1 root 413 03-21 23:04. treeinfo
 
The file looks much more comfortable.
 
After the CentOS system is installed, the installation information of all rpm packages is recorded in the/root/directory install. in the log file, we can output this file as the desired format. In some scripts, we can copy the required rpm package to the/rice/CentOS/directory.
 
# Cd/root/
 
# Cat install. log | grep Installing | sed s/Installing // g | sed s/^ [0-9] +: // g> packages. list // generate packages. to copy the rpm package.
 
Create an automatic extraction rpm script:
 
# Vi cprpms. sh
 
#! /Bin/bash
DEBUG = 0
LT_CD =/mnt/cdrom
ALL_RPMS_DIR =/mnt/cdrom/CentOS # directory where the disk is attached
LT_RPMS_DIR =/rice/CentOS # directory for storing RPM packages
Packages_list =/root/packages. list
Number_of_packages = 'cat $ packages_list | wc-l'
I = 1
While [$ I-le $ number_of_packages]; do
Line = 'head-n $ I $ packages_list | tail-n-1'
Name = 'echo $ line | awk {print $1 }'
Version = 'echo $ line | awk {print $3} | cut-f 2-d :'
If [$ DEBUG-eq "1"]; then
Echo $ I: $ line
Echo $ name
Echo $ version
Fi
If [$ DEBUG-eq "1"]; then
Ls $ ALL_RPMS_DIR/$ name-$ version *
If [$? -Ne 0]; then
Echo "cp $ ALL_RPMS_DIR/$ name-$ version *"
Fi
Else
Echo "cp $ ALL_RPMS_DIR/$ name-$ version * $ LT_RPMS_DIR /"
Cp $ ALL_RPMS_DIR/$ name-$ version * $ LT_RPMS_DIR/
# In case the copy failed
If [$? -Ne 0]; then
Echo "cp $ ALL_RPMS_DIR/$ name-$ version *"
Cp $ ALL_RPMS_DIR/$ name * $ LT_RPMS_DIR/
Fi
Fi
I = 'expr $ I + 1'
 
Done
 
Execute the above script to customize the necessary rpm for ltos

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.