Install PostgreSQL-8.1.5 in Linux

Source: Internet
Author: User
Tags psql
Because of work needs, in the new project need to use PostgreSQL-8.1.5; although previously configured, but this configuration but found that the new version and the original has a lot of different places.
I will not discuss the differences here. I just recorded the configuration process and forgot it later.

PostgreSQL official: http://www.postgresql.org/
Download postgresql-8.1.5.tar.gz.

For the sake of security, the designer cannot run PostgreSQL as the root user, so the corresponding user and group must be created.

# Useradd postgre (automatically create a postgre Group)

The installation process is not complex. The installation method for other source code versions is similar:
Decompress the package to/usr/local/src:
# Tar xvfz postgresql-8.1.5.tar.gz
# Cd postgresql-8.1.5
#./Configure -- prefix =/usr/local/pgsql
# Make
# Make install
# Chown-r postgre. postgre/usr/local/pgsql

After the installation is completed, it is not all that's done, and there are some finishing work to do:
# Vi ~ Postgre/. bash_profile
Add:

Pglib =/usr/local/pgsql/lib
Pgdata = $ home/Data
Path = $ path:/usr/local/pgsql/bin
Manpath = $ manpath:/usr/local/pgsql/man
Export pglib pgdata path manpath

Log On As an ipvs user,
# Su-postgre
Create a database directory:
$ Mkdir data

Start the database engine:

$ Initdb
[Postgre @ WWW postgre] $ initdb
This database system will be initialized with username "postgre ".
This user will own all the data files and must also own the server process.

Fixing permissions on pre-existing data directory/home/postgre/Data
Creating Database System directory/home/postgre/data/base
Creating Database xlog directory/home/postgre/data/pg_xlog
Creating template database in/home/postgre/data/base/template1
Creating global relations in/home/postgre/data/base
Adding template1 database to pg_database

Creating view pg_user.
Creating view pg_rules.
Creating view pg_views.
Creating view pg_tables.
Creating view pg_indexes.
Loading pg_description.
Vacuuming database.

Success. You can now start the database server using:

/Usr/local/pgsql/bin/postmaster-D/home/postgre/Data
Or
/Usr/local/pgsql/bin/pg_ctl-D/home/postgre/Data start
$ Postmaster-I-d data ($ postmaster-I-d ~ /Data &)
[1] 22603
[Postgre @ WWW postgre] $ Debug: data base system is starting up at THU Jan 31 02:00:44 2002
Debug: data base system was shut down at THU Jan 31 01:57:58 2002
Debug: data base system is in production state at THU Jan 31 02:00:44 2002

In this way, PostgreSQL uses a database located in/usr/local/pgsql/data to allow Internet users to connect (-I) and run it in the background.

Create a database
$ Createdb mydb
PostgreSQL returns the "Created database" information, indicating that the database has been created.
$ Psql mydb
Go to the interactive Psql tool and create a table:

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 insert 18732 1 to check whether the insert is successful:

Select * From mytable;

Exit Psql and run \ Q.
--------------------------------------
If this configuration is used only, tests on the local machine are normal, but other machines cannot be connected.
You need to modify the pg_cmd.conf and PostgreSQL. conf files.
I won't write all the large files. I put them directly for your reference.
Hope you can help everyone. (by uploading the conf file without authorization, you can download the file and change the file to. conf)

Http://files.cnblogs.com/matildawaltzer/pg_hba.pdf
Http://files.cnblogs.com/matildawaltzer/postgresql.pdf

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.