码迷,mamicode.com
首页 > 数据库 > 详细

CentOS7.6上安装postgreSQL

时间:2020-04-05 09:46:51      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:png   x86_64   stat   start   org   装包   var   mct   --   

摘要:

1、下载

https://www.postgresql.org/

 

 

 技术图片

技术图片

 

 

  技术图片

 

 

 技术图片

 

 

 技术图片

 

 

 技术图片

 

 

 技术图片

 

上传安装包到服务器(rz工具)

[root@centos7-6 ~]# mkdir /pg-rpm
[root@centos7-6 ~]# rz
rz waiting to receive.
Starting zmodem transfer.  Press Ctrl+C to cancel.
Transferring postgresql12-12.2-1PGDG.rhel7.x86_64.rpm...
  100%    2773 KB    2773 KB/sec    00:00:01       0 Errors  
Transferring postgresql12-libs-12.2-1PGDG.rhel7.x86_64.rpm...
  100%     758 KB     758 KB/sec    00:00:01       0 Errors  
Transferring postgresql12-server-12.2-1PGDG.rhel7.x86_64.rpm...
  100%   13275 KB    13275 KB/sec    00:00:01       0 Errors 
[root@centos7-6 ~]# cd /pg-rpm/
[root@centos7-6 pg-rpm]# ll -h
total 17M
-rw-r--r--. 1 root root 2.8M Apr  5 00:33 postgresql12-12.2-1PGDG.rhel7.x86_64.rpm
-rw-r--r--. 1 root root 759K Apr  5 00:36 postgresql12-libs-12.2-1PGDG.rhel7.x86_64.rpm
-rw-r--r--. 1 root root  13M Apr  5 00:41 postgresql12-server-12.2-1PGDG.rhel7.x86_64.rpm
[root@centos7-6 pg-rpm]# 

安装

[root@centos7-6 pg-rpm]# rpm -ivh postgresql12-libs-12.2-1PGDG.rhel7.x86_64.rpm
[root@centos7-6 pg-rpm]# rpm -ivh postgresql12-12.2-1PGDG.rhel7.x86_64.rpm 
[root@centos7-6 pg-rpm]# rpm -ivh postgresql12-server-12.2-1PGDG.rhel7.x86_64.rpm

初始化数据库并设置自启动

/usr/pgsql-12/bin/postgresql-12-setup initdb 
systemctl enable postgresql-12
systemctl start postgresql-12
systemctl status postgresql-12

也可以使用PG自带的工具pg_ctl

配置环境变量

-bash-4.2$ pwd
/var/lib/pgsql
-bash-4.2$ 
-bash-4.2$ vi .bash_profile
#追加内容 export PATH
=$PATH:/usr/pgsql-12/bin
-bash-4.2$ source .bash_profile

 

[root@centos7-6 ~]# su - postgres
-bash-4.2$ pg_ctl stop
-bash-4.2$ pg_ctl start
-bash-4.2$ pg_ctl status

 

CentOS7.6上安装postgreSQL

标签:png   x86_64   stat   start   org   装包   var   mct   --   

原文地址:https://www.cnblogs.com/connected/p/12635653.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!