PostgreSQL installation in Linux is detailed

Source: Internet
Author: User
Tags md5 encryption postgresql psql

PostgreSQL installs a detailed collection of Linux
Install the 8.4.4 version here and download the Postgresql-8.4.4-1-linux.bin first.
(http://www.postgresql.org/download/) Download the linux32 version of
1. If the file is not on a Linux system, drag it from Windows to a Linux system and place it in any directory, preferably in/opt or/home. Recommended tool for a Windows file to go to Linux: WinSCP3

(

1, open a terminal, Su-into the root user;
2, chmod +xpostgresql-8.4.4-1-linux.bin
3./postgresql-8.4.4-1-linux.bin//Run this command to install the software)

2. [[email protected] ~]#/postgresql-8.4.1-1-linux-x64.bin––mode text (I'm here on the root path)
—————————————————————————
Welcome to the PostgreSQL Setup Wizard.

—————————————————————————
Please specify the directory where PostgreSQL would be installed.

3. installation directory [/opt/postgresql/8.4]: (Here direct carriage return, indicating installed in the/OPT directory)
—————————————————————————

Please select a directory under which to store your data.

4. Data directory [/opt/postgresql/8.4/data]: (This is the direct carriage return, indicating that the data is loaded in this directory)
—————————————————————————

Provide a password for the database Superuser (postgres). A locked Unix user account (Postgres) is created if not present.

5. Password: [Enter password]

6. Retype password: [repeat input]

—————————————————————————
7. Please select the port number of the server should listen on.

Port [5432]:[default port, direct return]

[616] Yi_us

[617] Yi_us.utf8

[618] Zh_cn

[619] Zh_cn.utf8

[620] Zh_hk

[621] Zh_hk.utf8

[622] Zh_sg

[623] Zh_sg.utf8

[624] Zh_tw

[625] Zh_tw.euctw

[626] Zh_tw.utf8

[627] Zu_za

[628] zu_za.iso88591

[629] Zu_za.utf8

Choose an option [1]: 619[default Character Set]

8. Install pl/pgsql in template1 database? [y/n]: n[Whether to install the template Library, where to select No]

—————————————————————————-

Setup is now the ready to begin installing PostgreSQL on your computer.

9. Does want to continue? [y/n]: y[continue installation]

—————————————————————————-

Please wait while the Setup installs PostgreSQL on your computer.

Installing

0% ______________ 50% ______________ 100%

########################################

—————————————————————————-

Setup has finished installing PostgreSQL on your computer.

Launch Stack Builder at exit?

Stack Builder used to download and install additional tools, drivers and applications to complement your Post Gresql installation. [y/n]: Y (here is the continuation of the installation of additional tools, drivers and first-off applications)
Here the database is installed successfully, then you need to configure the user, environment variables, and initialize the database
[[email protected] ~]# CP. Bash_profile. bashrc/home/postgresql/8.4/(Copy the file to the appropriate directory, this is the configuration environment variable)
[[email protected] ~]# chown-r postgres.postgres/home/postgresql/* (Configure the file owner and group to Postgres)
[[email protected] ~]# ls-ltr/home/postgresql/8.4/.bash* (see if the changes have been made)
-rw-r–r–1 postgres postgres 174 Nov 19:18/home/postgresql/8.4/.bash_profile

-rw-r–r–1 postgres postgres 176 Nov 19:18/HOME/POSTGRESQL/8.4/.BASHRC

Initialize the default zone and character set encoding for this DB cluster
[[Email protected] ~] #su –postgres (go to postgres user)
[[Email protected] ~]$/opt/postgresql/8.4/bin/initdb–d/opt/postgresql/8.4/data/(default zone and character set encoding for initializing DB cluster)
The files belonging to this database system is owned by user "Postgres".

This user must also own the server process.

The database cluster is initialized with locale en_US.

The default database encoding have accordingly been set to LATIN1.

The default text search configuration is set to "中文版".

Fixing permissions on existing Directory/home/postgresql/8.4/data ... ok

Creating subdirectories ... ok

Selecting Default Max_connections ... 100

Selecting Default Shared_buffers ... 32MB

Creating configuration files ... ok

Creating Template1 database In/home/postgresql/8.4/data/base/1 ... o

Initializing Pg_authid ... ok

Initializing dependencies ... ok

Creating system views ... ok

Loading system objects ' descriptions ... ok

Creating conversions ... ok

Creating dictionaries ... ok

Setting privileges on built-in objects ... ok

Creating Information Schema ... ok

Vacuuming database template1 ... ok

Copying template1 to Template0 ... ok

Copying template1 to Postgres ... ok

Warning:enabling "Trust" authentication for local connections

Can change this by editing pg_hba.conf or using the-a option the

Next time you run INITDB.

Success. You can now start the database server using:

Postgres-d/home/postgresql/8.4/data

Or

pg_ctl-d/home/postgresql/8.4/data-l logfile Start

Congratulations, all of you are finished now!

Common commands:
Createdb
Create a database

Createuser
Create a database user

Dropdb
Deleting a database

Dropuser
To delete a database user

Psql
Interactive PostgreSQL Front End tool that you can use to manipulate databases

Initdb
Initializing the PostgreSQL database

For example:
Psql \qà exit Psql Command interface
Psql \c Dbnameà Connection Database
pg_ctl-d/opt/postgresql/8.4/data/statusà View current service status
pg_ctl-d/opt/postgresql/8.4/data/startà Start-up service
pg_ctl-d/opt/postgresql/8.4/data/stopà Stop Service

Remote Login settings:
Open opt/postgresql/8.4/data/pg_hba.conf and add a line of code like this: (Red is added)
# IPV4 Local connections:

Host All 0.0.0.0/0 MD5

Host All 127.0.0.1/32 MD5

This line of code means that all users of all IP addresses can log on remotely via MD5 encryption.
Open opt/postgresql/8.4/data/postgresql.conf

According to the following write:
listen_addresses = ' * '

Port = 5432

max_connections = 100

This means listening for responses from all IPs.


This article from Csdn Blog, reproduced please indicate the source: http://blog.csdn.net/william_zheng2010/archive/2010/07/12/5728333.aspx

PostgreSQL installation in Linux is detailed

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.