centos6.4安装源码过程

来源:互联网 发布:js new function 用法 编辑:程序博客网 时间:2024/06/06 01:11
1、检查内核版本
uname -r
2.6.32-358.el6.i686


2、下载src.rpm包
http://vault.centos.org/6.4/os/Source/SPackages/kernel-2.6.32-358.el6.src.rpm


3、普通用户执行:
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros


4、root用户执行:
yum install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed xmlto
yum install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel
yum install newt-devel python-devel zlib-devel


5、创建用户mockbuild,因为在第6步rpm安装的时候,需要这个用户
useradd -s /sbin/nologin mockbuild




6、普通用户执行,该执行过程中,需要用到mockbuild用户,否则会出现告警
(warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root):
具体执行:
[hadoop@hadoop1 ~]$rpm -ivh kernel-2.6.32-358.2.1.e16.src.rpm
[hadoop@hadoop1 ~]$ cd ~/rpmbuild/
[hadoop@hadoop1 rpmbuild]$ cd SPECS/
[hadoop@hadoop1 SPECS]$ ls
kernel.spec
[hadoop@hadoop1 SPECS]$ rpmbuild -bp --target=$(uname -m) kernel.spec
Building target platforms: i686
Building for target i686
error: Failed build dependencies:
gcc >= 3.4.2 is needed by kernel-2.6.32-358.el6.i686
patchutils is needed by kernel-2.6.32-358.el6.i686
bison is needed by kernel-2.6.32-358.el6.i686


缺少包,root安装:
yum install gcc
yum install patchutils
yum install bison


在yum中,如果遇到:
[root@hadoop1 SPECS]# yum install bison
Loaded plugins: fastestmirror, refresh-packagekit, security
Existing lock /var/run/yum.pid: another copy is running as pid 23151.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  25 M RSS ( 71 MB VSZ)
    Started: Thu May 22 12:15:12 2014 - 00:10 ago
    State  : Sleeping, pid: 23151
[root@hadoop1 SPECS]# ps -ef|grep 23151
root     23151 22792  1 12:15 ?        00:00:01 /usr/bin/python /usr/share/PackageKit/helpers/yum/yumBackend.py get-updates none


这个是常规更新程序,直接用kill -9 停掉就可以了。


6、源码位置

~/rpmbuild/BUILD/kernel-2.6.32-358.el6/linux-2.6.32-358.el6.i686

[hadoop@hadoop1 linux-2.6.32-358.el6.i686]$ ls
arch                         config-powerpc64-kdump-rhel  CREDITS          merge.pl
block                        config-powerpc64-rhel        crypto           mm
check-kabi                   config-powerpc-generic       Documentation    net
config-debug                 config-powerpc-generic-rhel  drivers          perf
config-debug-rhel            configs                      extract.pub      pubring.gpg
config-framepointer          config-s390x                 extrakeys.pub    random_seed
config-generic               config-s390x-debug           firmware         README
config-generic-rhel          config-s390x-debug-rhel      fs               REPORTING-BUGS
config-i686                  config-s390x-generic-rhel    include          samples
config-i686-debug            config-s390x-kdump           init             scripts
config-i686-debug-rhel       config-s390x-kdump-rhel      ipc              secring.gpg
config-i686-nodebug          config-s390x-rhel            kabitool         security
config-i686-nodebug-rhel     config-x86_64-debug          Kbuild           sound
config-i686-rhel             config-x86_64-debug-rhel     kernel           temp-i686-debug-final
config-ia64-generic-rhel     config-x86_64-generic        kernel.pub       temp-i686-final
config-nodebug               config-x86_64-generic-rhel   kernel.pub~      tools
config-nodebug-rhel          config-x86_64-nodebug        kernel.sec       trustdb.gpg
config-powerpc64             config-x86_64-nodebug-rhel   lib              usr
config-powerpc64-debug       config-x86-generic           MAINTAINERS      virt
config-powerpc64-debug-rhel  config-x86-generic-rhel      Makefile
config-powerpc64-kdump       COPYING                      Makefile.common

0 0