How to install PostgreSQL on Linux
In this short guide you will learn how to install PostgreSQL for SnailyCADv4 on Linux.
This guide is mainly directed for users using Ubuntu. However, most commands will work for any Linux distro
Installing PostgreSQL
Here we will update the apt packages and install PostgreSQL
sudo apt update && sudo apt install postgresql-14 postgresql-contrib
Starting PostgreSQL service
Now we must start the PostgreSQL service. This will allow us to connect to the database.
sudo systemctl start postgresql.service
PostgreSQL configuration
Firslty we must connect to the database via the command line:
psql -d postgres
Note that you might run into this error, if you try to execute this command as a root user:
psql: error: FATAL: role "root" does not exist
To avoid it, simply switch to the postgres user:
sudo -u postgres -i
Then you can execute the first command that was mentionned before and you can continue with the guide.
psql -d postgres
Creating SnailyCAD user
Create user
This username must match the POSTGRES_USER
in your ENV/.env file.
`postgres=#` CREATE USER "snailycad";
set permissions
`postgres=#` ALTER USER "snailycad" WITH SUPERUSER;
setting a password
This password must match the POSTGRES_PASSWORD
in your ENV/.env file.
`postgres=#` ALTER USER "snailycad" PASSWORD 'replace-with-your-password';
Creating SnailyCADv4 database
This database name must match the POSTGRES_DB
in your ENV/.env file.
`postgres=#` CREATE DATABASE "snaily-cadv4";
Next steps
Now you've successfully setup PostgreSQL on Ubuntu for SnailyCADv4.
Make sure to update your .env
file or your ENV (Manager app) to use the same values your used in this guide.