English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Install PostgreSQL on Linux

Open the PostgreSQL official website https://www.postgresql.org/, click the Download , you can see that there are many platform packages here, including Linux, Windows, Mac OS, etc.

Linux We can see that it supports various platforms such as Ubuntu and Red Hat, click the specific platform link to view the installation method:

Click the  file browser, we can also download the latest source code of PostgreSQL.

This chapter takes Ubuntu as an example.

Ubuntu installs PostgreSQL

Ubuntu can use apt-Get PostgreSQL installed:

sudo apt-get update
sudo apt-get install postgresql postgresql-client

After installation, the system will create a database superuser postgres with an empty password.

# sudo -i -u postgres

At this time, use the following command to enter postgres, and output the following information to indicate that the installation was successful:

~$ psql
psql (9.5.17)
Type "help" for help.
postgres=#

Enter the following command to exit the PostgreSQL prompt:

\q

PostgreSQL is started by default after installation, but you can also manually start the service in the following way.

sudo /etc/init.d/postgresql start # Start
sudo /etc/init.d/postgresql stop # Shutdown
sudo /etc/init.d/postgresql restart # Restart