This installs the database server/client, some extra utility scripts and the pgAdmin GUI application for working with the database.
1
2sudo apt-get install postgresql postgresql-client postgresql-contrib
sudo apt-get install pgadmin3Now we need to reset the password for the ‘postgres’ admin account for the server, substitute in the password you want to use for your administrator account.
1
2
3sudo su postgres -c psql template1
template1=# ALTER USER postgres WITH PASSWORD 'password';
template1=# \qThat alters the password for within the database, now we need to do the same for the unix user ‘postgres’.
1
2sudo passwd -d postgres
sudo su postgres -c passwdSet-up the PostgreSQL admin pack that enables better logging and monitoring within pgAdmin.
1
sudo su postgres -c psql < /usr/share/postgresql/9.1/extension/adminpack--1.0.sql
Edit the postgresql.conf file.
1
sudo gedit /etc/postgresql/9.1/main/postgresql.conf
Change the line:
#listen_addresses = 'localhost'
tolisten_addresses = '*'
and also change the line:#password_encryption = on
topassword_encryption = onDefine who can access the server. This is all done using the pg_hba.conf.
1
sudo gedit /etc/postgresql/8.3/main/pg_hba.conf
add this text to the bottom of the file:
host all all [ip address] [subnet mask] md5
add in your subnet mask (i.e. 255.255.255.0) and the IP address of your server (i.e. 138.250.192.115).
Note:if you have some password error, please change all “md5” to “trust” in this file.Now all you have to do is restart the server.
1
sudo /etc/init.d/postgresql restart
Reference:
http://hocuspokus.net/2008/05/install-postgresql-on-ubuntu-804/
how to install PostgreSQL on ubuntu
- 本文链接: https://fengguoqing.github.io/2013/01/13/how-to-install-PostgreSQL-on-ubuntu/
- 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!