营销型网站建设概述/女性广告

营销型网站建设概述,女性广告,宣传片拍摄手法和镜头,网站怎么做cp备案号PostgreSQL 数据库源码编译安装全流程详解 Linux 8 1. 基础环境配置1.1 修改主机名1.2 配置操作系统yum源1.3 安装操作系统依赖包1.4 禁用SELINUX配置1.5 关闭操作系统防火墙1.6 创建用户和组1.7 建立安装目录1.8 编辑环境变量 2. 源码方式安装(PG 16)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 16)
    • 2.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
EOF

1.2 配置操作系统yum源

创建挂载目录
mkdir /mnt/iso
编辑yum源配置文件
cat > /etc/yum.repos.d/yum.repo<<EOF
[sourceOS]
name=yumserverOS
baseurl=file:///mnt/iso/BaseOS
gpgcheck=0
enabled=1[sourceAPP]
name=yumserverApp
baseurl=file:///mnt/iso/AppStream
gpgcheck=0
enabled=1
EOF
检查yum源
yum clean all
yum makecache
yum repolist

1.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/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config 
cat /etc/selinux/config
getenforcePermissive   –输出(表示临时关闭)
Disabled     –重启服务器后输出

1.5 关闭操作系统防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service

1.6 创建用户和组

# 创建pg用户和组
groupadd -g 2000 postgres
useradd -g postgres -u 2000 postgres
echo "postgres123" | passwd --stdin postgres# 验证创建成功
id postgres

1.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 /pgdata

1.8 编辑环境变量

# 编辑环境变量
vi /home/postgres/.bash_profile
export PGPORT=5432
export PGDATA=/pgdata/data/pg16
export PGHOME=/pgsql/app/pg16
export LANG=en_US.utf8
export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export DATE=`date +"%Y%m%d%H%M"`
export PATH=$PGHOME/bin:$PATH:.
export MANPATH=$PGHOME/share/man:$MANPATH
export PGUSER=postgres
export PGDATABASE=postgres

2. 源码方式安装(PG 16)

2.1 下载源码安装包

官方下载地址:
https://www.postgresql.org/ftp/source/

[root@pgdb soft]# ll
total 31676
-rwxr-xr-x 1 root root 32433767 Mar 19 14:23 postgresql-16.1.tar.gz

2.2 编译安装源码包

# 解压源码包
[root@pgdb soft]# tar -xvf postgresql-16.1.tar.gz
[root@pgdb soft]# cd postgresql-16.1
# 配置编译选项 可以自定义端口号 默认5432
[root@pgdb postgresql-16.1]# ./configure --prefix=/pgsql/app/pg16 --with-pgport=5436
# 编译源代码
[root@pgdb postgresql-16.1]# make
# 编译安装
[root@pgdb postgresql-16.1]# make install

2.3 初始化数据库

[postgres@pgdb ~]$  /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 start

2.4 启动数据库

[postgres@pgdb ~]$ pg_ctl -D /pgdata/data/pg16 -l logfile start
waiting for server to start.... done
server started

2.5 开机自启动

  • 添加配置文件 参考PG16 RPM安装时配置文件
  • Environment=PGDATA=/pgdata/data/pg16/
  • ExecStart=/pgsql/app/pg16/bin/postgres -D ${PGDATA}

vi /usr/lib/systemd/system/postgresql-16.service
# It's 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
# unit's 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]
Description=PostgreSQL 16 database server
Documentation=https://www.postgresql.org/docs/16/static/
After=syslog.target
After=network-online.target[Service]
Type=notifyUser=postgres
Group=postgres# Note: avoid inserting whitespace in these Environment= lines, or you may
# break postgresql-setup.# Location of database directory
#Environment=PGDATA=/var/lib/pgsql/16/data/
Environment=PGDATA=/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
# StandardOutput=syslog# Disable OOM kill on postgres main process
OOMScoreAdjust=-1000
Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
Environment=PG_OOM_ADJUST_VALUE=0#ExecStartPre=/usr/pgsql-16/bin/postgresql-16-check-db-dir ${PGDATA}
ExecStart=/pgsql/app/pg16/bin/postgres -D ${PGDATA}
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT# Do not set any timeout value, so that systemd will not kill postgres 
# main process during crash recovery.
TimeoutSec=0# 0 is the same as infinity, but "infinity" needs systemd 229
TimeoutStartSec=0TimeoutStopSec=1h[Install]
WantedBy=multi-user.target
  • 重新加载配置文件 systemctl start postgresql-16.service 不会结束命令,systemctl status postgresql-16.service Active: activating (start)显示状态非running
# reload配置文件
[root@pgdb ~]# systemctl daemon-reload
# 启动数据库
[root@pgdb ~]# systemctl start postgresql-16.service
# 开机自启动
[root@pgdb ~]# 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 资源状态
[root@pgdb ~]# 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 connections

2.6 编辑环境变量

#PG 16
######
export PGPORT=5436
export PGDATA=/pgdata/data/pg16
export PGHOME=/pgsql/app/pg16

3. 安装后配置

3.1 修改默认用户postgres密码

postgres=# alter user postgres with password 'postgres';
ALTER ROLE

3.2 连接配置文件

  • postgresql.conf参数 监听所有地址IP
[postgres@pgdb pg16]$ cd $PGDATA
[postgres@pgdb pg16]$ vi postgresql.conf
#listen_addresses = 'localhost'         # what IP address(es) to listen on;  #重启生效
listen_addresses = '*'
  • pg_hba.conf参数 实例访问控制
[postgres@pgdb pg16]$ cd $PGDATA
[postgres@pgdb 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
  • 重启数据库
[postgres@pgdb ~]$ pg_ctl restart
  • 远程连接数据库
[postgres@pgdb ~]$ psql -h 192.168.1.109 -p 5436 -U postgres -d postgres

3.3 数据库启动关闭

[postgres@pgdb ~]$ pg_ctl status
pg_ctl: server is running (PID: 1063)
/pgsql/app/pg16/bin/postgres "-D" "/pgdata/data/pg16/"
[postgres@pgdb ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
[postgres@pgdb ~]$ 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
[postgres@pgdb ~]$ pg_ctl status
pg_ctl: server is running (PID: 1335)
/pgsql/app/pg16/bin/postgres

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/899085.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

(基本常识)C++中const与引用——面试常问

作者&#xff1a;求一个demo 版权声明&#xff1a;著作权归作者所有&#xff0c;商业转载请联系作者获得授权&#xff0c;非商业转载请注明出处 内容通俗易懂&#xff0c;没有废话&#xff0c;文章最后是面试常问内容&#xff08;建议通过标题目录学习&#xff09; 废话不多…

案例:使用网络命名空间模拟多主机并通过网桥访问外部网络

案例目标 隔离性&#xff1a;在同一台物理机上创建两个独立的网络命名空间&#xff08;模拟两台主机&#xff09;&#xff0c;确保其网络配置完全隔离。内部通信&#xff1a;允许两个命名空间通过虚拟设备直接通信。外部访问&#xff1a;通过宿主机的网桥和 NAT 规则&#xff…

DeepSeek面试——模型架构和主要创新点

本文将介绍DeepSeek的模型架构多头潜在注意力&#xff08;MLA&#xff09;技术&#xff0c;混合专家&#xff08;MoE&#xff09;架构&#xff0c; 无辅助损失负载均衡技术&#xff0c;多Token 预测&#xff08;MTP&#xff09;策略。 一、模型架构 DeepSeek-R1的基本架构沿用…

husky的简介以及如果想要放飞自我的解决方案

husky 是一个 Git Hooks 管理工具&#xff0c;它的主要作用是 在 Git 提交&#xff08;commit&#xff09;、推送&#xff08;push&#xff09;等操作时执行自定义脚本&#xff0c;比如代码检查&#xff08;Lint&#xff09;、单元测试&#xff08;Test&#xff09;、格式化代码…

【动手学深度学习】#4 深度学习计算

主要参考学习资料&#xff1a; 《动手学深度学习》阿斯顿张 等 著 【动手学深度学习 PyTorch版】哔哩哔哩跟李牧学AI 概述 为了实现更复杂的网络&#xff0c;我们需要研究比层更高一级的单元块&#xff0c;在编程中由类表示。通过自定义层和块&#xff0c;我们能更灵活地搭建网…

如何在 Windows 上安装并使用 Postman?

Postman 是一个功能强大的API测试工具&#xff0c;它可以帮助程序员更轻松地测试和调试 API。在本文中&#xff0c;我们将讨论如何在 Windows 上安装和使用 Postman。 Windows 如何安装和使用 Postman 教程&#xff1f;

26考研——图_图的基本概念(6)

408答疑 文章目录 一、图的基本概念图的定义非空性非线性结构 顶点和边的表示顶点边 有向图 & 无向图有向图有向图 G 1 G_1 G1​ 的表示 无向图无向图 G 2 G_2 G2​ 的表示 简单图 & 多重图简单图多重图 顶点的度、入度和出度顶点的度有向图的度 路径、路径长度和回路…

面向对象软件工程实践软件案例

智力运动-数字化思维训练课程介绍 数字化思维训练是科技赋能素质教育创新实践项目&#xff0c;通过数字化信息化手段&#xff0c;深度融合优质原创智力运动教育课程资源&#xff0c;服务幼儿园与小学&#xff0c;提供信息时代校园素质教育教学解决方案。在《面向对象软件工程》…

Linux学习笔记(应用篇一)

基于I.MX6ULL.MINI开发板 标准I/O库链接目录删除文件正则表达式系统标识时间堆内存信号标准信号 进程进程组进程间通信线程互斥锁线程安全 本文章是入门篇的概念&#xff0c;有点零散&#xff0c;后续需要补充复习 **inode&#xff08;索引节点&#xff09;**是 Linux 和 Unix …

医学交互作用分析步骤和目的(R语言)

医学交互作用分析的目的和用途&#xff08;R语言&#xff09; 医学交互作用分析一直是医学数据分析的组成部分&#xff0c;总结最近的一些认识。 目的&#xff1a; 在独立危险因素鉴定的研究中&#xff0c;&#xff08;独立危险因素的&#xff09;交互作用可以作为独立危险因…

Javaweb后端登录会话技术jwt令牌

jwt生成与校验 是base4补位的 最后面是签名&#xff0c;签名不是base64&#xff0c;是通过签名算法加密后来的 令牌长度不是固定的&#xff0c;长度取决于原始内容&#xff0c;载荷&#xff0c;大小 头有&#xff0c;类型&#xff0c;签名算法 base64可以对任意的二进制数据进…

Mybatis操作数据库(注解+xml两个方式)

文章目录 1.个人回顾2.关于mybatis注解的说明3.字段和属性不匹配的解决方案3.1第一个方案3.2第二个方案3.3第三个方案 4.xml路径配置5.xml里面的字段映射 1.个人回顾 刚刚翻看了一下自己的这个之前写的博客&#xff0c;上一次和这个javaee相关的博客还是去年写的&#xff0c;也…

SysVinit和Systemd的系统运行级别

Linux运行级别 SysVinit系统(init守护进程)Linux系统运行级别SysVinit系统(init守护进程)查看Linux运行级别SysVinit系统(init守护进程)修改运行级别&#xff1a; Systemd守护进程Linux系统运行级别systemd查看运行级别Systemd查看系统当前运行级别 systemd修改运行级别multi-u…

vscode终端不识别npm 无法解析npm

vscode 用以管理员打开识别npm vscode 用普通用户打开不识别npm 刚换了一台新电脑&#xff0c;寻思安装各种环境&#xff0c;一顿操作猛如虎&#xff0c;当最后一个打开vscode后&#xff0c;运行项目发现&#xff0c;新建终端>npm run dev 无法识别。 在cmd 中 打node -…

如何理解 Apache Iceberg 与湖仓一体(Lakehouse)?

一、什么是湖仓一体&#xff08;Lakehouse&#xff09;&#xff1f; 湖仓一体是一种融合了数据湖的灵活存储能力与数据仓库的高效分析功能的现代数据架构。它通过整合两者的优势&#xff0c;解决了传统架构的局限性&#xff0c;为企业数据处理提供了更全面的解决方案。 数据湖…

【鸿蒙开发】Hi3861学习笔记- TCP客户端

00. 目录 文章目录 00. 目录01. TCP概述02. TCP应用场景03. TCP和UDP比较04. TCP相关API05. TCP编程流程06. 硬件设计07. 软件设计08. 实验现象09. 附录 01. TCP概述 TCP&#xff08;Transmission Control Protocol&#xff09;是一种面向连接、可靠的传输层协议&#xff0c;旨…

2025-03-25 学习记录--C/C++-PTA 习题9-3 平面向量加法

合抱之木&#xff0c;生于毫末&#xff1b;九层之台&#xff0c;起于累土&#xff1b;千里之行&#xff0c;始于足下。&#x1f4aa;&#x1f3fb; 一、题目描述 ⭐️ 习题9-3 平面向量加法 本题要求编写程序&#xff0c;计算两个二维平面向量的和向量。 输入格式: ❀ 输入在…

23种设计模式-桥接(Bridge)设计模式

桥接设计模式 &#x1f6a9;什么是桥接设计模式&#xff1f;&#x1f6a9;桥接设计模式的特点&#x1f6a9;桥接设计模式的结构&#x1f6a9;桥接设计模式的优缺点&#x1f6a9;桥接设计模式的Java实现&#x1f6a9;代码总结&#x1f6a9;总结 &#x1f6a9;什么是桥接设计模式…

go:前后端分离

1.前端代码 新建一个前端文件夹&#xff0c;在该文件夹下新建一个.html文件&#xff0c;写入自己的html代码。 前端搞定。 2.后端代码 其核心是挂载路由接受前端传来的数据核心代码如下&#xff1a; func main() { // 服务运行提示 fmt.Println("go web server is runn…

JetsonNano —— 4、Windows下对JetsonNano板卡烧录刷机Ubuntu20.04版本(官方教程)

介绍 NVIDIA Jetson Nano™ 开发者套件是一款面向创客、学习者和开发人员的小型 AI 计算机。按照这个简短的指南&#xff0c;你就可以开始构建实用的 AI 应用程序、酷炫的 AI 机器人等了。 烧录刷机 1、下载 Jetson Nano开发者套件SD卡映像 解压出.img文件并记下它在计算机上的…