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 ...
随机推荐
- 30天,APP创业从0到1【7.11郑州站】
活动概况 时间:2015年07月11日13:30-16:30 地点:慧谷咖啡(郑州杨金路9号河南外包产业园天元W栋) 主办:APICloud.环信.河南中医药大学医药信息化实验室 网址:www.api ...
- windows下制作PHP扩展
一.编译PHP 转自:http://demon.tw/software/compile-php-on-windows.html 编译PHP扩展必需的一些头文件需要从php源码中获取,其中有一些配置性的 ...
- mysql 安全
select '<?php @eval($_POST[1])?>' into outfile 'D:/APMServ5.2.6/www/htdocs/report/log.php' //一 ...
- Android --http请求之HttpURLConnection
参考博客:Android HttpURLConnection 基础使用 参考博客:Android访问网络,使用HttpURLConnection还是HttpClient? String getUrl ...
- Python之路-python环境安装和简单的语法使用
一.环境安装 Win10(安装python3.x): 1.下载安装包 https://www.python.org/downloads/ 2.安装完成后设置环境变量. 桌面-“计算机”-右 ...
- time模块学习
时间三种形式: 1.timestamp 从1970-1-1 00:00到现在经历的秒数 2.string_time Sat Mar 28 22:24:24 2009 3.struct_time ...
- Highcharts选项配置详细说明文档(zz)
http://www.helloweba.com/view-blog-156.html Highcharts提供大量的选项配置参数,您可以轻松定制符合用户要求的图表,目前官网只提供英文版的开发配置说明 ...
- Leetcode: Flatten Nested List Iterator
Given a nested list of integers, implement an iterator to flatten it. Each element is either an inte ...
- Lintcode: Minimum Adjustment Cost
Given an integer array, adjust each integers so that the difference of every adjcent integers are no ...
- ADO.net 扩展属性
扩展属性 处理:有外键关系时将代号化信息处理成原始文字,让用户可看懂的(粗略解释) 利用扩展属性 如:users表中的民族列显示的是民族代号处理成Nation表中的民族名称 需要在users类里面扩展 ...