Make your own centos ISO

Source: Internet
Author: User
Tags rpmbuild

Centos6.3 the official DVD package is too large and contains a large number of software. However, many of the software cannot be used in the production environment. Redundant installation will only result in a waste of resources, this document mainly introduces a basic method for system customization, and points out some serious problems in system customization. If you do not pay attention to these problems, you may give up your work in many cases.

Customized Based on centos6.3, You can integrate the lnmp environment and some system monitoring software. Previously, the installation of the system and the lnmp environment were installed using installation scripts. It took too long to install the source code, in particular, PHP compilation takes too long. Therefore, you need to package some source code packages into an RPM package during system customization. Therefore, the preparation process of the RPM package will be introduced at the beginning of this document.


1. Overview and usage of RPM

1) The RPM package manager (RPM) is a software package manager widely used in Linux. It was first developed by Red Hat and now developed by the open source community. Rpm is usually attached to the Linux release, but it is also released separately as the application software. Rpm is only applicable to the installation of software packaged with RPM. It is currently the most abundant package type of software package resources in GNU/Linux.

xxx-version.rpm --redhat suse....xxx-veriosn.deb --debian/ubuntu


2) specific usage of RPM package management;

1. quick installation, deletion, upgrade and management of software, and online installation and upgrade of software;

2. You can use RPM to check which files are included in the software package and which software package the file belongs;

3. check whether or not the software package in the query system is installed and its version;

4. As a developer, You can package your program as an RPM package for release, reducing the time required for configuration and compilation before software installation;

5. Import, verify, and publish the software package signature GPG and MD5 to prevent software tampering.

6. Check the dependency to see if any software package has disrupted the system due to incompatibility;


3) Precautions for RPM Packaging

To ensure that your RPM package can be used normally in other systems, system environment consistency is required. Of course, the software you pack on centos6.3 can also be installed and used normally on centos6.4 in some situations, however, we do not recommend this. packaging the consistency of the host system is the basic condition for RPM installation. In addition, the most difficult problem to solve is the dependency problem. The RPM package can be installed through Yum and the dependency is automatically checked, but there is a problem. For example, when you package nginx, it depends on the GD library, a GD package is installed through the network Yum source during packaging. However, when the host system is installed, there may be no network, but the CD contains a GD package, maybe you can install the GD library by turning off the disk. However, you cannot guarantee that the version of the GD library is the same as that of nginx. Generally, most of the GD libraries in the CD are lower than those in the yum source of the network, so nginx cannot be used properly, because we do not know what the GD library has been upgraded. The solution is to write down the packages that need to be depended on during packaging and download these packages. Install these packages on the host system. Of course, these packages are also dependent on each other. So you have to find all dependencies and install them accordingly.


2. RPM package creation process

1. Install the tool

Yum-y install rpm-build

2. Create a directory

3. Introduction to the packaging directory

Build -- source extract directory RPMS--RPM package (finished) sources--source code directory (tar.gz) specs -- xx. SPEC (makefile) srpms--src.rpm%xx.spec%tar.gz (which we do not use) buildroot -- the RPM package installs the temporary directory. The RPM package process is equivalent to the installation, but the installation path is in the local directory instead of the system directory.



4. spec file instance

Mkdir-p $ home/rpmbuild/{build, rpms, sources, Specs, srpms, buildroot}

Although many documents do not recommend using the root user to package RPM packages, we still use the root account for convenience, as long as you pay attention to the packaging, there will still be no problems.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4C/78/wKiom1Q-F33j8GzjAAQo-7ctOI0222.jpg "Title =" 9l1h_tn6%@z6qtd4mg%0mm6.jpg "alt =" wKiom1Q-F33j8GzjAAQo-7ctOI0222.jpg "/> 650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4C/79/wKioL1Q-F92xD6MoAAR-VLiVMqk480.jpg "Title =" image 1.png "alt =" wKioL1Q-F92xD6MoAAR-VLiVMqk480.jpg "/>

5. Start Packaging

Execute rpmbuild-BB nginx. spec in the specs directory, and write down the packages prompted during the installation process. This command will compile the software according to the method specified by our spec and generate the corresponding RPM package in the/root/rpmbuild/RPMS/x86_64/directory, by default, this RPM package records the other software that will be dependent on during the software compilation process. Once again, if the environment is different when you package it, be sure to manually install the dependency before installing RPM to solve the problem that the version may be too low.


6. Start to customize ISO

1. Download a complete centos disc from the centos website and mount it to the/mnt directory on the VM.

Mount-o loop/dev/CDROM/mnt

2. Copy the CD file to the custom ISO directory. This copy is mainly because the CD Mount directory cannot be written, so it must be copied.

Mkdir/ISO

CP/mnt/*/ISO

By default, the above copy operation does not copy hidden files. Therefore, the root directory of the disk has two hidden files, so you must copy them manually.

3. Create a directory for your own software

 mkdir /iso/lnmpcp  /root/rpmbuild/RPMS/x86_64/* /iso/lnmp


4. modify files in the/ISO/isolinux/directory.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4C/79/wKioL1Q-GFXgNXRXAAJ-TV_w1x4592.jpg "Title =" 427m_a ~) 6s1bh3e0a1_1_1_opolicy.png "alt =" wKioL1Q-GFXgNXRXAAJ-TV_w1x4592.jpg "/>

Note that we reference A *. cfg file, which is the key to our custom system,

This file will exist as an attachment!

5 package for the first time

cd /isomkisofs  -o  gzyouai_centos_6.4.iso   -b  isolinux/isolinux.bin  -c  isolinux/boot.cat  -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T ./


6. Install the first Packaging System

7. Record the install. log file of the installed system

Which software is installed this time, and the content must be manually added. the RPM suffix, and some special lines need to be deleted. copy the file to the packaging system and find a way to kick out useless software packages in/ISO/packages! Delete useless software packages.

CD/ISO/packages/

Createrepo ./

Repackage and install the SDK in step 5. In this way, the system will be less bloated.


This article from the "Zheng honghui" blog, please be sure to keep this source http://4155621.blog.51cto.com/4145621/1564374

Make your own centos ISO

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.