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

相关内容

热门资讯

终于了解“九九麻将.辅助器?”... 您好:九九麻将这款游戏可以开挂,确实是有挂的,需要了解加客服微信【4282891】很多玩家在这款游戏...
【第一消息】“美味冰淇淋.怎么... 家人们!今天小编来为大家解答美味冰淇淋透视挂怎么安装这个问题咨询软件客服徽9752949的挂在哪里买...
今日重大通报“同城游比鸡.究竟... 家人们!今天小编来为大家解答同城游比鸡透视挂怎么安装这个问题咨询软件客服徽9784099的挂在哪里买...
玩家最新攻略“乐享牛牛.有挂吗... 玩家最新攻略“乐享牛牛.有挂吗?”详细开挂教程您好,乐享牛牛这个游戏其实有挂的,确实是有挂的,需要了...
最新引进“神皇大厅.开挂神器?... 有 亲,根据资深记者爆料神皇大厅是可以开挂的,确实有挂(咨询软件无需打开...
【第一财经】“新九方炸金花.到... 【第一财经】“新九方炸金花.到底是不是挂?”原来真的有挂您好,新九方炸金花这个游戏其实有挂的,确实是...
重磅消息“天下棋牌.究竟有挂吗... 网上科普关于“天下棋牌有没有挂”话题很是火热,小编也是针对天下棋牌作*弊开挂的方法以及开挂对应的知识...
今日重大发现“青松游戏.真的有... 您好:青松游戏这款游戏可以开挂,确实是有挂的,需要了解加客服微信【4282891】很多玩家在这款游戏...
以军称打死哈马斯高级指挥官,哈... 巴勒斯坦伊斯兰抵抗运动(哈马斯)当地时间13日发表声明称,以色列战机当天在加沙城以西袭击一辆民用车辆...
今日重磅消息“杭麻圈.到底是不... 网上科普关于“杭麻圈有没有挂”话题很是火热,小编也是针对杭麻圈作*弊开挂的方法以及开挂对应的知识点,...