栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

安装PostgresSQL

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

安装PostgresSQL

1.下载源码包

PostgreSQL: File Browserhttps://www.postgresql.org/ftp/source/

2.创建用户
groupadd postgres
useradd -d /home/postgres -m postgres -g postgres
passwd postgres
3.设置环境变量

vim .bash_profile,添加下面内容,同时还需要创建相对应的目录

export PGHOME=/home/postgres/postgresql-14.0
export PGDATA=/home/postgres/postgres_data
export PATH=$PGHOME/bin:$PATH
export LANG=en_US.utf8
export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH
4.编译源码包
cd ~/soft/
tar zxf postgresql-14.0.tar.gz
cd postgresql-14.0
./configure --prefix=/home/postgres/postgresql-14.0 --without-readline
make && make install
5.初始化DB
initdb -D /home/postgres/postgres_data -E UTF8 -U postgres
6.修改参数文件

vim /home/postgres/postgres_data/postgresql.conf,按需修改,这里我修改的有:

listen_addresses = 'xxx'
port = 8432
unix_socket_directories = '/home/postgres/postgres_data'
logging_collector = on
log_directory = '/home/postgres/postgres_log'
log_filename = 'postgresql-%Y-%m-%d.log'

vim /home/postgres/postgres_data/pg_hba.conf,这里主要控制登录,这里我修改的有:

# IPv4 local connections:
#host all all 127.0.0.1/32 trust
host all all 0.0.0.0/0 password
7.启动PostgresSQL
pg_ctl -D /home/postgres/postgres_data -l /home/postgres/postgres_data/postgres_server.log start
8.登录并创建role
psql --host=/home/postgres/postgres_data/ -p 8432
create user odoo with password 'odoo';

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/510451.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号