2021-07-15

1.添加用户

# 添加用户 postgres
useradd postgres # 给用户 postgres 设置密码
passwd postgres

2.切换到该用户,下载 postgresql

# 切换到用户 postgres
su - postgres # 下载
wget 下载网址

3.解压

tar -zxf 压缩包 -C 目标文件夹

------------------------------------
-v 参数可以展示解压过程
------------------------------------

4.安装依赖包

yum install readline readline-devel gzip zlib zlib-devel gcc

5.配置

# 指定应用安装目录
cd postgresql 解压目录

# 切换用户权限到 root
su

# 配置
./configure --prefix=自定义安装目录

------------------------------------
注意:该命令要进入解压的目录,在 root 用户权限下执行

#  编译(稍等几分钟)
make

依旧在 root 权限下

# 将编译成功的可执行文件安装到系统目录中,一般为 /usr/local/bin 目录。
make install

以上命令执行成功后,自定义 postgresql 安装目录下出现以下内容

6.修改用户配置文件

vi  ~/.bash_profile  

添加如下内容
-------------------------------------------
# postgresq1
export PGSQL_HOME=安装目录
export PGDATA=$PGSQL_HOME/data
export PATH=$PGSQL_HOME/bin:$PGDATA:$PATH
-------------------------------------------

7.生效配置文件

source ~/.bash_profile

8.初始化
( root 用户下赋权限 chown -R postgres:postgres 安装文件夹)

cd 安装目录

mkdir data

$PGSQL_HOME/bin/initdb -D $PGSQL_HOME/data

# 也可以在安装目录下使用以下命令,一样的作用
bin/initdb -D $PGDATA

9.启动

cd 安装目录/bin

# 该命令是启动 postgresql 并将启动日志输出到 server.log ,该文件名可以自行修改
pg_ctl -l server.log start

bin/postgres -D $PGSQL_HOME/data -p 5432 > postgres.log 2>&1

10.进入

psql -U postgres -h 虚拟机ip地址

注意: 如果报错 Error while loading shared libraries: libpq.so.5: cannot open shared object file
    未安装依赖 yum install postgresql-libs.x86_64

centos7 postgresql安装配置的更多相关文章

  1. Linux下apache+phppgadmin+postgresql安装配置

    Linux下apache+phppgadmin+postgresql安装配置 操作系统:CentOS 安装包:httpd(首选yum), php(包括php以及php-pgsql,php-mbstri ...

  2. CentOS7 PostgreSQL安装

    CentOS7 PostgreSQL安装 CentOS7 PostgreSQL安装 Install 安装 使用yum安装 yum install http://yum.postgresql.org/9 ...

  3. Centos7下安装配置Redsocks

    Redsocks是一个开源的网络程序,代码依赖开源的libevent网络库.Redsocks允许你将所有TCP连接重定向到SOCKS或HTTPS代理,比如Shadowsocks(Centos7下安装配 ...

  4. centos7 yum安装配置redis 并设置密码

    原文:https://www.cnblogs.com/fanlinglong/p/6635828.html centos7 yum安装配置redis 并设置密码 1.设置Redis的仓库地址 yum ...

  5. Windows上PostgreSQL安装配置教程

    Windows上PostgreSQL安装配置教程 这篇文章主要为大家详细介绍了Windows上PostgreSQL安装配置教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 PostgreSQL的 ...

  6. centos7 rabbitmq安装/配置

    原文:centos7 rabbitmq安装/配置     因为RabbitMQ是由erlang实现的,所以要先安装erlang再安装rabbitMQ   1.先配置yum软件源地址EPEL(EPEL是 ...

  7. Centos7 下安装配置tomcat7

    首先下载压缩包 wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.78/bin/apache-tomcat-7. ...

  8. ubuntu 16.04.1 LTS postgresql安装配置

    postgresql安装--------------------二进制安装:wget https://get.enterprisedb.com/postgresql/postgresql-9.5.6- ...

  9. centos7 docker 安装配置

    docker快速入门测试 ########################################## #docker安装配置 #环境centos7 #配置docker阿里源 echo '#D ...

随机推荐

  1. python序列化proto时对repeated修饰数据进行赋值(常用类型和其他类型)

    说一下对proto文件中数据使用时的书写方法,因为笔者也经常弄混淆 一.repeated修饰符,该列表是常用类型,比如int message C2GS_GoodsList { repeated int ...

  2. C#曲线分析平台的制作(二,echarts前后台数据显示)

    在上一篇博客中,学习了使用javascript和jquery两种方法来进行前后台交互.本篇博客着重利用jquery+echarts来实现从后台取数,从前端echarts中展示. 1.html页面编写: ...

  3. Aapache Tomcat AJP 文件包含漏洞(CVE-2020-1938)

    受影响版本 Apache Tomcat 6 Apache Tomcat 7 < 7.0.100 Apache Tomcat 8 < 8.5.51 Apache Tomcat 9 < ...

  4. JBoss JMXInvokerServlet 反序列化漏洞

    poc地址:https://cdn.vulhub.org/deserialization/DeserializeExploit.jar

  5. 🔥 LeetCode 热题 HOT 100(41-50)

    102. 二叉树的层序遍历 思路:使用队列. /** * Definition for a binary tree node. * public class TreeNode { * int val; ...

  6. 论文笔记:(TOG2019)DGCNN : Dynamic Graph CNN for Learning on Point Clouds

    目录 摘要 一.引言 二.相关工作 三.我们的方法 3.1 边缘卷积Edge Convolution 3.2动态图更新 3.3 性质 3.4 与现有方法比较 四.评估 4.1 分类 4.2 模型复杂度 ...

  7. centos7 安装mariadb、"systemctl status mariadb.service" and "journalctl -xe" for details

    centos7 mariadb 安装 也可解决此错误:ob for mariadb.service failed because the control process exited with err ...

  8. 2020年!最全Android大厂面试真题合集(附答案)

    这份Android面试真题涵盖了图片,网络和安全机制,网络,数据库,插件化.模块化.组件化.热修复.增量更新.Gradle,架构设计和设计模式,Android Framework .Android优秀 ...

  9. 批量删除gmail邮件

    以删除tor.com发送的邮件为例说明. 首先点击邮件搜索框右边的三角,在"发件人"下面写上"tor.com": 点"搜索"按钮,看一下范围 ...

  10. WPF自定义控件一:StackPanel 控件轮播

    实现效果 带定时器的轮播图 using引用 using System.Windows; using System.Windows.Controls; using System.Windows.Mark ...