To install and setup PostgreSQL 9.6 on Debian 9, follow these steps:
- Update the package index:
sudo apt-get update
- Install the PostgreSQL 9.6 package:
sudo apt-get install postgresql-9.6
- Start the PostgreSQL service and enable it to start at boot:
sudo systemctl start postgresql
sudo systemctl enable postgresql
- Change the default PostgreSQL user password:
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'new_password';"
Once the installation is complete, you can connect to the PostgreSQL server using the psql
command-line client. For example, to connect as the postgres
user, use the following command:
sudo -u postgres psql
Note: Before installing PostgreSQL, make sure that your system has the required resources (e.g. memory, disk space, etc.) to handle the PostgreSQL service. Additionally, you may need to modify the firewall rules to allow incoming connections to the PostgreSQL server.