PostgreSQL for Linux 安装方式
admin
2023-01-27 04:49:57
0

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

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

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

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

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

6)启动数据库

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

7)停止数据库

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

相关内容

热门资讯

美国“痛失”杨植麟,这是历史性... 杨植麟的月之暗面创造了Kimi K3,轰动整个世界。他是近年来第一个放弃了美国机会、回中国创业,并且...
铭显光电取得LED显示屏加工夹... 国家知识产权局信息显示,上海铭显光电科技有限公司取得一项名为“一种LED显示屏加工夹具”的专利,授权...
大盘承压依旧登顶,vivo拿下... 7月22日消息,市场调研机构Omdia发布2026年第二季度印度智能市场报告,数据显示本季度印度手机...
白宫发布《科学:新的黄金时代》... 据白宫7月21日消息,白宫科技政策办公室、管理与预算办公室联合发布《科学:新的黄金时代》报告。本次备...
民营商业火箭首次从长三角东海海... 北京时间7月22日10时54分,我国太原卫星发射中心在上海东部海域使用引力一号遥四运载火箭,将搭载的...
美威胁袭伊基础设施,伊朗军方:... △当地时间21日,船只在霍尔木兹海峡航行伊朗武装部队哈塔姆安比亚中央总部当地时间22日发布声明称,美...
扑翼机器人问世:像潜水鸟一样在... 潜鸟、海鸥、海鹦和海燕,是自然界中约100种既能飞行又能游泳的鸟类。这些潜水鸟能够俯冲入水追逐猎物,...
当科学家走进西部脑谷:这里有望... 7月22日,2026天府科学家创新发展大会暨成都科产融合对接活动锦江经开区脑机接口专场在锦江区成功举...
女子身份证丢失后名下出现“吸毒... 四川籍的庞女士定居浙江宁波多年,她怎么也没想到,因丢失身份证一事,竟让她陷入长达7年“自证清白”的困...
省农科院成功研发我省首个高粱全... 近日,记者从省农科院获悉,该院作物资源研究所、农业生物技术研究所联合石家庄博瑞迪生物,成功研制出省内...