CentOS6.5+PostgreSQL9.5安装参考
来源:互联网 发布:福建金税三期软件下载 编辑:程序博客网 时间:2024/06/06 14:10
1基本需求:centos6.5上安装postgres9.5
主机
postgres9.5安装目录
pg安装前源码及相关包
CentOS6.5
软件:/pgres;数据库实例:/pgres/data
/pgsolf
2安装过程
2.1安装操作系统(略)
2.2创建文件夹/pgsolf,拷贝以下文件(root操作)
[root@localhost]# mkdir /pgsolf
ncurses-devel-5.7-3.20090208.el6.x86_64.rpm
readline-devel-6.0-4.el6.x86_64.rpm
zlib-devel-1.2.3-29.el6.x86_64.rpm
postgresql-9.5beta1.tar.gz
解压数据库包
tar -xvzf postgresql-9.5beta1.tar.gz
2.3安装依赖rpm包(一般缺少以上几个)
rpm -ivh *.rpm
2.4创建pg数据库安装目录
mkdir -R /pgres
2.5编译安装(root操作)
[root@localhost pgsolf]#cd /pgsolf/postgresql-9.5beta1
[root@localhostpostgresql-9.5beta1]# ls
aclocal.m4 config.status contrib GNUmakefile INSTALL src
config configure COPYRIGHT GNUmakefile.in Makefile
config.log configure.in doc HISTORY README
指定安装目录:
[root@localhostpostgresql-9.5beta1] ./configure --prefix=/pgres
编译:[root@localhostpostgresql-9.5beta1]# make
安装: [root@localhostpostgresql-9.5beta1]# make install
创建用户设置密码:
[root@localhostpostgresql-9.5beta1]useradd postgres
[root@localhostpostgresql-9.5beta1] passwd postgres
创建数据库存放目录与设置权限
[root@localhost pgres]# mkdir -p /pgres/data
[root@localhost pgres]# chown -R postgres:postgres /pgres/data
2.6初始化实例(postgres操作)
[root@localhost bin]# su - postgres
[root@localhost bin]#cd /pgres/bin
[postgres@localhost ~]$ ./initdb -D /pgres/data
初步使用:
启动数据库:./pg_ctl -D /pgres/data start
查看postgres进程:#ps -ef | grep postgres
停止postgresql数据库: ./pg_ctl -D /pgres/data stop -m fast
创建用户数据库
[postgres@localhost bin]$ ./createdb test
[postgres@localhost bin]$ ./psql test
Type "help" for help.
test=#
2.7设置postgres环境变量(方便操作)
切换用户:su - postgres
修改.bash_profile文件完成后保存退出(Esc>:>wq)
#vi /home/postgres/.bash_profile
export PGHOME=/pgres
export PGDATA=/pgres/data
PATH=$PATH:$HOME/bin:$PGHOME/bin
export PATH
#source /home/postgres/.bash_profile
查看环境变量配置:echo $PGHOME
2.8设置pg服务为linux服务并开机自启(root操作)
pg的开机自启动脚本位于PostgreSQL源码目录的contrib/start-scripts路径下 //linux文件即为linux系统上的启动脚本
1) 复制linux文件到/etc/init.d目录下并更名
#cp linux/etc/init.d/postgresql
2)修改/etc/init.d/postgresql文件的两个变量
prefix设置为pg软件的安装路径: /pgres
PGDATA设置为pg的数据目录路径:/pgres/data
3)修改/etc/init.d/postgresql文件mod
#chmod a+x /etc/init.d/postgresql
4)root执行测试
#service postgresql start
#service postgresql stop
5)设置postgresql服务开机自启动
#chkconfig --add postgresql
- CentOS6.5+PostgreSQL9.5安装参考
- centos6.5 安装postgresql9.4
- centos6.5 安装postgresql9.4
- centos6.5下postgresql9.4.3安装与配置
- linux CentOS6.5安装PostgreSQL9.4.3——傻瓜笔记
- Centos6.5下用postgresql9.4.3源码安装
- Centos7安装PostgreSQL9.5
- 源码安装Postgresql9.5
- Centos6.x安装postgresql9.3
- CentOS6.x安装Postgresql9.6
- CentOS7安装PostgreSQL9.5过程
- centos6.5下postgresql9.4.3同步流复制的standby安装与配置
- CentOS6使用YUM安装Postgresql9.4
- centos6.6下编译安装PostgreSQL9.4.1、配置phppgadmin
- centos6.6下编译安装PostgreSQL9.4.1、配置phppgadmin
- 在Ubuntu12.04上安装postgresql9.1和postgis1.5
- 在Ubuntu12.04上安装postgresql9.1和postgis1.5
- PostgreSQL9.5在CentOS 7 x86_64下的安装
- NameValueCollection 转换为 Json
- SSH加密原理、RSA非对称加密算法学习与理解
- 解决ASP.NET Web Applicatio超时时间已到.在操作完成之前超时时间已过或服务器未响应
- Android Intent Action详解
- 【总结】Mac版Android Studio常用快捷键总结
- CentOS6.5+PostgreSQL9.5安装参考
- MySQL学习笔记10:修改数据
- Xcode 7 及 iOS9 更新遇到的一些问题
- hive1.2.1 MoveTask报错
- jQuery对象与DOM对象之间的转换方法
- 剑指offer第六题【旋转数组的最小数字】c++实现
- tomcat设置环境变量
- Android网络框架-Volley实践 使用Volley打造自定义ListView
- Android中的dispatchTouchEvent()、onInterceptTouchEvent()和onTouchEvent()