Friday, November 18, 2011

Install RPM packages with non-root account

Recently, I need to install RPM to RedHat Linux, but I don't have root access.  I found this post: http://ajaya.name/?p=6353.  However, some commands in the command are not correct or need more clarification.  So I wrote down my experience below.

  • create file ~/.rpmmacros and add following line
        %_rpmlock_path lib/rpm/__db.000
  • Initialize the database by running command:
rpm --initdb \
    --root /home/<user_name>/rpm-local/ \
    --dbpath /home/<user_name>/rpm-local/lib/rpm
  • Check the dependence
rpm --root /home/<user_name>/rpm-local/ \
--dbpath /home/<user_name>/rpm-local/lib/rpm \
-ivh package.rpm
  • Install package
rpm --root /home/<user_name>/rpm-local \
--dbpath /home/<user_name>/rpm-local/lib/rpm \ --relocate /usr=/home/<user_name>/rpm-local \
--nodeps \
-ivh package.rpm

Resources

No comments: