Skip to content

Instantly share code, notes, and snippets.

@widged
Forked from leoniedu/Installing R on dreamhost
Created August 4, 2011 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save widged/1124347 to your computer and use it in GitHub Desktop.
Save widged/1124347 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
## installing R-2.9.2 went without problem.
## when trying $-2.13.2, got "Yikes! One of your processes was just killed because yourprocesses are, as a whole, consuming too much memory."
wget http://cran.r-project.org/src/base/R-2/R-2.13.2.tar.gz
tar xvzf R-2.13.1.tar.gz
cd ~/soft/R-2.13.1
./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.21.7.tar.gz
tar -vxzf curl-7.21.7.tar.gz
cd ~/soft/curl-7.21.7
./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.6-6.tar.gz
## with more recent versions of R, install doesn't work if a configure file is present in the
## package as it needs to know whether to target bit64 systems.
## It may be possible to use R --arch='x86_64' CMD INSTALL RCurl --configure-args='exec_prefix=${HOME}/run'
tar -vxzf RCurl_1.6-6.tar.gz
cd RCurl
./configure
rm configure
R CMD INSTALL RCurl --configure-args='exec_prefix=${HOME}/run'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment