Manually compile and install PostgreSQL9.1 and pgAdmin3 in Ubuntu

Source: Internet
Author: User
Tags psql
This article assumes that the reader has downloaded and decompressed PostgreSQL9.1 and pgAdmin3 respectively install PostgreSQL1. execute the following command sudoapt-getinstallzlib1g-devsudoapt-getinstalllibreadline-dev2 in the terminal.

This document assumes that the reader has downloaded and decompressed PostgreSQL 9.1 and pgAdmin3 respectively.

1. Install PostgreSQL

1. Execute the following command on the terminal

Sudo apt-get install zlib1g-dev


Sudo apt-get install libreadline-dev

2. compile in the postgresql decompressed directory.

Cd $ the_dir_of_postgresql

./Configure

Make
Su
Make install

3. required work after installation

# PostgreSQL cannot run as root users, so we create ipvs users

Adduser postgres
Mkdir/usr/local/pgsql/data
Chown postgres/usr/local/pgsql/data
Su-postgres
/Usr/local/pgsql/bin/initdb-D/usr/local/pgsql/data

# Create a log file


Touch/usr/local/pgsql/data/logfile
/Usr/local/pgsql/bin/postgres-D/usr/local/pgsql/data> logfile 2> & 1 &

4. Create a test Database

# After the following statement is executed, PostgreSQL returns the "created database" information,

# Indicates that the database has been created


/Usr/local/pgsql/bin/createdb test

# Enter the test Database

/Usr/local/pgsql/bin/psql test

# Input table creation statement:

Create table mytable (id varchar (20), name varchar (30 ));

# After the creation is complete, a "CREATED" message is displayed, indicating that the creation is successful.

# Insert a data entry:

Insert into mytable values (Author, Xu Yongjiu );

# Psql returns an INSERT 18732 1 Statement.

# Query whether insertion is successful:

SELECT * from mytable;

# Exit psql:


\ Q

# Exit the ipvs user

Exit

# Exit the root user

Exit

2. Install pgAdmin

1. install necessary Libraries
Sudo apt-get install libxml2-dev

Sudo apt-get install libxslt1-dev

Sudo apt-get install libpg-dev

Sudo apt-get install wx-common libwxgtk2.8-dev

2. If libcrypto. so exists in/usr/lib, skip 2 and execute 3. otherwise:

Cd/usr/lib
# Create a link. libcrypto. so. x. y. z is the name of the crypto dynamic library file in an existing version of/usr/lib.
Sudo ln-s libcrypto. so. x. y. z libcrypto. so

3. Switch to the decompressed directory of your pgAdmin and execute the following commands in sequence:
./Configure
Make all
Sudo make install

4. Run pgAdmin

Cd/usr/local/pgadmin3/bin

Sudo./pgadmin3

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.