#!/bin/blog

June 8, 2010

Building RPM packages as non-root user

Filed under: Security — Tags: , — martin @ 11:38 am

This came up below the posting about Packaging OpenSSH on CentOS:

For non-root building of RPMs, the user needs a configuration file named .rpmmacros in his home directory:

cat <<EOF > ~/.rpmmacros
%_topdir $HOME/rpm
%_tmppath $HOME/rpm/tmp
EOF

The directory structure for RPM needs to be prepared by hand:
mkdir ~/rpm
mkdir ~/rpm/BUILD
mkdir ~/rpm/RPMS
mkdir ~/rpm/RPMS/`uname -p`
mkdir ~/rpm/RPMS/noarch
mkdir ~/rpm/SOURCES
mkdir ~/rpm/SPECS
mkdir ~/rpm/SRPMS
mkdir ~/rpm/tmp

Now build, for example, OpenSSH:
$ cp openssh-5.5p1/contrib/redhat/openssh.spec ~/rpm/SPECS/
$ cp openssh-5.5p1.tar.gz ~/rpm/SOURCES/
$ cd ~/rpm/SPECS/
$ rpmbuild -bb --define 'skip_x11_askpass 1' --define 'skip_gnome_askpass 1' openssh.spec
$ cd ~/rpm/RPMS/`uname -i`
$ ls -l
total 1108
-rw-r--r-- 1 martin martin 359994 Jun 8 12:33 openssh-5.5p1-1.i386.rpm
-rw-r--r-- 1 martin martin 471360 Jun 8 12:33 openssh-clients-5.5p1-1.i386.rpm
-rw-r--r-- 1 martin martin 284453 Jun 8 12:33 openssh-server-5.5p1-1.i386.rpm

Done.

Advertisements

1 Comment »

  1. THANK YOU for the –define ‘skip_x11_askpass 1’ –define ‘skip_gnome_askpass 1’

    Comment by Tong W. — November 17, 2010 @ 12:41 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: