1.1.1 Software Installation
1. set user groups and user levels
Postgresql cannot run as root and will run as a different identity, so the corresponding users and groups must be established.
(1) New Database user groups: Groupadd Database
(2) New Pgsql users belong to PostgreSQL user groups: useradd-g Database Pgsql
(3) Modify Pgsql User Password :p asswd Pgsql (Here the password is set to Postgres )
2. Operating System Information: CentOS 5 x86
3. Preparing the installation package, download PostgreSQL source code: http://www.postgresql.org/ftp/source and now it's updated to version 9.1beta, this installation uses 8.4.6
4. Upload the downloaded postgresql-8.4.6.tar.gz to the/pgsql directory.
5
- [Email protected] opt]$$ CD Pgsql
- [Email protected] opt]$ $tar-ZXVF postgresql-8.4.6.tar.gz
- [Email protected] opt]$ CD postgresql-8.4.6/
- [Email protected] postgresql-8.4.6]$./configure--prefix=/opt/postgresql
-
[[email protected] postgresql-8.4.6] $make
- [[email protected] postgresql-8.4.6] $make Install
6. Error
[[email protected] postgresql-8.4.6]$ make install
Make-c Doc Install
MAKE[1]: Entering directory '/home/pgsql/pgsql/postgresql-8.4.6/doc '
Mkdir-p--/opt/postgresql/share/doc//html
Mkdir:cannot Create directory '/opt/postgresql ': Permission denied
MAKE[1]: * * * [installdirs] Error 1
MAKE[1]: Leaving directory '/home/pgsql/pgsql/postgresql-8.4.6/doc '
Make: * * * [install] Error 2
[[email protected] postgresql-8.4.6]$ make install
Make-c Doc Install
MAKE[1]: Entering directory '/home/pgsql/pgsql/postgresql-8.4.6/doc '
Mkdir-p--/opt/postgresql/share/doc//html
Mkdir:cannot Create directory '/opt/postgresql ': Permission denied
MAKE[1]: * * * [installdirs] Error 1
MAKE[1]: Leaving directory '/home/pgsql/pgsql/postgresql-8.4.6/doc '
Make: * * * [install] Error 2
approach, change the opt to 777.
8. Initialize the database.
-
[Email protected] postgresql-8.4.2]$ cd/opt/postgresql/bin/
-
[Email protected] Bin]$./initdb--encoding=utf8-d/opt/postgresql/data
After initialization is complete, the screen prints the following information:
Success. You can now start the database server using:
./postgres-d/home/pgsql/data
Or
./pg_ctl-d/home/pgsql/data-l LogFile Start
10. Start the database
-
[Email protected] bin]$./postgres-d/opt/postgresql/data
Of course, you can write the startup information to the log through the log rewrite, for example:
-
[Email protected] bin]$/pg_ctl-d/opt/postgresql/data/-/home/pgsql/log/pg_server.log start
Log information is recorded in the file/home/pgsql/log/pg_server.log.
11. Installation is complete.
This article from the "Different Regions" blog, declined to reprint!
CentOS Installation PostgreSQL Database process