当前位置:网站首页>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=# 边栏推荐
- Basic Parameters of RF Devices 1
- typescript10-commonly used basic types
- 87. 把字符串转换成整数
- 使用docker安装mysql
- ShardingSphere之水平分库实战(四)
- WEB Security Basics - - - Vulnerability Scanner
- DOM系列之scroll系列
- Bert usage and word prediction based on Keras_bert model
- ShardingSphere's unsharded table configuration combat (6)
- Artificial Intelligence and Cloud Security
猜你喜欢
随机推荐
华为“天才少年”稚晖君又出新作,从零开始造“客制化”智能键盘
typescript16-void
35. Reverse linked list
The sword refers to offer17---print the n digits from 1 to the largest
BOM系列之Navigator对象
typescript10-commonly used basic types
VS warning LNK4099:未找到 PDB 的解决方案
不用Swagger,那我用啥?
"Real" emotions dictionary based on the text sentiment analysis and LDA theme analysis
typescript10-常用基础类型
DOM系列之 client 系列
ShardingSphere read-write separation (8)
DOM系列之scroll系列
Problem record in the use of TypeScript
Rocky/GNU之Zabbix部署(3)
Installation problem corresponding to tensorflow and GPU version
Sping.事务的传播特性
小程序-全局数据共享
SWM32 Series Tutorial 6 - Systick and PWM
孩子的编程启蒙好伙伴,自己动手打造小世界,长毛象教育AI百变编程积木套件上手









