PostgreSQL Installation Guide on Ubuntu

Source: Internet
Author: User
Tags psql

Installation environment:

Ubuntu 10.04-desktop-i386

PostgreSQL 8.4


1. Install PostgreSQL

Enter the following command

Sudo apt-Get install PostgreSQL

 

The system prompts you to install the required disk space. Enter "Y" to installProgramWill be completed automatically. After the installation is complete, the system will create a database superuser "Postgres" with a blank password. This user is both an Unlogged operating system user and a database user.


2. Modify the Linux User's Postgres Password

Enter the following command

Sudo passwd ipvs

3. Modify the password of database superuser S

1) switch to Postgres user in Linux

Sudo su Postgres

2) log on to the ipvs Database

 

 
Psql Postgres

In this way, you will see the following prompt message for S:

Psql (8.4.4)

Type "help" for help.

The command line prompt symbol of ipvs is displayed:

Postgres = #

3) enter the following command:

Alter User Login s with password 'Password'

 Type "exit" to return to the Linux Command Line.


4. Add Custom Users and databases

1) Add a new user

Createuser-drsp fedoraadmin

Enter the password of the user as prompted.

2) create a database belonging to the Custom User fedoraadmin

Createdb-O fedoraadmin mydb

With the above settings, you can use the following configuration in Java to connect to the PostgreSQL database:

User: fedoraadmin

Password: Your Password

URL: JDBC: PostgreSQL: // localhost: 5432/mydb


5. Install pgadmin3

1) run the following command to install pgadmin3:

Sudo apt-Get install pgadmin3

2) type the following command to run pgadmin3.

Pgadmin3

 You will see the main interface of pgadmin3 as follows:

Add parameters to create a connection to PostgreSQL:

6. Set access to ipvs on other machines

Modify/etc/PostgreSQL/8.4/main/pg_assist.conf:

Host All all 0.0.0.0/0 MD5 #0.0.0.0 is the address segment, and 0 is the binary bit

For example, 192.168.0.0/16 represents 192.168.0.1-192.168.255.254


Modify/etc/PostgreSQL/8.4/main/PostgreSQL. conf

Listen_address = '*'


Restart Database

Sudo/etc/init. d/postgresql-8.4 restart

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.