how to install PostgreSQL on ubuntu
2013-01-13 00:29
429 查看
1. This installs the database server/client, some extra utility scripts and the pgAdmin GUI application for working with the database.
$ sudo apt-get install postgresql postgresql-client postgresql-contrib
$ sudo apt-get install pgadmin3
2. Now 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.
$ sudo su postgres -c psql template1
template1=# ALTER USER postgres WITH PASSWORD 'password';
template1=# \q
3. That alters the password for within the database, now we need to do the same for the unix user ‘postgres’.
$ sudo passwd -d postgres
$ sudo su postgres -c passwd
4. Set-up the PostgreSQL admin pack that enables better logging and monitoring within pgAdmin.
$ sudo su postgres -c psql < /usr/share/postgresql/9.1/extension/adminpack--1.0.sql
5. Edit the postgresql.conf file.
$ sudo gedit /etc/postgresql/9.1/main/postgresql.conf
Change the line:
#listen_addresses = 'localhost'
to
listen_addresses = '*'
and also change the line:
#password_encryption = on
to
password_encryption = on
6. Define who can access the server. This is all done using the pg_hba.conf.
$ 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.
7. Now all you have to do is restart the server.
$ sudo /etc/init.d/postgresql restart
Reference:
http://hocuspokus.net/2008/05/install-postgresql-on-ubuntu-804/
$ sudo apt-get install postgresql postgresql-client postgresql-contrib
$ sudo apt-get install pgadmin3
2. Now 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.
$ sudo su postgres -c psql template1
template1=# ALTER USER postgres WITH PASSWORD 'password';
template1=# \q
3. That alters the password for within the database, now we need to do the same for the unix user ‘postgres’.
$ sudo passwd -d postgres
$ sudo su postgres -c passwd
4. Set-up the PostgreSQL admin pack that enables better logging and monitoring within pgAdmin.
$ sudo su postgres -c psql < /usr/share/postgresql/9.1/extension/adminpack--1.0.sql
5. Edit the postgresql.conf file.
$ sudo gedit /etc/postgresql/9.1/main/postgresql.conf
Change the line:
#listen_addresses = 'localhost'
to
listen_addresses = '*'
and also change the line:
#password_encryption = on
to
password_encryption = on
6. Define who can access the server. This is all done using the pg_hba.conf.
$ 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.
7. Now all you have to do is restart the server.
$ sudo /etc/init.d/postgresql restart
Reference:
http://hocuspokus.net/2008/05/install-postgresql-on-ubuntu-804/
相关文章推荐
- Ubuntu 14.04安装PostgreSQL How To Install and Use PostgreSQL on Ubuntu 14.04
- how to install xen on ubuntu 11.10 (Oneiric)
- How to install virtualbox on ubuntu
- How to install and configure Apache and PHP on ubuntu
- How to install VNC on Ubuntu
- How to Install Laravel with an Nginx Web Server on Ubuntu 14.04(Composer,laravel,nginx)
- How To Install LAMP (Linux, Apache, MySQL, PHP) On Ubuntu 11.04/11.10/12.04
- How to install sun-java5-jdk on Ubuntu 9.10
- How To Install Apache Kafka on Ubuntu 14.04
- 如何在Ubuntu9.10上安装RealPlayer(How to install RealPlayer on Ubuntu)
- How to install Cacti on Ubuntu
- How to install/setup latest version of PHP 5.5 on Ubuntu 12.04 LTS (Precise Pangolin)
- How to Install Metasploit on Linux Ubuntu
- How to install PHP pthreads extension on Ubuntu?
- How to install OpenERP 6 on Ubuntu 10.04 LTS Server--1
- How to Install and Configure VNC on Ubuntu 14.04
- How to Install Hadoop on Ubuntu 13.10
- How To Install Elasticsearch, Logstash, and Kibana (ELK Stack) on Ubuntu 14.04
- How to install GIT on Linux (Ubuntu & CentOS)