方法1:
[hantsy@localhost hantsy]$cd ~
[hantsy@localhost hantsy]$mkdir rpmbuild
[hantsy@localhost hantsy]$cp -a /usr/src/redhat/ rpmbuild
[hantsy@localhost hantsy]$echo '%_topdir %(echo $HOME)/rpmbuild' >> .rpmmacros
如果不想编译debug包,向.rpmmacros中追加%debug_package %
[hantsy@localhost hantsy]$echo '%debug_package %' >> .rpmmacros
[hantsy@localhost hantsy]$sudo rpm -ivh http://download.fedora.us/fedora/fedora/1/i386/RPMS.stable/fedora-rpmdevtools-0.1.7-0.fdr.5.noarch.rpm
方法2
也可直接安装现成的rpm文件:
[hantsy@localhost hantsy]$fedora-buildrpmtree
使用sudo 取得root权限
编辑/etc/sudoers文件
root ALL=(ALL) ALL
hantsy ALL=(ALL) ALL
例子,重新为redhat 9打AdobeReader 7.0 rpms包 参见 HOWTO: Buiding a custom Adobe Reader 7.0 RPM for FC3
[hantsy@localhost hantsy]$ cd rpmbuild/SOURCE1.你可以从这里下载我修改过的specs文件specs.tar.gz
[hantsy@localhost hantsy]$wget -c linux_enu.tar.gz>ftp://ftp.adobe.com/pub/adobe/reader/unix/7x/7.0/enu/AdbeRdr70_linux_enu.tar.gz
[hantsy@localhost hantsy]$cd ../SPECS
[hantsy@localhost hantsy]$wget -c http://fedoranews.org/tchung/AdobeReader/7.0/AdobeReader.spec
[hantsy@localhost hantsy]$sudo rpmbuild -ba AdobeReader.spec
安装自己的rpm包
[hantsy@localhost hantsy]$sudo rpm -ivh ~/rpmbuild/RPMS/i386/AdobeReader-7.0-1.rh9.i386.rpm
参考资料: