12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-12-25 09:56:12
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
一、环境介绍系统平台:CentOS release 6.6 (Final)Postgresql:postgresql-9.6.6SELINUX=disabledIptables关闭二、安装过程1.安装依赖包yum-yinstallgcc*yum-yinstallreadline
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
一、环境介绍
系统平台:CentOS release 6.6 (Final)
Postgresql:postgresql-9.6.6
SELINUX=disabled
Iptables关闭
二、安装过程
1.安装依赖包
yum-yinstallgcc*yum-yinstallreadline-devel
2.源码包获取
wgethttp://ftp.postgresql.org/pub/source/v9.6.6/postgresql-9.6.6.tar.gz
3.解压
tarzxfpostgresql-9.6.6.tar.gz
5.创建用户、设置密码
adduserpostgrespasswdpostgres
6.编译安装
cdpostgresql-9.6.6./configure--prefix=/home/postgres/pgsqlgmakegmakeinstall
7.设置环境变量
vim/etc/profile
添加一行
PATH=$PATH:$HOME/bin:/home/postgres/pgsql/binsource/etc/profile
8.创建数据库目录
mkdir/home/postgres/pgsql/data
创建数据库操作历史记录文件
touch/home/postgres/pgsql/.pgsql_history
更改所属组
chown-Rpostgres:postgres/home/postgres/pgsql/*
9.切换到postgre用户,初始化数据库
su-postgres/home/postgres/pgsql/bin/initdb-D/home/postgres/pgsql/dataexit
10.编译启动命令
从postgres解压后的文件夹里拷贝linux到/etc/init.d/
cp/root/postgresql-9.6.6/contrib/start-scripts/linux/etc/init.d/postgresqlvim/etc/init.d/postgresql
修改下面两行:
prefix=/home/postgres/pgsqlPGDATA="/home/postgres/pgsql/data"
保存退出
添加可执行权限
chmod+x/etc/init.d/postgresql
11.启动postgres数据库
/etc/init.d/postgresqlstart
12.测试使用
[root@MidApp~]#su-postgres[postgres@MidApp~]$psqlpsql(9.6.6)Type"help"forhelp.postgres=#\lListofdatabasesName|Owner|Encoding|Collate|Ctype|Accessprivileges-----------+----------+----------+-------------+-------------+-----------------------postgres|postgres|UTF8|en_US.utf-8|en_US.utf-8|template0|postgres|UTF8|en_US.utf-8|en_US.utf-8|=c/postgres+|||||postgres=CTc/postgrestemplate1|postgres|UTF8|en_US.utf-8|en_US.utf-8|=c/postgres+|||||postgres=CTc/postgres(3rows)postgres=#\q
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19