[root@localhost w0412]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [root@localhost w0412]# uname -r 3.10.0-1160.el7.x86_64下载内核源码包
使用wget直接下载
[root@localhost w0412]# wget --no-check-certificate https://vault.centos.org/7.9.2009/updates/Source/SPackages/kernel-3.10.0-1160.2.1.el7.src.rpm
--2021-12-07 04:47:28-- https://vault.centos.org/7.9.2009/updates/Source/SPackages/kernel-3.10.0-1160.2.1.el7.src.rpm
Resolving vault.centos.org (vault.centos.org)... 3.22.185.178
Connecting to vault.centos.org (vault.centos.org)|3.22.185.178|:443... connected.
WARNING: cannot verify vault.centos.org's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
Issued certificate has expired.
HTTP request sent, awaiting response... 200 OK
Length: 104775536 (100M) [application/x-rpm]
Saving to: ‘kernel-3.10.0-1160.2.1.el7.src.rpm’
100%[=============================================>] 104,775,536 1.49MB/s in 1m 46s
2021-12-07 04:49:16 (970 KB/s) - ‘kernel-3.10.0-1160.2.1.el7.src.rpm’ saved [104775536/104775536]
[[root@localhost w0412]# rpm -i kernel-3.10.0-1160.2.1.el7.src.rpm warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root出现警告信息,解决方案 安装mock
[root@localhost w0412]# yum install mock
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.compevo.com
* elrepo: hkg.mirror.rackspace.com
* extras: centos.s.uw.edu
* updates: linux.mirrors.es.net
Resolving Dependencies
--> Running transaction check
---> Package mock.noarch 0:1.2.17-1.el7.centos will be installed
--> Processing Dependency: pigz for package: mock-1.2.17-1.el7.centos.noarch
--> Processing Dependency: createrepo_c for package: mock-1.2.17-1.el7.centos.noarch
--> Running transaction check
---> Package createrepo_c.x86_64 0:0.10.0-20.el7 will be installed
--> Processing Dependency: createrepo_c-libs = 0.10.0-20.el7 for package: createrepo_c-0.10.0-20.el7.x86_64
--> Processing Dependency: libcreaterepo_c.so.0()(64bit) for package: createrepo_c-0.10.0-20.el7.x86_64
---> Package pigz.x86_64 0:2.3.3-1.el7.centos will be installed
--> Running transaction check
---> Package createrepo_c-libs.x86_64 0:0.10.0-20.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================
Package Arch Version Repository Size
=======================================================================================
Installing:
mock noarch 1.2.17-1.el7.centos extras 298 k
Installing for dependencies:
createrepo_c x86_64 0.10.0-20.el7 extras 65 k
createrepo_c-libs x86_64 0.10.0-20.el7 extras 89 k
pigz x86_64 2.3.3-1.el7.centos extras 68 k
Transaction Summary
=======================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 521 k
Installed size: 1.4 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): createrepo_c-libs-0.10.0-20.el7.x86_64.rpm | 89 kB 00:00:01
(2/4): createrepo_c-0.10.0-20.el7.x86_64.rpm | 65 kB 00:00:01
(3/4): pigz-2.3.3-1.el7.centos.x86_64.rpm | 68 kB 00:00:01
(4/4): mock-1.2.17-1.el7.centos.noarch.rpm | 298 kB 00:00:03
---------------------------------------------------------------------------------------
Total 158 kB/s | 521 kB 00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : pigz-2.3.3-1.el7.centos.x86_64 1/4
Installing : createrepo_c-libs-0.10.0-20.el7.x86_64 2/4
Installing : createrepo_c-0.10.0-20.el7.x86_64 3/4
Installing : mock-1.2.17-1.el7.centos.noarch 4/4
Verifying : createrepo_c-libs-0.10.0-20.el7.x86_64 1/4
Verifying : mock-1.2.17-1.el7.centos.noarch 2/4
Verifying : pigz-2.3.3-1.el7.centos.x86_64 3/4
Verifying : createrepo_c-0.10.0-20.el7.x86_64 4/4
Installed:
mock.noarch 0:1.2.17-1.el7.centos
Dependency Installed:
createrepo_c.x86_64 0:0.10.0-20.el7 createrepo_c-libs.x86_64 0:0.10.0-20.el7
pigz.x86_64 0:2.3.3-1.el7.centos
Complete!
创建mockbuild用户useradd -s /sbin/nologin mockbuild再次安装
rpm -i kernel-3.10.0-1160.2.1.el7.src.rpm
切换到rpmbuild目录cd ~/rpmbuild/SPECSrpmbuild
[root@localhost SPECS]# rpmbuild -bp --target=$(uname -m) kernel.spec
Building target platforms: x86_64
Building for target x86_64
error: Failed build dependencies:
xmlto is needed by kernel-3.10.0-1160.2.1.el7.x86_64
asciidoc is needed by kernel-3.10.0-1160.2.1.el7.x86_64
hmaccalc is needed by kernel-3.10.0-1160.2.1.el7.x86_64
python-devel is needed by kernel-3.10.0-1160.2.1.el7.x86_64
newt-devel is needed by kernel-3.10.0-1160.2.1.el7.x86_64
perl(ExtUtils::Embed) is needed by kernel-3.10.0-1160.2.1.el7.x86_64
pesign >= 0.109-4 is needed by kernel-3.10.0-1160.2.1.el7.x86_64
elfutils-libelf-devel is needed by kernel-3.10.0-1160.2.1.el7.x86_64
elfutils-devel is needed by kernel-3.10.0-1160.2.1.el7.x86_64
zlib-devel is needed by kernel-3.10.0-1160.2.1.el7.x86_64
binutils-devel is needed by kernel-3.10.0-1160.2.1.el7.x86_64
audit-libs-devel is needed by kernel-3.10.0-1160.2.1.el7.x86_64
java-devel is needed by kernel-3.10.0-1160.2.1.el7.x86_64
numactl-devel is needed by kernel-3.10.0-1160.2.1.el7.x86_64
pciutils-devel is needed by kernel-3.10.0-1160.2.1.el7.x86_64
ncurses-devel is needed by kernel-3.10.0-1160.2.1.el7.x86_64
python-docutils is needed by kernel-3.10.0-1160.2.1.el7.x86_64
yum install openssl-devel rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed pesign xmlto -y yum install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel java-devel -y yum install ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel -y再次rpmbuild -bp --target=$(uname -m) kernel.spec
[root@localhost SPECS]# rpmbuild -bp --target=$(uname -m) kernel.spec
Building target platforms: x86_64
Building for target x86_64
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.MEDN94
+ umask 022
+ cd /root/rpmbuild/BUILD
+ patch_command='patch -p1 -F1 -s'
+ cd /root/rpmbuild/BUILD
+ rm -rf kernel-3.10.0-862.2.3.el7
+ /usr/bin/mkdir -p kernel-3.10.0-862.2.3.el7
+ cd kernel-3.10.0-862.2.3.el7
+ /usr/bin/tar -xf -
+ /usr/bin/xz -dc /root/rpmbuild/SOURCES/linux-3.10.0-862.2.3.el7.tar.xz
+ STATUS=0
至此,安装源码完成。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)