Linux 编译安装 PostgreSQL
PostgreSQL Linux 大约 1080 字下载地址
清华大学镜像,下载并解压。
wget https://mirrors.tuna.tsinghua.edu.cn/postgresql/source/v12.2/postgresql-12.2.tar.gz
tar -zxvf postgresql-12.2.tar.gz
安装依赖
Ubuntu
apt-get install libreadline-dev
apt-get install libxslt-dev
CentOS
yum install libxslt-devel
配置编译参数
./configure --prefix=/usr/local/pgsql --with-libxml --with-libxslt
make
make install
可能错误
configure: error: library 'xslt' is required for XSLT support
configure: error: readline library not found
安装readline
yum install readline-devel
创建启动用户
useradd postgres
groupadd postgres
修改数据库文件所属
chown -R postgres:postgres /usr/local/pgsql
修改数据存储文件夹所属
mkdir /usr/local/pgsql/data
chown -R postgres:postgres /usr/local/pgsql/data
初始化数据库并指定存储路径
initdb -D /usr/local/pgsql/data
启动 PostgreSQL 且生成日志文件 logfile
/usr/local/pgsql/bin
目录下执行。
./pg_ctl -D /usr/local/pgsql/data -l logfile start
停止 PostgreSQL
./pg_ctl -D /usr/local/pgsql/data -l logfile stop
重启 PostgreSQL
./pg_ctl -D /postgresql/pgsql/data/ -l logfile restart
备注
PostgreSQL 13.2
在Ubuntu 14.04
下指定--with-libxml
未生效。
参考
https://www.postgresql.org/docs/current/install-procedure.html
阅读 1845 · 发布于 2021-05-15
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Python UnicodeDecodeError: 'gbk' codec can't decode byte 0x80阅读 3798
-
Java jcmd 开启和关闭 JMX阅读 3855
-
GoJS Diagram 去掉选中黑色边框阅读 2126
-
SpringMVC 中的 redirect 和 forward 区别阅读 1897
-
Kubernetes Label 相关命令阅读 1081
-
Java 语法糖 - 可变参数阅读 870
-
面试题:HTTP2.0 与 HTTP1.1 的区别阅读 3757
-
Kubernetes Pod 控制器 DaemonSet阅读 1132
-
Android dp,sp 与 px 转换阅读 5845
-
Linux tcpdump: no suitable device found阅读 2687