数据库

 首页 > 数据库 > postgresql > CentOS5系统安装postgresql9数据库

CentOS5系统安装postgresql9数据库

分享到:
【字体:

Linux安装版为CentOS 5.5,以root用户身份登录
[root@centos55 ~]# uname -a
Linux centos55.tyler.org 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT 2010 i686 i686 i386 GNU/Linux

PostGreSQL 9.0.2安装文件 postgresql-9.0.2.tar.bz2 存放在 /src目录下
在/tmp目录下解压源文件
[root@centos55 ~]# cd /tmp
[root@centos55 tmp]# tar jxvf /src/postgresql-9.0.2.tar.bz2

执行配置,PostGreSQL9将安装至/opt/pgsql下
[root@centos55 tmp]# cd postgresql-9.0.2/
[root@centos55 postgresql-9.0.2]# ./configure --prefix=/opt/pgsql
编译源文件 [root@centos55 postgresql-9.0.2]# make
安装编译后的二进制文件到/opt/pgsql目录下
[root@centos55 postgresql-9.0.2]# make install
[root@centos55 postgresql-9.0.2]# ls /opt/pgsql
bin  include  lib  share
添加系统对.so动态链接库的搜索
[root@centos55 lib]#  echo "/opt/pgsql/lib" >> /etc/ld.so.conf
[root@centos55 lib]# ldconfig
创建数据库管理员用户
[root@centos55 postgresql-9.0.2]# adduser postgres
输入用户postgres登录密码 123456
[root@centos55 postgresql-9.0.2]# passwd postgres
Changing password for user postgres.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

初始化表空间
[root@centos55 postgresql-9.0.2]# mkdir /opt/pgsql/data/
[root@centos55 postgresql-9.0.2]# chown postgres /opt/pgsql/data/
[root@centos55 postgresql-9.0.2]# su  - postgres
[postgres@centos55 ~]$ /opt/pgsql/bin/initdb -D /opt/pgsql/data/ [postgres@centos55 ~]$ ls /opt/pgsql/data/
base         pg_ident.conf  pg_subtrans  pg_xlog          serverlog
global       pg_multixact   pg_tblspc    postgresql.conf
pg_clog      pg_notify      pg_twophase  postmaster.opts
pg_hba.conf  pg_stat_tmp    PG_VERSION   postmaster.pid

自启动
[root@centos55 postgresql-9.0.2]# cp /tmp/postgresql-9.0.2/contrib/start-scripts/linux  /etc/init.d/pgsql
[root@centos55 start-scripts]#  chmod u+x /etc/init.d/pgsql
修改/etc/init.d/pgsql启动角本,将缺省安装目录由/usr/local/pgsql改为 /opt/pgsql
[root@centos55 start-scripts]# vi /etc/init.d/pgsql
将第32行
prefix=/usr/local/pgsql
改为
prefix=/opt/pgsql
将第35行
PGDATA="/usr/local/pgsql/data"
改为
PGDATA="/opt/pgsql/data"
设置开机自启动
[root@centos55 start-scripts]# chkconfig --level 2345  pgsql on
[root@centos55 start-scripts]# chkconfig --list pgsql
pgsql           0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

创建数据库
[root@centos55 postgresql-9.0.2]# su - postgres
[postgres@centos55 bin]$ /opt/pgsql/bin/createdb test
测试
[postgres@centos55 bin]$ /opt/pgsql/bin/psql test
psql (9.0.2)
Type "help" for help.
test=#

分享到:
CentOS6系统中yum方式安装postgresql
一、安装(以root身份进行) 1、检出最新的postgresql的yum配置从http://yum.pgsqlrpms.org/reporpms/repoview/pgdg-centos.html 然后根据版本选择需要的rpm后执行下列命令 rpm -Uvh http://yum.pgsqlrpms.org/reporpms/8.3/pgdg-centos-8.3-6.noarch.rpm 2、安装或者升级postgresql-libs yum upgrade postgresql-libs 3、安...
CentOS5系统中编译安装postgresql步骤
首先,去PostgreSQL官网下载最新版本。笔者使用Linux x86_64源码编译安装包:postgresql-9.0.1.tar.bz2。 安装过程如下: ----------------------------- Head ------------------------------------- mkdir -p /data/setupfiles/ && cd /data/setupfiles/ wget http://wwwmaster.postgresql.org/redir/161/f/source/v9.0.1...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……