centos环境源码安装postgresql9.4
源码安装简要步骤
- 下载PostgreSQL 源码包
下载根目录地址:http://ftp.postgresql.org/
本人选择的是当前最新版本v9.4.1:http://ftp.postgresql.org/pub/source/v9.4.1/
本人下载的源码压缩包地址如下:
$ /usr/local/postgresql
- 1
- 解压源码包
$ tar -zxvf postgresql-9.4.1.tar.gz
- 1
- 进入解压后的目录
$ cd postgresql-9.4.1
- 1

- 开始编译安装PostgreSQL 数据库
$ ./configure
- 1
- 执行gmake
$ gmake
- 1
- 执行gmake install
$ gmake install
- 1
- 设置环境变量
$ vi .bash_profile
#### 把 PATH=$PATH:$HOME/bin 改成下面内容 ####
$ PATH=$PATH:$HOME/bin:/usr/local/pgsql/bin
- 1
- 2
- 3
- 让环境变量生效
$ source .bash_profile
- 1
- 添加用户postgres
$ adduser postgres
- 1
- 更改用户目录(可选操作)
$ vi /etc/passwd
#### 把 postgres:x:528:528::/home/postgres:/bin/bash 改成下面内容 ####
$ postgres:x:528:528::/usr/local/pgsql:/bin/bash
#### 将.bash_profile 移动到新的用户目录并修改权限 ####
$ cp /home/postgres/.bash_profile /usr/local/pgsql/
$ chown postgres.postgres .bash_profile
#### 删除用户目录 ####
$ rm -rf postgres/
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 新建数据目录
$ mkdir /usr/local/pgsql/data
- 1
- 更改权限
$ chown postgres /usr/local/pgsql/data
- 1
- 切换到postgres 用户
$ su - postgres
- 1
- 初始化数据库
$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/
- 1
- 回到root 用户
$ exit
- 1
- 复制安装目录下的linux文件到/etc/init.d/
$ cd postgresql-9.4.1
$ cp contrib/start-scripts/linux /etc/init.d/postgresql
- 1
- 2
- 添加执行权限
$ chmod +x /etc/init.d/postgresql
- 1
- 启动数据库
$ service postgresql restart
- 1
- 让数据库开机启动
$ chkconfig --add postgresql
$ chkconfig postgresql on
- 1
- 2
- 测试使用
$ su - postgres
$ createdb test
$ psql test
test=$ create table test(id int);
- 1
- 2
- 3
- 4

源码安装相关问题及解决方案
- ./configure时,提示error: readline library not found 该情况,一般是未安装readline-devel,虽然提示中有建议使用 –without readline,但是装下又何妨,万一后面出点乱子,找个问题都难找,还是装一下吧。
yum install readline-devel
- 1
- 直接执行gmake install,默认安装在哪?
$ /usr/local/pgsql
- 1
- 执行postgresql命令、修改postgresql配置文件(postgresql.conf、pg_hba.conf),文件和目录在哪?
$ /usr/local/pgsql/data
- 1
- postgresql默认只允许本机访问,需要远程连接、外网访问,如何配置? 先配置监听地址
$ vi /usr/local/pgsql/data/postgresql.conf
#### 取消掉下面一行的前面的#注释,并将值改为* ####
$ listen_addresses = '*'
- 1
- 2
- 3
再配置支持远程连接
$ vi /usr/local/pgsql/data/pg_hba.conf
#### 直接配置为不限制IP,即0.0.0.0,注意:/后面也必须为0!!! ####
$ 将 127.0.0.1/8 改为 0.0.0.0/0
come from:http://www.centoscn.com/image-text/install/2015/0407/5110.html
centos环境源码安装postgresql9.4的更多相关文章
- CentOS下源码安装Apache2.4+PHP5.4+MySQL5.5
一.准备(把所有的源文件放在‘/home/yuanjun’目录下) apr http://mirror.bjtu.edu.cn/apache/apr/apr-1.4.6.tar.gz apr-util ...
- centos下配置LNMP环境(源码安装)
准备工作,安装依赖库 yum -y install gcc automake autoconf libtool make gcc-c++ glibc libxslt-devel libjpeg lib ...
- Centos下源码安装git
1.centos下git版本太久了,才1.8几,而官方更新的还是很活跃的,于是我就想源码安装一个新版本. 2.首先到: https://github.com/git/git/releases 下载最新 ...
- centos上源码安装clang 3.8
之前想在centos系统上安装clang 3.6版本,由于yum上版本太低,想通过源码编译安装.按照网上说的源码安装步骤,下好llvm.clang.clang-tools-extra和compiler ...
- CentOS下源码安装vsftpd-3.0.0,并设置指定用户访问指定目录(附带完整配置文件)
1.卸载系统已经存在的ftp服务器 因为是源码安装,所以不能通过rpm -qa的方式查看是否已经安装ftp服务器,可以通过find / | grep vsftp*方式查看系统中存在哪些与vsftpd相 ...
- 在 CentOS 下源码安装 Xen
http://www.vpsee.com/2010/04/install-xen-on-centos-from-source/ 在 CentOS 源码编译安装 Xen 的过程和在 Debian 上编译 ...
- centos 7 源码安装gogs
gogs 是轻量级的私有git 平台,允许个人通过低配置的服务器安装私有git gogs 的官网地址是:https://gogs.io/ 安装步骤 1)源码安装mysql 2) 源码安装git 3) ...
- CentOS 下源码安装LAMP环境
一.简介 什么是LAMP LAMP是一种Web网络应用和开发环境,是Linux, Apache, MySQL, Php/Perl的缩写,每一个字母代表了一个组件,每个组件就其本身而言都是在它所代 ...
- CentOS 7 源码安装 Zabbix 6.0
Zabbix 主要有以下几个组件组成: Zabbix Server:Zabbix 服务端,是 Zabbix 的核心组件.它负责接收监控数据并触发告警,还负责将监控数据持久化到数据库中. Zabbix ...
随机推荐
- 给你完美浪漫的七夕,APICloud送你双人电影票!
我一直觉得“幸福的感觉” 就像存款 留着以后用 会幸福感爆棚 于是,我一直习惯于等等,再等等 以为那样就会很幸福 直到有一天,突然发现,在我构想的未来中,总是有你 世界那么大,我只在乎你 世界那么长, ...
- Android --SwipeRefreshLayout 下拉刷新
1.Layout <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/id_swipe_ly" an ...
- 一台电脑多个文件夹安装多个Redis服务
思路: 在弄Mongodb的时候,可以在不同的文件夹下面运行不同的mongodb实例 那么Redis可以吗 现在添加一个Redis文件夹,里面放置redis,修改配置端口为6378 将以前的那个Red ...
- BlockingQueue的使用
本例介绍一个特殊的队列:BlockingQueue,如果BlockQueue是空的,从BlockingQueue取东西的操作将会被阻断进入等待状态,直到BlockingQueue进了东西才会被唤醒.同 ...
- 高级选择器querySelector和querySelectorAll
Javascript新提供的querySelector和querySelectorAll方法,是仿照CSS选择器功能编写的 querySelector 功能:该方法返回满足条件的单个元素.按照深度优先 ...
- Linux脚本实现“按任意键继续/Press any key to continue”效果
此代码来自lnmp一键安装包,用于实现“按任意键继续/Press any key to continue”效果: get_char() { SAVEDSTTY=`stty -g` #隐藏终端输入显示 ...
- HttpwebClient的四种请求方式
最近悟出来一个道理,在这儿分享给大家:学历代表你的过去,能力代表你的现在,学习代表你的将来. 十年河东十年河西,莫欺少年穷. 本文旨在发布代码,供自己参考,也供大家参考,谢谢. 正题: Ht ...
- bootstrap 时间选择器 datetime
$("'#datetimepicker").datetimepicker({ format: "yyyy-mm-dd hh:ii:ss",//设置时间格式,默认 ...
- 在xocde运行profile 遇到"Existing default base temp directory '/Library/Caches/com.apple.dt.instruments' has insufficient privileges for user id 505. Please have the owner delete this directory"
找到这篇文章 http://stackoverflow.com/questions/34153795/xcode-7-unable-to-open-instruments-from-developer ...
- nyist 240 小明的调查统计(二)
http://acm.nyist.net/JudgeOnline/problem.php?pid=240 小明的调查统计(二) 时间限制:1000 ms | 内存限制:65535 KB 难度:1 ...