Skip to content

Instantly share code, notes, and snippets.

@leoniedu
Created June 26, 2009 20:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save leoniedu/136711 to your computer and use it in GitHub Desktop.
Save leoniedu/136711 to your computer and use it in GitHub Desktop.
Installing R on dreamhost
## First do the unix account setup http://wiki.dreamhost.com/Unix_account_setup
cd ${HOME}
# create the first level directories (and log/setup)
mkdir -pv soft run www log log/setup backup data
# create the second level directories within run (our own FHS)
for subdir in bin etc include lib man share
do
mkdir -pv run/${subdir}
done
# symlink so that man pages stay all in the same place
ln -sv ../man run/share/man
# symlink so that the apache logs are also found within log
ln -sv ../logs log/vhosts
mkdir -pv ${HOME}/.cpan/CPAN
cat > ${HOME}/.cpan/CPAN/MyConfig.pm <<eof
\$CPAN::Config = {
'auto_commit' => q[0],
'build_cache' => q[10],
'build_dir' => q[\$ENV{HOME}/.cpan/build],
'cache_metadata' => q[1],
'commandnumber_in_prompt' => q[1],
'cpan_home' => q[\$ENV{HOME}/.cpan],
'dontload_hash' => { },
'ftp' => q[/usr/bin/ftp],
'ftp_passive' => q[1],
'ftp_proxy' => q[],
'getcwd' => q[cwd],
'gpg' => q[/usr/bin/gpg],
'gzip' => q[/bin/gzip],
'histfile' => q[\$ENV{HOME}/.cpan/histfile],
'histsize' => q[100],
'http_proxy' => q[],
'inactivity_timeout' => q[0],
'index_expire' => q[1],
'inhibit_startup_message' => q[0],
'keep_source_where' => q[\$ENV{HOME}/.cpan/sources],
'lynx' => q[/usr/bin/lynx],
'make' => q[/usr/bin/make],
'make_arg' => q[],
'make_install_arg' => q[],
'make_install_make_command' => q[/usr/bin/make],
'makepl_arg' => q[PREFIX=\$ENV{RUN}],
'mbuild_arg' => q[],
'mbuild_install_arg' => q[],
'mbuild_install_build_command' => q[./Build],
'mbuildpl_arg' => q[],
'ncftpget' => q[/usr/bin/ncftpget],
'no_proxy' => q[],
'pager' => q[less],
'prerequisites_policy' => q[follow],
'scan_cache' => q[atstart],
'shell' => q[/bin/bash],
'tar' => q[/bin/tar],
'term_is_latin' => q[0],
'term_ornaments' => q[1],
'unzip' => q[/usr/bin/unzip],
'urllist' => [q[ftp://cpan.cse.msu.edu/], q[ftp://cpan-du.viaverio.com/pub/CPAN/], q[ftp://cpan.mirrors.redwire.net/pub/CPAN/], q[ftp://cpan.hostrack.net/pub/CPAN]],
'use_sqlite' => q[0],
'wget' => q[/usr/bin/wget],
};
1;
__END__
eof
cat >>${HOME}/.bashrc <<eof
function pathmunge () {
if [ -d \$1 ] && ! echo $PATH | /bin/egrep -q "(^|:)\$1(\$|:)"
then
if [ "\$2" = "after" ]
then
PATH=$PATH:\$1
else
PATH=\$1:\$PATH
fi
fi
}
export RUN="\${HOME}/run"
pathmunge \${RUN}/bin
export LD_LIBRARY_PATH=\${RUN}/lib:\${LD_LIBRARY_PATH}
export LD_RUN_PATH=\${RUN}/lib:\${LD_RUN_PATH}
# perl library search path
PERL5LIB=\${RUN}/share/perl/5.8:\${RUN}/share/perl/5.8.4:\${PERL5LIB}
export PERL5LIB=\${RUN}/lib/perl/5.8:\${RUN}/lib/perl/5.8.4:\${PERL5LIB}
eof
## THEN
cd ~/soft
curl -O ftp://ftp.gnu.org/gnu/readline/readline-6.0.tar.gz
tar xzvf readline-6.0.tar.gz
cd ~/soft/readline-6.0
./configure --prefix=${HOME}/run
make
make install
cd ~/soft
wget http://cran.r-project.org/src/base/R-2/R-2.9.2.tar.gz
tar xvzf R-2.9.2.tar.gz
cd ~/soft/R-2.9.2
./configure --prefix=${HOME}/run --with-x=no LDFLAGS=-L${HOME}/run/lib
make
make install
##install R packages (inside R)
##install.packages(c("bitops", "plyr", "car", "XML"), dep=TRUE)
##install RCurl
## first install curl
cd ~/soft
wget http://curl.haxx.se/download/curl-7.19.5.tar.gz
tar -vxzf curl-7.19.5.tar.gz
cd ~/soft/curl-7.19.5
./configure --prefix=$HOME/run LDFLAGS=-L${HOME}/run/lib
make
make install
## now RCurl
cd ~/soft
wget http://cran.r-project.org/src/contrib/RCurl_1.2-0.tar.gz
R CMD INSTALL RCurl_1.2-0.tar.gz --configure-args='exec_prefix=${HOME}/run'
@tomroh
Copy link

tomroh commented Aug 25, 2014

I'm trying to install the latest version of R on Dreamhost but am running into problems. What would I have to change in this script to do that or is it even possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment