Last active
July 10, 2019 06:37
-
-
Save david-hammond/eeac86d2a50eefdd9b83a3faa27a1a66 to your computer and use it in GitHub Desktop.
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 | |
sudo apt upgrade -y | |
sudo apt install postgresql postgresql-contrib -y | |
sudo apt install vim -y | |
#To allow database to be accessed remotely follow this https://linuxize.com/post/how-to-install-postgresql-on-ubuntu-18-04/ | |
#you need to edit the follwoing 2 files using vim - the most difficult part, vim instructions here https://vim.rtorr.com/ | |
#sudo vim /etc/postgresql/10/main/postgresql.conf | |
sudo sed -i s/"#listen_addresses = 'localhost'"/"listen_addresses = '*' "/g /etc/postgresql/10/main/postgresql.conf | |
#sudo vim /etc/postgresql/10/main/pg_hba.conf | |
sudo sed -i '[email protected]/[email protected]/0@' /etc/postgresql/10/main/pg_hba.conf | |
sudo service postgresql restart | |
# if this screws up and you want to reinstall postgres use sudo apt-get --purge remove postgresql-10 postgresql-client-10 postgresql-client-common postgresql-common postgresql-contrib postgresql-contrib-10 | |
#install git | |
sudo apt install git -y | |
#get most recent version of R https://linuxize.com/post/how-to-install-r-on-ubuntu-18-04/ | |
curl "https://gist.githubusercontent.com/david-hammond/6cb80ac403238ebf19597a5e2746183a/raw" > key.txt | |
sudo apt-key add key.txt | |
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/' -y | |
sudo apt update | |
sudo apt install r-base -y | |
sudo apt install build-essential -y | |
#Install R server | |
sudo apt-get install gdebi-core -y | |
wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.2.1335-amd64.deb | |
sudo gdebi rstudio-server-1.2.1335-amd64.deb -y | |
#R studio should now be available in browser at IP.Address:8787 | |
sudo apt install libcurl4-openssl-dev libssl-dev libxml2-dev libudunits2-dev libgdal-dev libgeos-dev libproj-dev -y | |
sudo su - -c "R -e \"install.packages('devtools', repos='http://cran.rstudio.com/')\"" | |
sudo su - -c "R -e \"install.packages('tidyverse', repos='http://cran.rstudio.com/')\"" | |
sudo su - -c "R -e \"install.packages('pacman', repos='http://cran.rstudio.com/')\"" | |
sudo su - -c "R -e \"install.packages('ProjectTemplate', repos='http://cran.rstudio.com/')\"" | |
sudo su - -c "R -e \"install.packages('rio', repos='http://cran.rstudio.com/')\"" | |
#follow instructions here to set up password | |
#sudo su - postgres -c "createuser guest" | |
#sudo -u postgres psql -c "alter user guest with encrypted password 'guest';" | |
#sudo -u postgres psql -c "GRANT CONNECT ON DATABASE countrydata TO guest;" | |
#sudo -u postgres psql -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO guest;" | |
#sudo -u postgres psql -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO guest;" | |
#follow instructions here to set up password | |
#sudo su - postgres -c "createuser admin" | |
#sudo -u postgres psql -c "alter user admin with encrypted password 'admin';" | |
#sudo -u postgres psql -c "GRANT CONNECT ON DATABASE countrydata TO admin;" | |
#sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE countrydata TO admin;" |
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
#To create a database server copy and paste these into your ubuntu box | |
sudo apt-get update | |
sudo apt update | |
#to get the ip address of the computer type | |
sudo apt install net-tools -y | |
ifconfig | |
#write down the ip address, should be 192.168.0.xxx | |
#install ssh so you can remotely log into your server | |
sudo apt-get install openssh-server -y | |
# test you can connect remotely by install kitty on your windiows machine http://www.9bis.net/kitty/?page=Download | |
#Then copy and paste these lines to set up your server | |
sudo apt install curl -y | |
sudo apt install bash -y | |
curl "https://gist.githubusercontent.com/david-hammond/eeac86d2a50eefdd9b83a3faa27a1a66/raw/83cb07cb324dfd35f8136f8eef15d5921f9a9e89/ubuntu-database-18-04-rstudioserver.sh" > setup.sh | |
chmod u+x setup.sh | |
./setup.sh | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment