Skip to content

Server Setup

André Luiz Lima Costa edited this page Aug 22, 2024 · 6 revisions

Server Setup

A standard VPS server will be suitable to use GDataSystems if it has a PostgreSQL-Postgis database server, a web server, and a shiny server. The server will be accessed by its IP address or domain name and the connection parameters such as database name, username and password.

A standard VPS server will be suitable to host the database, web server, and shiny server. Here are the instructions on how to setup the server on a UBUNTU operating system.

Configuring the GDataSystems server

Installing PosgreSQL14

sudo apt install postgresql postgresql-client

Checking install

systemctl status postgresql.service

Replacing postgres user password (Optional)

sudo -u postgres psql
postgres=# \password postgres 
postgres=# \q

Installing postgis 3

sudo apt install gnupg2
sudo apt install postgis postgresql-14-postgis-3

Listening to all addresses -Remember to open port 5432

sudo nano /etc/postgresql/14/main/postgresql.conf
listen_addresses = '*'   

Set Client authentication (adjust properly, below is an example to a very permissive configuration).

sudo nano /etc/postgresql/14/main/pg_hba.conf
# TYPE  DATABASE     USER       ADDRESS                 METHOD
host  all     all        127.0.0.1/32 	md5

Restarting PostgreSQL

systemctl restart postgresql.service

Installing Apache2 and R

sudo apt install apache2
sudo apt install r-base
sudo apt-get install libpq-dev
sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev

Installing the necessary R packages

sudo R
 install.packages('DT')
 install.packages('rpostgis')
 install.packages('terra')
 install.packages('leaflet')
 install.packages('leaflet.extras')
 install.packages('glue')
 install.packages('ggplot2')
 install.packages('shiny')
 install.packages('shinymanager')
 install.packages('dplyr')
 install.packages('rmarkdown')
 q()

Installing shiny

sudo apt-get install gdebi-core
wget https://download3.rstudio.org/ubuntu-18.04/x86_64/shiny-server-1.5.20.1002-amd64.deb
sudo gdebi shiny-server-1.5.20.1002-amd64.deb

Configuring shiny as a server

sudo a2enmod proxy
sudo a2enmod proxy_http sudo a2enmod proxy_wstunnel
nano /etc/apache2/sites-enabled/000-default.conf

Add the following to the file at the end.

      <Proxy /shiny/>
                Allow from localhost
        </Proxy>
        ProxyPreserveHost On
        ProxyPass /shiny/ http://localhost:3838/
        ProxyPassReverse /shiny/ http://localhost:3838/
        DocumentRoot /var/www/html

Add the following lines to the file /etc/shiny-server/shiny-server.conf

disable_websockets true;
sanitize_errors off;disable_protocols xdr-streaming xhr-streaming iframe-eventsource iframe-htmlfile;

Installing PHP

sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt -y install php7.4
sudo apt-get install php7.4-pgsql
sudo apt install php7.4-mbstring

That’s it! The server is now configured and ready to receive the mineral exploration database.

Clone this wiki locally