In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Centos how to quickly customize the binary kernel RPM package, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
With the increasing number of Linux servers, if the underlying system kernel wants to keep the version uniform, it needs to customize a special binary installation package for easy upgrade and management. The RedHat department, of course, uses rpmbuild for customized management.
Today we will explain how to make a binary rpm package for the kernel in two parts (root and regular users).
Building host system environment conventions:
OS: CentOS release 6.6
Arch: i686
1. Simple customization of rpm package
Note: first of all, we need to reserve at least temporary file space for 20GB.
The environment before 1.rpm production prepares yum-y groupinstall "Development Tools" yum-y install ncurses-devel qt-develyum-y install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed xmltoyum-y install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-develyum-y install newt-devel python-devel zlib-devel bc2. Prepare the kernel source code component cd / usr/srcwget-c https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.19.1.tar.xztar-Jxvf linux-3.19.1.tar.xzln-s linux-3.19.1 linuxcd linuxmake oldconfig # to verify and update the configuration .config configuration file (if you only want to modify a few small areas based on the original kernel configuration) make menuconfig # Simple graphical kernel configuration management 3. At this point, we can start compiling the new kernel rpm package make rpm # automatically generate rpmtree,kernel.spec files, automatic compilation, will generate all the rpm package components, including the debug package.
At this time, let's just wait, or have a cup of afternoon tea or something.
All right, let's look for the compiled kernel rpm package.
Cd / root/rpmbuild/RPMS/ `uname-m` / tree RPMS/RPMS/ └── i386 ├── kernel-3.19.1-2.i386.rpm ├── kernel-devel-3.19.1-2.i386.rpm └── kernel-headers-3.19.1-2.i386.rpm 1 directory, 3 files4. Install the new kernel rpm-Uvh kernel-*-.rpm5. Restart, verify the kernel version uname-an II, rpm package deep customization 1. Let's first create a "production workshop" for rpm (I think it might be more vivid to say that). Yum install rpmdevtools # rpm production workshop quick creation tool useradd-m builder # create a new temporary user to create the RPM package, and if an error occurs, the builder will not destroy the existing system environment. Su-builderrpmdev-setuptree # creates a "production workshop"
The following directory structure will be generated under the builder user's home directory:
Tree-L 1 ~ / rpmbuild/rpmbuild/ ├── BUILD ├── RPMS ├── SOURCES ├── SPECS └── SRPMS2. Pre-compilation preparation
At this point, we need to put the new version of the kernel source package collected by the package into the / home/builder/rpmbuild/SOURCES directory.
Su-buildercd ~ / rpmbuild/SOURCES wget-c https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.19.1.tar.xz # Note: rpmbuild decompresses the building source code packet through gzip, so you need to convert this compressed package to .tar.gz format. # cp / boot/config- `uname-r` will not be recorded here. # copy the existing kernel configuration file config- `kernel-r` to the SOURCES directory
Change to the SPECS directory and generate kernel.spec:
Tar Jxvf.. / SOURCES/linux-3.19.1.tar.xz-C. bash.. / linux-3.19.1/scripts/package/mkspec >. / kernel.specrm-rf linux-3.19.1 # here we need to manually generate kernel.spec files using the scripts provided in the source package # remember that after generating kernel.spec, clean up the linux-3.19.1 folder vim kernel.spec # can be deeply customized according to individual circumstances
At this point, our preparatory work is basically completed, and the directory structure and contents are as follows:
Tree rpmbuild/-arpmbuild/ ├── BUILD ├── RPMS ├── SOURCES │ ├── config- `uname-r` │ └── linux-3.19.1.tar.gz ├── SPECS │ └── kernel.spec SRPMS 5 directories, 3 files3. All right, now let's officially start compiling the kernel's binary rpm package rpmbuild-bb-- with baseonly-- without debug-- without debuginfo-- target= `uname-m` kernel.spec
Rpmbuild parameter description:
(1)-- with indicates that a certain kernel is compiled, and the optional option are baseonly, smponly, xenonly, and so on.
(2)-without indicates the removal of some functional modules. The optional option includes xen, smp, up, pae, kdump, debug and debuginfo. Where the debug option removes debug code from the kernel and the debuginfo option prohibits the creation of kernel-debuginfo packages.
When you are finished, go to the ~ / rpmbuild/RPMS/ `uname-m` / directory to obtain the rpm installation package.
After reading the above, have you mastered how to quickly customize the binary kernel RPM package in Centos? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.