源码安装PostgreSQL 10.3
使用源码编译PostgreSQL 10.3全过程。
服务器环境
root@YaoYuan ~# cat etc/*release
Oracle Linux Server release 7.9
NAME="Oracle Linux Server"
VERSION="7.9"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Oracle Linux Server 7.9"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:9:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.9
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.9
Red Hat Enterprise Linux Server release 7.9 (Maipo)
Oracle Linux Server release 7.9
root@YaoYuan ~# uname -a
Linux dell.scutech 4.14.35-2047.505.4.3.el7uek.x86_64 #2 SMP Wed Jul 21 14:02:03 PDT 2021 x86_64 x86_64 x86_64 GNU/Linux
下面源码
wget --no-check-certificate https://ftp.postgresql.org/pub/source/v15.3/postgresql-15.3.tar.bz2
tar xf postgresql-15.3.tar.bz2
这样在当前目录下展开了PostgreSQL的源程序
$ ll postgresql-15.3
总用量 780
-rw-r--r--. 1 oracle oinstall 397 5月 9 05:13 aclocal.m4
drwxr-xr-x. 2 oracle oinstall 4096 5月 9 05:25 config
-rwxr-xr-x. 1 oracle oinstall 601977 5月 9 05:13 configure
-rw-r--r--. 1 oracle oinstall 89369 5月 9 05:13 configure.ac
drwxr-xr-x. 61 oracle oinstall 4096 5月 9 05:24 contrib
-rw-r--r--. 1 oracle oinstall 1192 5月 9 05:13 COPYRIGHT
drwxr-xr-x. 3 oracle oinstall 87 5月 9 05:25 doc
-rw-r--r--. 1 oracle oinstall 4264 5月 9 05:13 GNUmakefile.in
-rw-r--r--. 1 oracle oinstall 277 5月 9 05:13 HISTORY
-rw-r--r--. 1 oracle oinstall 63842 5月 9 05:26 INSTALL
-rw-r--r--. 1 oracle oinstall 1875 5月 9 05:13 Makefile
-rw-r--r--. 1 oracle oinstall 1213 5月 9 05:13 README
drwxr-xr-x. 16 oracle oinstall 4096 5月 9 05:26 src
编译安装
./configure
make world
sudo make install-world
...
parallel group (2 tests): event_trigger oidjoins
event_trigger ... ok 111 ms
oidjoins ... ok 200 ms
test fast_default ... ok 130 ms
============== shutting down postmaster ==============
============== removing temporary instance ==============
=======================
All 212 tests passed.
=======================
make[1]: 离开目录“/home/oracle/postgresql-15.3/src/test/regress”
oracle@YaoYuan postgresql-15.3$ sudo make install-world
make world用时4分钟多。
在/etc/profile中增加如下内容,这样每个用户登录的时候都会执行
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export LD_LIBRARY_PATH
MANPATH=/usr/local/pgsql/share/man:$MANPATH
export MANPATH
PATH=/usr/local/pgsql/bin:$PATH
export PATH
export PGDATA=/usr/local/pgsql/data
创建用户
adduser postgres
初始化数据库
root@YaoYuan ~# mkdir -p usr/local/pgsql/data
root@YaoYuan ~# chown postgres usr/local/pgsql/data
root@YaoYuan ~# su - postgres
上一次登录:四 7月 27 18:41:37 CST 2023pts/0 上
-bash-4.2$ usr/local/pgsql/bin/initdb -D usr/local/pgsql/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Shanghai
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
-bash-4.2$
启动数据库
-bash-4.2$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
waiting for server to start.... done
server started
-bash-4.2$ /usr/local/pgsql/bin/createdb test
-bash-4.2$ /usr/local/pgsql/bin/psql test
psql (15.3)
Type "help" for help.
test=#
免责声明:
1、本站资源由自动抓取工具收集整理于网络。
2、本站不承担由于内容的合法性及真实性所引起的一切争议和法律责任。
3、电子书、小说等仅供网友预览使用,书籍版权归作者或出版社所有。
4、如作者、出版社认为资源涉及侵权,请联系本站,本站将在收到通知书后尽快删除您认为侵权的作品。
5、如果您喜欢本资源,请您支持作者,购买正版内容。
6、资源失效,请下方留言,欢迎分享资源链接
文章评论