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