当前位置:网站首页>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=#
边栏推荐
- Huawei's "genius boy" Zhihui Jun has made a new work, creating a "customized" smart keyboard from scratch
- ShardingSphere之水平分库实战(四)
- typescript16-void
- JS逆向之浏览器补环境(一)
- MySql data recovery method personal summary
- Niuke.com question brushing training (4)
- "Real" emotions dictionary based on the text sentiment analysis and LDA theme analysis
- ShardingSphere之读写分离(八)
- 【952. 按公因数计算最大组件大小】
- 4G通信模块CAT1和CAT4的区别
猜你喜欢
Thesis understanding: "Designing and training of a dual CNN for image denoising"
ShardingSphere之公共表实战(七)
MySQL master-slave replication and read-write separation script - pro test available
"Real" emotions dictionary based on the text sentiment analysis and LDA theme analysis
小黑leetcode之旅:104. 二叉树的最大深度
Typescript18 - object type
Mysql systemized JOIN operation example analysis
Mini Program - Global Data Sharing
The client series of the DOM series
TypeScript在使用中出现的问题记录
随机推荐
一万了解 Gateway 知识点
JS逆向之浏览器补环境(一)
SereTOD2022 Track2 Code Analysis - Task-based Dialogue Systems Challenge for Semi-Supervised and Reinforcement Learning
小黑leetcode之旅:104. 二叉树的最大深度
小程序-全局数据共享
TiDB 在长银五八消费金融核心系统适配经验分享
DOM系列之 client 系列
Sping.事务的传播特性
Consistency and Consensus of Distributed Systems (1) - Overview
Xiaohei's leetcode journey: 117. Fill the next right node pointer of each node II
Error ER_NOT_SUPPORTED_AUTH_MODE Client does not support authentication protocol requested by serv
MySQL——数据库的查,增,删
【Yugong Series】July 2022 Go Teaching Course 013-Constants, Pointers
Rocky/GNU之Zabbix部署(1)
《实战》基于电商领域的词性提取及其决策树模型建模
Error occurred while trying to proxy request The project suddenly can't get up
ShardingSphere之公共表实战(七)
Can deep learning solve the parameters of a specific function?
[Yugong Series] July 2022 Go Teaching Course 015-Assignment Operators and Relational Operators of Operators
解析云原生消息流系统 Apache Pulsar 能力及场景