解压
tar -zxvf
安装依赖
pkg install gmake perl5 python libxml2 libxslt ldapsdk openldap26-server openldap26-client ossp-uuid readline p5-Locale-Msgfmt gettext tcl90 tcllib sudo
配置
cd 解压的文件夹
./configure --prefix=/opt/postgresql/16 --exec-prefix=/opt/postgresql/16 --bindir=/opt/postgresql/16/bin --sysconfdir=/opt/postgresql/16/configuration --libdir=/opt/postgresql/16/lib --includedir=/opt/postgresql/16/include --datarootdir=/opt/postgresql/16/dataroot --localedir=/opt/postgresql/16/locale --mandir=/opt/postgresql/16/locale/man --docdir=/opt/postgresql/16/locale/doc --htmldir=/opt/postgresql/16/locale/html --enable-nls='en_US zh_CN' --with-perl --with-python --with-tcl --with-icu --with-openssl --with-ldap --with-pam --with-libxml --with-libxslt --with-readline --with-zlib --without-icu --with-ossp-uuid --with-includes=/usr/local/include:/usr/src --with-libraries=/usr/local/lib
编译安装
gmake -j32 && gmake install
(contrib文件夹下也编译安装)
用户
adduser postgres
初始化
mkdir /opt/postgresql/16/dbdata/
sudo -u postgres /opt/postgresql/16/bin/initdb -D /opt/postgresql/16/dbdata
文件夹权限
chown -R postgres /opt/postgresql/16/dbdata/
chmod -R 750 /opt/postgresql/16/dbdata/
服务
/etc/rc.d/postgresql
#!/bin/sh
# PROVIDE: postgresql
# REQUIRE: DAEMON mountlate
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable PostgreSQL:
#
# postgresql_enable="YES"
# # optional
# postgresql_data="/var/db/postgres/data16"
# postgresql_flags="-w -s -m fast"
# postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C"
# # leave empty to use the login class set in in /etc/passwd:
# postgresql_login_class="my_custom_login_class"
# postgresql_profiles=""
#
# See /usr/


2万+

被折叠的 条评论
为什么被折叠?



