随笔 - 268,  文章 - 5,  评论 - 8,  阅读 - 26万

1、环境规划

目录名称存放位置
Postgres 用户家目录 /home/postgres
软件存放目录 /home/soft
安装目录 /usr/local
数据目录 /home/postgres/data/

2、安装流程 2.1 解压安装 在操作系统安装完成后,按照表格规划目录。 1)安装部署参考文档 下载页: https://www.enterprisedb.com/download-postgresql-binaries 软件包:postgresql-10.7-2-linux-x64-binaries.tar.gz 2)创建 postgre 安装用户

useradd postgres
passwd postgres

1.2.3.

3)创建 postgre 安装目录及数据目录

mkdir -p /home/postgres/data/
chown -R postgres:postgres /home/postgres/data/
chmod -R 775 /home/postgres/data/

1.2.3.4.

4)解压安装

tar -xvf postgresql-10.8-4-linux-x64-binaries.tar -C /home/postgres/
[root@leo postgres]# chmod -R 777 pgsql
[root@leo postgres]# ll
total 12
drwxrwxrwx 9 root root 4096 Apr 10 03:24 pgsql
drwx------ 19 postgres postgres 4096 Apr 15 11:33 pgsql_data

1.2.3.4.5.6.7.

5)初始化数据库

[postgres@leo bin]$cd /home/postgres/pgsql/bin
[postgres@leo bin]$ ./initdb -D /home/postgres/data/
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.UTF-8". 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 /home/postgres/data ... ok creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
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 /home/postgres/data/ -l logfile start

1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.

6)启动数据库

[postgres@leo bin]$ ./pg_ctl -D /home/postgres/data/ -l logfile start 
waiting for server to start.... done
server started

1.2.3.4.

7)停止数据库

./pg_ctl -D /home/postgres/data/ stop

posted on   root-123  阅读(961)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示