戒赌网站怎么做九台网络推广
web/
2025/9/27 2:15:24/
文章来源:
戒赌网站怎么做,九台网络推广,卢氏住房和城乡建设厅网站,用电脑怎么做网站PostgreSQL 数据库源码编译安装全流程详解 Linux 8 1. 基础环境配置1.1 修改主机名1.2 配置操作系统yum源1.3 安装操作系统依赖包1.4 禁用SELINUX配置1.5 关闭操作系统防火墙1.6 创建用户和组1.7 建立安装目录1.8 编辑环境变量 2. 源码方式安装#xff08;PG 16#xff09;2.… PostgreSQL 数据库源码编译安装全流程详解 Linux 8 1. 基础环境配置1.1 修改主机名1.2 配置操作系统yum源1.3 安装操作系统依赖包1.4 禁用SELINUX配置1.5 关闭操作系统防火墙1.6 创建用户和组1.7 建立安装目录1.8 编辑环境变量 2. 源码方式安装PG 162.1 下载源码安装包2.2 编译安装源码包2.3 初始化数据库2.4 启动数据库2.5 开机自启动2.6 编辑环境变量 3. 安装后配置3.1 修改默认用户postgres密码3.2 连接配置文件3.3 数据库启动关闭 1. 基础环境配置
1.1 修改主机名
hostnamectl set-hostname pgdb
# 配置hosts文件
cat /etc/hosts EOF
192.168.1.109 pgdb
EOF1.2 配置操作系统yum源
创建挂载目录
mkdir /mnt/iso
编辑yum源配置文件
cat /etc/yum.repos.d/yum.repoEOF
[sourceOS]
nameyumserverOS
baseurlfile:///mnt/iso/BaseOS
gpgcheck0
enabled1[sourceAPP]
nameyumserverApp
baseurlfile:///mnt/iso/AppStream
gpgcheck0
enabled1
EOF
检查yum源
yum clean all
yum makecache
yum repolist1.3 安装操作系统依赖包
yum install -y mke automake zlib zlib-devel bzip2 bzip2-devel bzip2-libs readline readline-devel gcc gcc-c bison ncurses ncurses-devel libaio-devel gmp gmp-devel mpfr mpfr-devel libmpc 1.4 禁用SELINUX配置
getenforce
setenforce 0
iptables -F
sed -i s/SELINUXenforcing/SELINUXdisabled/ /etc/selinux/config
cat /etc/selinux/config
getenforcePermissive –输出表示临时关闭
Disabled –重启服务器后输出1.5 关闭操作系统防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service1.6 创建用户和组
# 创建pg用户和组
groupadd -g 2000 postgres
useradd -g postgres -u 2000 postgres
echo postgres123 | passwd --stdin postgres# 验证创建成功
id postgres1.7 建立安装目录
# 创建安装目录
mkdir -p /pgsql/app/pg16
mkdir -p /pgsql/soft
mkdir -p /pgdata/data/pg16
mkdir -p /pgdata/arch
chown -R postgres.postgres /pgsql
chown -R postgres.postgres /pgdata
chmod -R 775 /pgsql
chmod -R 775 /pgdata1.8 编辑环境变量
# 编辑环境变量
vi /home/postgres/.bash_profile
export PGPORT5432
export PGDATA/pgdata/data/pg16
export PGHOME/pgsql/app/pg16
export LANGen_US.utf8
export LD_LIBRARY_PATH$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export DATEdate %Y%m%d%H%M
export PATH$PGHOME/bin:$PATH:.
export MANPATH$PGHOME/share/man:$MANPATH
export PGUSERpostgres
export PGDATABASEpostgres2. 源码方式安装PG 16
2.1 下载源码安装包
官方下载地址 https://www.postgresql.org/ftp/source/
[rootpgdb soft]# ll
total 31676
-rwxr-xr-x 1 root root 32433767 Mar 19 14:23 postgresql-16.1.tar.gz2.2 编译安装源码包
# 解压源码包
[rootpgdb soft]# tar -xvf postgresql-16.1.tar.gz
[rootpgdb soft]# cd postgresql-16.1
# 配置编译选项 可以自定义端口号 默认5432
[rootpgdb postgresql-16.1]# ./configure --prefix/pgsql/app/pg16 --with-pgport5436
# 编译源代码
[rootpgdb postgresql-16.1]# make
# 编译安装
[rootpgdb postgresql-16.1]# make install2.3 初始化数据库
[postgrespgdb ~]$ /pgsql/app/pg16/bin/initdb -D /pgdata/data/pg16
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.utf8.
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 /pgdata/data/pg16 ... 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 ... okinitdb: 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:pg_ctl -D /pgdata/data/pg16 -l logfile start2.4 启动数据库
[postgrespgdb ~]$ pg_ctl -D /pgdata/data/pg16 -l logfile start
waiting for server to start.... done
server started2.5 开机自启动
添加配置文件 参考PG16 RPM安装时配置文件EnvironmentPGDATA/pgdata/data/pg16/ExecStart/pgsql/app/pg16/bin/postgres -D ${PGDATA} vi /usr/lib/systemd/system/postgresql-16.service
# Its not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. It is recommended to use systemd
# dropin feature; i.e. create file with suffix .conf under
# /etc/systemd/system/postgresql-16.service.d directory overriding the
# units defaults. You can also use systemctl edit postgresql-16
# Look at systemd.unit(5) manual page for more info.# Note: changing PGDATA will typically require adjusting SELinux
# configuration as well.# Note: do not use a PGDATA pathname containing spaces, or you will
# break postgresql-16-setup.
[Unit]
DescriptionPostgreSQL 16 database server
Documentationhttps://www.postgresql.org/docs/16/static/
Aftersyslog.target
Afternetwork-online.target[Service]
TypenotifyUserpostgres
Grouppostgres# Note: avoid inserting whitespace in these Environment lines, or you may
# break postgresql-setup.# Location of database directory
#EnvironmentPGDATA/var/lib/pgsql/16/data/
EnvironmentPGDATA/pgdata/data/pg16/# Where to send early-startup messages from the server (before the logging
# options of postgresql.conf take effect)
# This is normally controlled by the global default set by systemd
# StandardOutputsyslog# Disable OOM kill on postgres main process
OOMScoreAdjust-1000
EnvironmentPG_OOM_ADJUST_FILE/proc/self/oom_score_adj
EnvironmentPG_OOM_ADJUST_VALUE0#ExecStartPre/usr/pgsql-16/bin/postgresql-16-check-db-dir ${PGDATA}
ExecStart/pgsql/app/pg16/bin/postgres -D ${PGDATA}
ExecReload/bin/kill -HUP $MAINPID
KillModemixed
KillSignalSIGINT# Do not set any timeout value, so that systemd will not kill postgres
# main process during crash recovery.
TimeoutSec0# 0 is the same as infinity, but infinity needs systemd 229
TimeoutStartSec0TimeoutStopSec1h[Install]
WantedBymulti-user.target
重新加载配置文件 systemctl start postgresql-16.service 不会结束命令systemctl status postgresql-16.service Active: activating (start)显示状态非running
# reload配置文件
[rootpgdb ~]# systemctl daemon-reload
# 启动数据库
[rootpgdb ~]# systemctl start postgresql-16.service
# 开机自启动
[rootpgdb ~]# systemctl enable postgresql-16.service
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-16.service → /usr/lib/systemd/system/postgresql-16.service.
# pg14 资源状态
[rootpgdb ~]# systemctl status postgresql-16.service
● postgresql-16.service - PostgreSQL 16 database serverLoaded: loaded (/usr/lib/systemd/system/postgresql-16.service; enabled; vendor preset: disabled)Active: activating (start) since Wed 2025-03-19 16:21:17 CST; 3min 33s agoDocs: https://www.postgresql.org/docs/16/static/Main PID: 1062 (postgres)Tasks: 6 (limit: 37638)Memory: 11.9MCGroup: /system.slice/postgresql-16.service├─1062 /pgsql/app/pg16/bin/postgres -D /pgdata/data/pg16/├─1067 postgres: checkpointer ├─1068 postgres: background writer ├─1070 postgres: walwriter ├─1071 postgres: autovacuum launcher └─1072 postgres: logical replication launcher Mar 19 16:21:17 pgdb systemd[1]: Starting PostgreSQL 16 database server...
Mar 19 16:21:17 pgdb postgres[1062]: 2025-03-19 16:21:17.178 CST [1062] LOG: starting PostgreSQL 16.1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.4.1 20200928 (Re
Mar 19 16:21:17 pgdb postgres[1062]: 2025-03-19 16:21:17.179 CST [1062] LOG: listening on IPv6 address ::1, port 5436
Mar 19 16:21:17 pgdb postgres[1062]: 2025-03-19 16:21:17.179 CST [1062] LOG: listening on IPv4 address 127.0.0.1, port 5436
Mar 19 16:21:17 pgdb postgres[1062]: 2025-03-19 16:21:17.180 CST [1062] LOG: listening on Unix socket /tmp/.s.PGSQL.5436
Mar 19 16:21:17 pgdb postgres[1062]: 2025-03-19 16:21:17.184 CST [1069] LOG: database system was shut down at 2025-03-19 16:19:41 CST
Mar 19 16:21:17 pgdb postgres[1062]: 2025-03-19 16:21:17.187 CST [1062] LOG: database system is ready to accept connections2.6 编辑环境变量
#PG 16
######
export PGPORT5436
export PGDATA/pgdata/data/pg16
export PGHOME/pgsql/app/pg163. 安装后配置
3.1 修改默认用户postgres密码
postgres# alter user postgres with password postgres;
ALTER ROLE3.2 连接配置文件
postgresql.conf参数 监听所有地址IP
[postgrespgdb pg16]$ cd $PGDATA
[postgrespgdb pg16]$ vi postgresql.conf
#listen_addresses localhost # what IP address(es) to listen on; #重启生效
listen_addresses *pg_hba.conf参数 实例访问控制
[postgrespgdb pg16]$ cd $PGDATA
[postgrespgdb pg16]$ vi pg_hba.conf
# IPv4 local connections:
#host all all 127.0.0.1/32 trust #重加载配置生效
# 允许192.168.1.0网段连接数据库
host all all 192.168.1.0/24 scram-sha-256重启数据库
[postgrespgdb ~]$ pg_ctl restart远程连接数据库
[postgrespgdb ~]$ psql -h 192.168.1.109 -p 5436 -U postgres -d postgres3.3 数据库启动关闭
[postgrespgdb ~]$ pg_ctl status
pg_ctl: server is running (PID: 1063)
/pgsql/app/pg16/bin/postgres -D /pgdata/data/pg16/
[postgrespgdb ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
[postgrespgdb ~]$ pg_ctl start
waiting for server to start....2025-03-21 22:24:33.069 CST [1335] LOG: redirecting log output to logging collector process
2025-03-21 22:24:33.069 CST [1335] HINT: Future log output will appear in directory log.done
server started
[postgrespgdb ~]$ pg_ctl status
pg_ctl: server is running (PID: 1335)
/pgsql/app/pg16/bin/postgres
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/82487.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!