打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
centos中下载源代码包
Centos中各种软件的源代码在:http://vault.centos.org
很多情况下想学习一下Centos中各种软件的源代码,又不想全部下载。
以centos6.6为例:
1)在/etc/yum.repos.d/下建立一个Centos-Vault-Src.repo
[C6.6src-base]
name=CentOS-6.6src - Base
baseurl=http://vault.centos.org/6.6/os/Source
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1

[C6.6src-updates]
name=CentOS-6.6src - Updates
baseurl=http://vault.centos.org/6.6/updates/Source
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1

[C6.6src-extras]
name=CentOS-6.6src - Extras
baseurl=http://vault.centos.org/6.6/extras/Source
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1

[C6.6src-centosplus]
name=CentOS-6.6src - CentOSPlus
baseurl=http://vault.centos.org/6.6/centosplus/Source
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1

2)sudo yum makecache
看第1步设置是否正确

3)下载软件源代码包
例如ls的源代码

3.1)rpm -qf /bin/ls
coreutils-8.4-37.el6.i686
#说明ls命令的源代码包在coreutils中

3.2) yumdownloader --source coreutils
coreutils-8.4-37.el6.src.rpm

3.3)
#进一步可以安装查看源代码
rpmbuild --rebuild coreutils-8.4-37.el6.src.rpm

3.3)(optional)
rpm -ivh coreutils-8.4-37.el6.src.rpm
cd ~/rpmbuild
cd ~/rpmbuild/SPECS
rpmbuild -ba coreutils.spec

3.3)(optional)
rpm2cpio coreutils-8.4-37.el6.src.rpm| cpio -id
#然后自己逐一编译之
cd coreutils-8.4
patch -Np1 -i ../coreutils-8.4-ls-leak.patch
...

./configure
make






本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
CentOS获取软件安装包源码
CentOS6的yum源失效官方停止维护更新及解决
CentOS 升级至指定版本
安装memtester报错:./compile: line 3: exec: cc: not found解决办法
CentOS 6的服务器后执行yum后发现出现Error: Cannot find a valid baseurl for repo: base解决办法
基于Linux和Postfix的邮件系统安装手册
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服