Skip to content

Instantly share code, notes, and snippets.

@vdegenne
Last active April 21, 2021 11:33
Show Gist options
  • Save vdegenne/61a85c220666fb53fdb565a0c0df8f79 to your computer and use it in GitHub Desktop.
Save vdegenne/61a85c220666fb53fdb565a0c0df8f79 to your computer and use it in GitHub Desktop.
Install postgresql 10 on Debian

Install postgresql 10 on Debian (stretch)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment