Last Updated: September 2022
This guide describes how to install the necessary system dependencies. You will need
sudo or root access on the server to complete these steps.
The following applications will be used during the installation process, but not necessarily needed by Tethys Portal.
You will need a text editor to modify the configuration files during the installation.
sudo apt install -y vim nano
sudo yum install -y vim nano
Wget is used during the installation to download files needed for the installation, like the install script for Miniconda.
sudo apt install -y wget
sudo yum install -y wget
A PostgreSQL database is required for a Tethys Portal installation. For a production installation we recommend that you DO NOT use the database that is installed via conda. Instead install PostgreSQL using the system package manager as follows:
sudo apt install -y postgresql postgresql-contrib
sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf -qy module disable postgresql sudo dnf -y install postgresql12 postgresql12-server
Initialize the database:
# Initialize the database sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
Start PostgreSQL and enable it so it starts up automatically when the server restarts:
sudo systemctl start postgresql-12 sudo systemctl enable postgresql-12
You may be wondering why you didn't need to initialize the database and start/enable it when installing PostgreSQL on Ubuntu. This has to do with the differing philosophies between CentOS and Ubuntu. Ubuntu packages are usually installed with a reasonable default configurtaion and already enabled and running, whereas CentOS only installs the binaries and leaves the configurtaion and enabling up to you.
Verify that PostgreSQL is Running:
sudo systemctl status postgresql
sudo systemctl status postgresql-12
Install PostgreSQL using these instructions if you plan on having the database on the same server as your Tethys Portal. If you plan to use a separate server for your database, you may also use these instructions to install PostgreSQL on that server, but do not run these installation commands on the Tethys Portal server. These instructions are based on How To Install and Use PostgreSQL on Ubuntu 20.04 and How To Install PostgreSQL 12 on CentOS 7 / CentOS 8.
postgresuser is the default superuser account that comes installed with PostgreSQL. In this step assign the
postgresuser a password so that we can initialize it.
sudo su - postgres psql -c "alter user postgres with password '<POSTGRES_PASSWORD>'" exit
<POSTGRES_PASSWORD>with the password you created during the Preparation step.
On CentOS it is also necessary to enable password authentication for local connections. This is done in the
pg_hba.conffile as follows:
sudo vim /var/lib/pgsql/12/data/pg_hba.conf
# "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 ident # IPv6 local connections: host all all ::1/128 ident
# "local" is for Unix domain socket connections only local all all md5 # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5
Then restart PostgreSQL:
sudo systemctl restart postgresql-12
Verify that password authentication is working by opening a connection to the database using the commandline client
PGPASSWORD=<POSTGRES_PASSWORD> psql -U postgres
If authentication isn't working, try rebooting the system and trying again. This can be done by running:
sudo shutdown -r now
For more information on this topic see: Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)
PostGIS is an extension for PostgreSQL that adds spatial data types and functions. Using PostGIS you can create databases with columns that can store features and rasters similar to ArcGIS geodatabases. You can also perform common geoprocessing analyses using the spatial database functions.
If the app(s) you plan to install on this server require a spatial persistent store, then install PostGIS as follows:
sudo apt install -y postgis postgresql-12-postgis-3
sudo yum install -y epel-release sudo dnf config-manager --set-enabled PowerTools sudo yum install -y postgis30_12
These instructions are based on How To Install PostGIS on Ubuntu 20.04/18.04 | Debian 10 and How To Install PostGIS on CentOS 8.
NGINX (pronounced "N-gin-X") is a free and open-source HTTP server and reverse proxy. It is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. NGINX is used in combination with Daphne as an HTTP server to host Tethys Portal in production.
Install NGINX as follows:
sudo apt install -y nginx
Disable and stop NGINX because it will be managed with Supervisor
sudo systemctl stop nginx # Will manage w/ supervisor sudo systemctl disable nginx # Will manage w/ supervisor
sudo yum install -y nginx
Supervisor is a process control system. It allows users to control and monitor many processes on UNIX-like operating systems. Supervisor is used in the Tethys Portal production deployment to control the NGINX and Daphne server processes.
Install Supervisor as follows:
# It is not required to start and enable supervisor when installing from apt on Ubuntu sudo apt update sudo apt install -y supervisor
sudo yum install -y epel-release
sudo yum update sudo yum install -y supervisor
Start Supervisor and enable it so it starts up automatically when the server restarts:
sudo systemctl start supervisord sudo systemctl enable supervisord
Use these commands to start, stop, and restart Supervisor:
sudo systemctl start supervisord sudo systemctl stop supervisord sudo systemctl restart supervisord
Postfix is an email server. You should install Postfix if you plan to support the "forgotten password" feature of Tethys Portal.
Install Postfix as follows:
sudo apt install -y postfix libsasl2-modules
sudo yum install -y postfix cyrus-sasl-plain cyrus-sasl-md5
Start Postfix and enable it so it starts up automatically when the server restarts:
sudo systemctl enable postfix sudo systemctl start postfix