当前位置:网站首页>Centos 7.9安装PostgreSQL14.4步骤
Centos 7.9安装PostgreSQL14.4步骤
2022-07-31 01:03:00 【auspicious航】
PostgreSQL安装步骤
(1)环境说明
系统:Centos 7.9
软件:PostgreSQL 14.4
(2)软件下载
https://www.postgresql.org/ftp/source/v14.4/postgresql-14.4.tar.gz
(3)解压数据库安装包
tar -zxvf postgresql-14.4.tar.gz
(4)编译
cd postgresql-14.4/
./configure --prefix=/usr/local/postgresql
(5)安装
make && make install
(6)创建目录 data、log
mkdir /usr/local/postgresql/data
mkdir /usr/local/postgresql/log
(7)增加用户 postgres 并赋权
useradd postgres
chown -R postgres.postgres /usr/local/postgresql
(8)修改postgres用户的系统环境变量
su - postgres
vi .bash_postgres
在最后写入如下内容
export PGHOME=/usr/local/postgresql
export PGDATA=/usr/local/postgresql/data
export PGLIB=/usr/local/postgresql/lib
export PATH=$PATH:$HOME/bin:$PGHOME/bin
export LC_ALL=en_US.UTF8
export LANG=en_US.UTF8
使配置文件生效
. .bash_profile
(9)初始化数据库
su postgres
/usr/local/postgresql/bin/initdb -D /usr/local/postgresql/data/
(10)修改配置文件
vim /usr/local/postgresql/data/pg_hba.conf
在文件最后增加一行
host all all 0.0.0.0/0 trust
说明:
TYPE:pg的连接方式,local:本地unix套接字,host:tcp/ip连接
DATABASE:指定数据库
USER:指定数据库用户
ADDRESS:ip地址,可以定义某台主机或某个网段,32代表检查整个ip地址,相当于固定的ip,24代表只检查前三位,最后一 位是0~255之间的任何一个
METHOD:认证方式,常用的有ident,md5,password,trust,reject。
md5是常用的密码认证方式。
password是以明文密码传送给数据库,建议不要在生产环境中使用。
trust是只要知道数据库用户名就能登录,建议不要在生产环境中使用。
reject是拒绝认证。
(11)启动服务
pg_ctl start -l /usr/local/postgresql/log/pg_server.log
(12)登录数据库
psql -U postgres -d postgres
psql (14.4)
Type "help" for help.
postgres=#
边栏推荐
- "Real" emotions dictionary based on the text sentiment analysis and LDA theme analysis
- 分布式.分布式锁
- Rocky/GNU之Zabbix部署(3)
- Basic Parameters of RF Devices 2
- ShardingSphere's public table combat (7)
- TiDB 操作实践 -- 备份与恢复
- Zabbix干啥用?
- WEB Security Basics - - - Vulnerability Scanner
- Responsive layout vs px/em/rem
- typescript15- (specify both parameter and return value types)
猜你喜欢
华为“天才少年”稚晖君又出新作,从零开始造“客制化”智能键盘
深度学习可以求解特定函数的参数么?
Detailed explanation of 9 common reasons for MySQL index failure
小黑leetcode之旅:117. 填充每个节点的下一个右侧节点指针 II
ShardingSphere之公共表实战(七)
MySQL高级-六索引优化
Go study notes (84) - Go project directory structure
MySQL triggers
typescript10-常用基础类型
ShardingSphere's vertical sub-database sub-table actual combat (5)
随机推荐
Analyze the capabilities and scenarios of the cloud native message flow system Apache Pulsar
《实战》基于电商领域的词性提取及其决策树模型建模
蓝牙mesh系统开发三 Ble Mesh 配网器 Provisioner
无线模块的参数介绍和选型要点
ShardingSphere之垂直分库分表实战(五)
ROS2系列知识(3):环境配置
BOM系列之Navigator对象
DOM系列之动画函数封装
Why use high-defense CDN when financial, government and enterprises are attacked?
TiDB 操作实践 -- 备份与恢复
Redis learning
【Yugong Series】July 2022 Go Teaching Course 019-For Circular Structure
Error ER_NOT_SUPPORTED_AUTH_MODE Client does not support authentication protocol requested by serv
Summary of MySQL database interview questions (2022 latest version)
MySQL Series 1: Account Management and Engine
【Mysql】——索引的深度理解
金融政企被攻击为什么要用高防CDN?
ECCV 2022丨轻量级模型架构火了,力压苹果MobileViT(附代码和论文下载)
typescript15- (specify both parameter and return value types)
华为“天才少年”稚晖君又出新作,从零开始造“客制化”智能键盘