Author: Heiyeluren
QQ Group: 5415735 (FreeBSD installation and maintenance Group)
Date: 2004/9/17
Special thanks to QQ group Friend Nam, this article under his patient guidance to produce
PostgreSQL is an open source database management system, PostgreSQL is a very complex object-relational database management system (ORDBMS), but also the most powerful, most characteristic and most complex free software database system. Many of its features are the precursor to many of today's business databases, some of which are not even available in commercial databases. Relative to MySQL, PostgreSQL is a very thorough open source program developed by many hackers, currently it is standard on Linux operating system such as Redhat. :-)
Today we say PostgreSQL on the FreeBSD platform installation process, there is nothing complicated, just my two days to install a summary of the process, I hope to be able to install the novice a hint. (We use the FreeBSD system is 5.2.1 version, other installation platform should be similar, we install the following PostgreSQL all manual, you can also use ports)
First go to PostgreSQL's official FTP server to download the installer back, I use the version is 7.4.5, size is 11.9MB. (After all, is the source code, not very big, hehe)
Download Address: ftp://ftp.postgresql.org/pub/v7.4.5/postgresql-7.4.5.tar.gz
After downloading, we put it in the/USR/SRC directory, first unpack the program:
# tar ZXVF postgresql-7.4.5.tar.gz
After decompression, generate the postgresql-7.4.5 directory, enter the directory:
# CD postgresql-7.4.5
To configure programs and installation directories:
#./configure--prefix=/usr/local/pgsql
Our installer needs to use Gmake instead of make, so we have to check if our system has gmake:
# Gamke
Gmake:command not found.
It seems that our system does not have Gmake installed, so we have to install Gmake first, we will use FreeBSD expertise ports to install,: (If your system installed Gmake continue to install PostgreSQL)
# Whereis Gmake # First Find out where our gmake ports
Gmake:/usr/ports/devel/gmake # Oh, here it is, hehe
# Cd/usr/ports/devel/gmake
# make install # Oh, we started ports ...
Generally wait more than 10 minutes on the line, I waited for 12 minutes, according to the different speed and so on.
With the Gamke installed, we can find it in the/usr/local/bin:
Then we will be able to use Gmake to continue to install our PostgreSQL, of course, you can also install the gmake first and then PostgreSQL installation, we continue:
# cd/usr/src/postgresql-7.4.5 # into the PostgreSQL installation directory
#/usr/local/bin/gmake # execute gmake to compile
#/usr/local/bin/gmake Install # To install, the program will be installed into the/usr/local/pgsql directory
If the above error occurs, follow the installation steps to check if you are doing the right thing.
Because running PostgreSQL cannot use root for security reasons, we want to create a user to run the PostgreSQL specifically:
# PW User Add Postgres # Add a person named Postgres
# mkdir/usr/local/pgsql/data # Create a new folder to store the database
In order for Postgres to have full control of the data directory, we set permissions:
# chown Postgres/usr/local/pgsql/data
After setting the permissions, we switch to the Postgres user:
$ log:could Not create socket to statistics COLLECTOR:PROTOCOL not supported
Log:database system is shut down at 2004-09-17 14:20:52 CST
Log:checkpoint's at 0/9b6e1c
Log:redo's at 0/9b6e1c; Undo record are at 0/0; Shutdown TRUE
Log:next transaction id:541; Next oid:17143
Log:database System is ready
This time the program is parked here, because the program has been started, can not end the current program, or the database will terminate the operation, when we open another terminal to postgres users
View process after login:
$ top
PID USERNAME PRI Nice SIZE RES state time Wcpu CPU COMMAND
891 postgres 0 13508K 2708K Select 0:00 0.00% 0.00% postgres
If you see a similar process above, then our PostgreSQL will start successfully and be able to use it.
Finally, create a database:
$/usr/local/pgsql/bin/createdb Test # Create a database test
CREATE DATABASE
Once the database is created successfully, it can connect to the past through the PostgreSQL client:
$/usr/local/pgsql/bin/psql Test
Welcome to Psql 7.4.5, the PostgreSQL Interactive terminal.
Type: \copyright for distribution Terms
\h for help with SQL commands
\? For help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
test=#
Finally, test= #是终端提示符, then you can manage PostgreSQL and execute SQL statements here, specifically refer to PostgreSQL manual.
Resources:
PostgreSQL Chinese Manual http://www.pgsqldb.org/pgsqldoc-7.4/index.html
PostgreSQL Chinese website http://www.pgsqldb.org
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.