- 下载postgresql源码包和uuid-1.6.1.tar.gz源码包
- 安装uuid
tar -zxvf uuid-1.6.1.tar.gz
cd uuid-1.6.1
./configure
make && make install
uuid安装成功
- 安装postgresql
tar -zxvf postgresql-10.3.tar.gz
cd postgresql-10.3
./configure --without-readline --without-zlib --with-ossp-uuid
make world
make install-world
- 初始化数据库并启动
mkdir /usr/local/pgsql/data
echo "export PGDATA=/usr/local/pgsql/data" >> /etc/profile
source /etc/profile
// 创建 postgres用户
adduser postgres
// 修改权限
chown postgres /usr/local/pgsql/data
// 初始化数据库并启动
su postgres
cd /usr/local/pgsql/bin
./initdb
./pg_ctl start
- 安装libuuid库,自行下载libuuid-1.0.3.tar.gz
tar -zxvf libuuid-1.0.3.tar.gz
cd libuuid-1.0.3
./configure
make && make install
cd /usr/local/lib/
ln libuuid.so.16.0.21 /usr/local/pgsql/lib/libuuid.so.16
至此,用户可使用create extension “uuid-ossp”来创建uuid相关函数