Installing R locally without root privileges

If you are running on linux and want to make a local installation of R without sudo rights, here are the steps you should follow…

  1. Download a copy of the tar.gz version of R from CRAN to your home directory.
  2. Uncompress the file.
  3. cd /home/myname
    tar -xvf R-version.tar.gz
  4. Run the usual configure + make commands with the prefix options since you do not have root permissions.
  5. cd /home/myname/R-version
    ./configure --prefix=/home/myname
  6. For simplicity, create an alias in your .csrc file that links to the newly installed R version.
  7. alias R /home/myname/R-version/bin/R
  8. That’s it! All done!

Creating a local library to install R packages

  1. In your R installation directory (this doesn’t have to be the case, in fact it can be anywhere!), create a new directory where you want all packages to be installed.
  2. cd /home/myname/R-version
    mkdir mylibrary
  3. Add a new library environment in your .cshrc file.
  4. setenv R_LIBS /home/myname/R-version/mylibrary
  5. That should work, when you use the command,
    install.packages("package name")

    the package should be installed in /home/myname/R-version/mylibrary.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s