First, installation
1, Installation: Use the following command, will automatically install the latest version, here is 9.5
sudo Install PostgreSQL
When the installation is complete, a default database account named "Postgres" with no password is created as the database administrator, and a Linux user named "Postgres" is created.
Some information after the installation is complete is as follows:
Config/etc/postgresql/9.5/main
Data/var/lib/postgresql/9.5/main
Locale en_US. UTF-8
Socket/var/run/postgresql
Port 5432
Second, modify the database default Administrator password 1, connect to the database
Execute the PSQL client as a Linux user "Postgres" and enter the client's prompt interface
sudo -u postgres psql
2. Modify the password of the default administrator for the database
' 123456 '
This way, the administrator "Postgres" The password is "123456".
Exit psql Client Command: \q
Third, modify the password of Linux user Postgres
This is actually not the same as installing PostgreSQL: Run the passwd command as a "Postgres" Linux User
[Email protected]:/etc/postgresql/9.5sudopasswd for passwd: Password updated successfully
Iv. Configuring the database to run remote connection access
After the installation is complete, the database can only be connected locally, and the other machines will not be able to access it.
1. Modify the Listening address
sudo gedit/etc/postgresql/9.5
Remove the comment #listen_addresses = ' localhost ' and change it to listen_addresses = ' * '
2. Modify the IP segment of the accessible user
sudo gedit/etc/postgresql/9.5
At the end of the file, add: host all 0.0. 0.0 0.0. 0.0 MD5 , indicating that any IP connection is running
3. Restart the database
sudo /etc/init.d/postgresql restart
Other: Managing users, establishing databases, etc.
V. References
Http://blog.sina.com.cn/s/blog_6af33caa0100ypck.html
Ubuntu PostgreSQL Installation and configuration