-
-
Save steve-liang/ecbd17a37481d1411b30996665d613a7 to your computer and use it in GitHub Desktop.
A shell script to install common scientific / programming tools on Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Marwick Lab Computational Environment Setup (Anh's version) | |
| # this script can be run from the terminal with the next line (minus the #) | |
| # bash install_things.sh | |
| # you will need to enter your password at a few points, so keep an eye on it while it runs. | |
| # in case we need to step through: | |
| # set -x | |
| # trap read debug | |
| ## Need this for Debian but not Lubuntu | |
| ## Make self su: http://stackoverflow.com/a/15067345/1036500 | |
| # install sudo to ensure we get access to everything | |
| # su -c "aptitude install sudo" | |
| # su root | |
| ## Here we assume your username is ben ... do edit this line if you chose a different username! | |
| # sudo adduser ben sudo | |
| echo "install a few dependancies for our workflow" | |
| sudo apt-get update -y | |
| sudo apt-get upgrade -y | |
| sudo apt-get install libgstreamer0.10-0 -y | |
| sudo apt-get install libgstreamer-plugins-base0.10-dev -y | |
| sudo apt-get install libcurl4-openssl-dev -y | |
| sudo apt-get install libssl-dev -y | |
| sudo apt-get install libopenblas-base -y | |
| sudo apt-get install libxml2-dev -y | |
| sudo apt-get install make -y | |
| sudo apt-get install gcc -y | |
| sudo apt-get install pandoc -y | |
| sudo apt-get install libjpeg62 -y | |
| sudo apt-get install unzip -y | |
| sudo apt-get install curl -y | |
| sudo apt-get install littler -y | |
| # sudo apt-get install openjdk-7-* -y | |
| # sudo apt-get install gedit -y | |
| # sudo apt-get install jags -y | |
| sudo apt-get install imagemagick -y | |
| # sudo apt-get install docker-engine -y | |
| # sudo apt-get install mysql-server -y | |
| echo "set up git" | |
| sudo apt-get install git meld -y | |
| git config --global user.name "Anh Le" | |
| git config --global user.email anhle@example.com | |
| git config --global merge.tool meld | |
| # for Emacs / Spacemacs | |
| echo "install Emacs" | |
| sudo add-apt-repository ppa:kelleyk/emacs | |
| sudo apt-get update | |
| sudo apt-get install emacs25 -y | |
| echo "install Spacemacs" | |
| git clone https://github.com/syl20bnr/spacemacs.git ~/.emacs.d | |
| git clone https://github.com/LaDilettante/.spacemacs.d.git ~/.spacemacs.d | |
| # for Texlive with Lubuntu (making PDFs) | |
| # these are BIG, not recommended if you're short on disk space! | |
| # sudo add-apt-repository ppa:texlive-backports/ppa | |
| # sudo apt-get update | |
| # sudo apt-get install texlive-latex-base texlive-fonts-recommended texlive-latex-extra -y | |
| # Or with Ubuntu 16.04 | |
| # sudo apt-get install texlive-full texstudio -y | |
| # | |
| # a few handy FOSS items for drawing, graphics and maps | |
| # sudo apt-get install inkscape -y | |
| # sudo apt-get install gimp -y | |
| # sudo apt-add-repository ppa:ubuntugis/ppa | |
| # sudo apt-get update | |
| # sudo apt-get install qgis -y | |
| # also a few things in case we use python | |
| # from http://faculty.washington.edu/rjl/uwhpsc-coursera/vm.html | |
| #sudo apt-get install liblzma-dev -y | |
| #sudo apt-get install ipython -y | |
| #sudo apt-get install ipython-notebook -y | |
| #sudo apt-get install python-pandas -y | |
| #sudo apt-get install python-numpy -y | |
| #sudo apt-get install python-scipy -y | |
| #sudo apt-get install python-matplotlib -y | |
| #sudo apt-get install python-dev -y | |
| #sudo apt-get install python-sphinx -y | |
| #sudo apt-get install gfortran -y | |
| #sudo apt-get install openmpi-bin -y | |
| #sudo apt-get install liblapack-dev -y | |
| #sudo apt-get install thunar -y | |
| #sudo apt-get install gitk -y | |
| #sudo apt-get install docdiff -y | |
| #sudo apt-get install python-setuptools -y | |
| echo "edit the sources file to prepare to install R" | |
| # see http://cran.r-project.org/bin/linux/ubuntu/README | |
| # ubuntu xenial is 16.04 | |
| sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" >> /etc/apt/sources.list' # if Lubuntu | |
| echo "get keys to install R" | |
| # sudo apt-key adv --keyserver keys.gnupg.net --recv-key 381BA480 # if Debian | |
| sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 # if Lubuntu | |
| echo "install R and some helpers" | |
| sudo apt-get update | |
| sudo apt-get install r-base -y | |
| sudo apt-get install r-base-dev -y | |
| sudo apt-get install r-cran-xml -y | |
| sudo apt-get install r-cran-rjava -y | |
| sudo R CMD javareconf # for rJava | |
| echo "install RStudio from the web" | |
| # use daily build to get rmarkdown & latest goodies | |
| # http://stackoverflow.com/a/15046782/1036500 | |
| # check if 32 or 64 bit and install appropriate version... | |
| # http://stackoverflow.com/a/106416/1036500 | |
| MACHINE_TYPE=`uname -m` | |
| if [ ${MACHINE_TYPE} == 'x86_64' ]; then | |
| # 64-bit stuff here | |
| URL=$(wget -q -O - http://www.rstudio.org/download/daily/desktop/ubuntu64 | grep -o -m 1 "https[^\']*" ) | |
| FILE=`mktemp`; sudo wget "$URL" -qO $FILE && sudo dpkg -i $FILE; rm $FILE | |
| else | |
| # 32-bit stuff here | |
| URL=$(wget -q -O - http://www.rstudio.org/download/daily/desktop/ubuntu32 | grep -o -m 1 "https[^\']*" ) | |
| FILE=`mktemp`; sudo wget "$URL" -qO $FILE && sudo dpkg -i $FILE; rm $FILE | |
| fi | |
| echo "start R and install commonly used packages" | |
| # Create a folder for R libraries, http://zvfak.blogspot.com/2012/06/updating-r-but-keeping-your-installed.html | |
| mkdir -p ~/Rlibs | |
| echo "R_LIBS=~/Rlibs" > ~/.Renviron | |
| # http://stackoverflow.com/q/4090169/1036500 | |
| # Make an R script file to use in a moment... | |
| LOADSTUFF="options(repos=structure(c(CRAN='http://cran.rstudio.com/'))) | |
| update.packages(checkBuilt = TRUE, ask = FALSE) | |
| packages <- c('Rcpp', 'devtools', 'knitr', 'tidyverse', 'gridExtra', 'scales', | |
| 'XML', 'RCurl', 'readxl', 'mice', 'gbm', 'xgboost', 'microbenchmark') | |
| # just some of my most often used ones | |
| install.packages(packages)" | |
| # close the R script | |
| # put that R code into an R script file | |
| FILENAME1="loadstuff.r" | |
| sudo echo "$LOADSTUFF" > /tmp/$FILENAME1 | |
| # Make a shell file that contains instructions in bash for running that R script file | |
| # from the command line. There may be a simpler way, but nothing I tried worked. | |
| NEWBASH='#!/usr/bin/env | |
| Rscript /tmp/loadstuff.r' | |
| FILENAME2="loadstuff.sh" | |
| # put that bash code into a shell script file | |
| sudo echo "$NEWBASH" > /tmp/$FILENAME2 | |
| # run the bash file to exectute the R code and install the packages | |
| sh /tmp/loadstuff.sh | |
| # clean up by deleting the temp file | |
| rm /tmp/loadstuff.sh | |
| # install Oracle Java 8 (you'll have to run the GUI installer later) | |
| sudo apt-add-repository ppa:webupd8team/java -y | |
| sudo apt-get install oracle-java8-installer -y | |
| ##### This part needs user input ##### | |
| # If want to install Anaconda Python, replace Miniconda with Anaconda in download link | |
| echo "install Miniconda Python. Need user input" | |
| MACHINE_TYPE=`uname -m` | |
| if [ ${MACHINE_TYPE} == 'x86_64' ]; then | |
| # 64-bit stuff here | |
| FILE=`mktemp`; sudo wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -qO $FILE && bash $FILE; rm $FILE | |
| else | |
| # 32-bit stuff here | |
| FILE=`mktemp`; sudo wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86.sh -qO $FILE && bash $FILE; rm $FILE | |
| fi | |
| echo "## Add Miniconda path" >> ~/.bashrc | |
| echo "export PATH=/home/anh/miniconda3/bin:$PATH" >> ~/.bashrc | |
| source ~/.bashrc | |
| conda install -y numpy scipy pandas scikit-learn jupyter | |
| echo "gen ssh keys" | |
| ssh-keygen -t rsa -C "aql3@duke.edu" | |
| # done. | |
| echo "all done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment