-
Library Docs
-
Hub Docs
-
Requests Docs
-
System Docs
-
Source Code
-
Community
-
Installation
-
Monitors
-
Contributing
-
Library Docs
-
Hub Docs
-
Requests Docs
-
System Docs
-
Source Code
-
Community
-
Installation
-
Monitors
-
Contributing
Setup Postgres
Atlas System uses a Postgres database. The database can be shared and on another server. Here’s a short install guide if you would like to set everything on the same server.
After setting up the database you should revisit the postgres config and tune it to work best on your server.
∞ Install Packages
apt install -y postgresql postgresql-contrib
apk add postgresql postgresql-contrib
# on new servers the mirror streams may need to be updated.
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*
# find latest version
dnf module list postgresql
# install latest version
dnf module enable -y postgresql:13
yum install -y postgresql-server postgresql-contrib
∞ Start Postgres
systemctl start postgresql
# let it start on reboot
systemctl enable postgresql
mkdir /run/postgresql
chown postgres:postgres /run/postgresql/
# next switch over to the postgres non-root user.
# run commands individually and not as a batch.
su postgres -
mkdir /var/lib/postgresql/data
chmod 0700 /var/lib/postgresql/data
initdb -D /var/lib/postgresql/data
pg_ctl start -D /var/lib/postgresql/data
exit
systemctl start postgresql
# let it start on reboot
systemctl enable postgresql
# initialize postgres
postgresql-setup --initdb
∞ If you are running in Docker…
If you are demoing in docker you will need run different commands to get it started as docker doesn’t include systemd.
apt install -y sudo
/etc/init.d/postgresql start
No extra steps needed.
yum install -y sudo
sudo -u postgres /usr/bin/initdb /var/lib/pgsql/data/ --no-locale --encoding=UTF8
sudo -u postgres /usr/bin/pg_ctl start -D /var/lib/pgsql/data -s -o "-p 5432" -w -t 300
∞ Create a user and database
# create a web user
su - postgres -c "psql --command \"CREATE USER web_user WITH PASSWORD '1234_with_single_quotes';\""
# give user access to a db
su - postgres -c "createdb -O web_user atlas-system"