Skip to content

Instantly share code, notes, and snippets.

@sahilseth
Last active January 3, 2016 20:25
Show Gist options
  • Save sahilseth/01d5e88e431334fcd527 to your computer and use it in GitHub Desktop.
Save sahilseth/01d5e88e431334fcd527 to your computer and use it in GitHub Desktop.
Install a new shiny server on Ubuntu (EC2)
## ------ download this file:
## wget https://gist.githubusercontent.com/sahilseth/01d5e88e431334fcd527/raw -O cloud_formation.sh
## bash cloud_formation.sh
## run this file
## chmod u+x cloud_formation.sh
## Assuming you are running this as ubuntu user
### --------- Install from apt-get
sudo apt-get update
sudo apt-get install -y emacs screen git apt-file
sudo apt-get install -y r-base libcairo2-dev libcurl4-gnutls-dev libxt-dev
sudo apt-get install -y gdebi-core libapparmor1 # Required only for Ubuntu (RStudio)
sudo apt-get install -y libxml2-dev ## required by R package XMl
sudo apt-get install -y ruby
sudo gem install rmate
## Example: apt-file search Intrinsic.h
## ---------- Create a downloads folder
mkdir ~/downloads
cd ~/downloads
### --------- Install Rstudio
#wget http://download2.rstudio.org/rstudio-server-0.98.978-amd64.deb
sudo gdebi rstudio-server-0.98.978-amd64.deb
wget https://download2.rstudio.org/rstudio-server-0.99.467-amd64.deb
sudo gdebi rstudio-server-0.99.467-amd64.deb
## ------ make a Rprofile with required repos
echo 'options(repos=c(CRAN="http://cran.revolutionanalytics.com", BioCsoft="http://www.bioconductor.org/packages/2.14/bioc"))' > ~/.Rprofile
## ------ copy the profile to root, since we will install all packages using root
sudo cp ~/.Rprofile /root/.Rprofile
sudo Rscript -e 'install.packages("Cairo")'
sudo Rscript -e 'install.packages("devtools")'
sudo Rscript -e 'install.packages( "XML")'
sudo Rscript -e 'install.packages( "RCurl")'
sudo Rscript -e 'require(devtools);install_github("rstudio/shiny")'
sudo Rscript -e 'devtools::install_github("rstudio/rmarkdown")'
### --------- Install Shiny
wget http://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-1.2.1.362-amd64.deb
sudo gdebi shiny-server-1.2.1.362-amd64.deb
## make change shiny path
shinypath=/srv/shiny-server
sudo chgrp admin $shinypath
sudo chmod ug+rw $shinypath
### --------- Install some shinier tools
sudo Rscript -e 'devtools::install_github("rstudio/R-Websockets")'
sudo Rscript -e 'devtools::install_github("marcionicolau/shinyExt")'
sudo Rscript -e 'devtools::install_github("AnalytixWare/ShinySky")'
### --------- Start the servers
sudo start shiny-server
sudo restart shiny-server
status shiny-server
sudo start rstudio-server
### -------- Add cloud watch
sudo apt-get install -y unzip libwww-perl libcrypt-ssleay-perl
sudo apt-get install -y libswitch-perl
cd ~/downloads
wget http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip
unzip CloudWatchMonitoringScripts-v1.1.0.zip
rm CloudWatchMonitoringScripts-v1.1.0.zip
cd aws-scripts-mon
#sudo crontab -l | { cat; echo '*/5 * * * * /home/ubuntu/downloads/aws-scripts-mon/mon-put-instance-data.pl --mem-util --mem-used --mem-avail --disk-path=/ --disk-space-util --disk-space-avail --from-cron'; } | sudo crontab -
### --------- Disable AppArmor for zpanel:
sudo invoke-rc.d apparmor kill
sudo update-rc.d -f apparmor remove
### --------- Install the webserver
wget https://raw.githubusercontent.com/zpanel/installers/master/install/beta/Ubuntu-14_04-LTS/ubuntu-14.04-LTS-apache2.4.9-php5.5.14.sh
curl ipinfo.io ## get ip stuff
sudo bash ubuntu-14.04-LTS-apache2.4.9-php5.5.14.sh
### --------- Install zantatico
sudo zppy repo add zppy-repo.mach-hosting.com
sudo zppy update
sudo zppy install zantasticox
### --------- Reboot to make get everything in order
sudo reboot
### --------- After reboot one may optionally install amazon ec2 cli
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
sudo mkdir /usr/local/ec2
sudo unzip ec2-api-tools.zip -d /usr/local/ec2
export EC2_HOME=/usr/local/ec2/ec2-api-tools-1.7.0.0
export PATH=$PATH:$EC2_HOME/bin
### --------- Java home
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
### ---------- Tell the CLI Tools Who You Are
export AWS_ACCESS_KEY=your-aws-access-key-id
export AWS_SECRET_KEY=your-aws-secret-key
@sahilseth
Copy link
Author

Run the following code

wget https://gist.githubusercontent.com/sahilseth/01d5e88e431334fcd527/raw -O cloud_formation.sh
bash cloud_formation.sh

Script was last updated on June, 2014 (some tools may have newer/better versions available).

You may have to copy paste some of the code, instead of the bash command below (after sudo zppy install zantasticox).

Zpanel questions:

  • Proceed with install: y
  • Select time: America/Chicago
  • Grub install: choose a disk
  • Continue without grub install: yes
  • restart server

Check out your Shiny server at:

MYIP:3838

Rstudio at:

MYIP:8787

Zpanel at:

MYIP

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