echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgdg.list
curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install -y postgresql-10 postgresql-10 postgresql10-contrib
After installation the server is already running the main
instance :
- data files are located in
/var/lib/postgresql/10/main/
. - configuration files are located in
/etc/postgresql/10/main/
.
If for an odd reason, the server is not running, you can run it at anytime using the following command :
systemctl start postgresql
You can access the running server using :
sudo -u postgres psql
# or su - postgresql -c "psql"
You are on your own now.