在CentOS 7 / RHEL 7安装PostgreSQL 10
CentOS 到了7.x版本, PostgreSQL也来到了10.x版本. 前些天MySQL都直接跨到了8.0版本.
本文是一篇在CentOS 7.4上安装安装PostgreSQL 10.3 的教程. 本文发布于2018-04-28.
1. 切换到root用户:
sudo su
2. 把最新的rpm包添加到系统库:
PostgreSQL会为所有的Linux平台发布rpm包, 而且会比其他的的库更新的更快.可以试试在浏览器输入 https://download.postgresql.org/pub 看会发现什么.
### CentOS 7 ### # rpm -Uvh https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm ### RHEL 7 ### # rpm -Uvh https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm
3. 用 yum 安装PostgreSQL:
# yum install -y postgresql10-server postgresql10
4. 安装完成后, 初次使用前先进行初始化:
# /usr/pgsql-10/bin/postgresql-10-setup initdb
PostgreSQL文件默认放在路径: /var/lib/pgsql/10/data/
5. 启动PostgreSQL:
# systemctl start postgresql-10
6. 设置PostgreSQL自启动:
# systemctl enable postgresql-10
7. 查询PostgreSQL运行状态:
# systemctl status postgresql-10
会输出类似的信息:
● postgresql-10.service - PostgreSQL 10 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-10.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2018-04-27 18:03:08 CST; 21h ago
Docs: https://www.postgresql.org/docs/10/static/
Main PID: 14916 (postmaster)
CGroup: /system.slice/postgresql-10.service
├─14916 /usr/pgsql-10/bin/postmaster -D /var/lib/pgsql/10/data/
├─14920 postgres: logger process
├─14922 postgres: checkpointer process
├─14923 postgres: writer process
├─14924 postgres: wal writer process
├─14925 postgres: autovacuum launcher process
├─14926 postgres: stats collector process
└─14927 postgres: bgworker: logical replication launcher Apr 27 18:03:08 iZbp144wg7yw6hrfyu76anZ systemd[1]: Starting PostgreSQL 10 database server...
Apr 27 18:03:08 iZbp144wg7yw6hrfyu76anZ postmaster[14916]: 2018-04-27 18:03:08.762 CST [14916] LOG: listening on IPv4 address "127.0.0.1...t 5432
Apr 27 18:03:08 iZbp144wg7yw6hrfyu76anZ postmaster[14916]: 2018-04-27 18:03:08.762 CST [14916] LOG: could not bind IPv6 address "::1": C...ddress
Apr 27 18:03:08 iZbp144wg7yw6hrfyu76anZ postmaster[14916]: 2018-04-27 18:03:08.762 CST [14916] HINT: Is another postmaster already runni...retry.
Apr 27 18:03:08 iZbp144wg7yw6hrfyu76anZ postmaster[14916]: 2018-04-27 18:03:08.764 CST [14916] LOG: listening on Unix socket "/var/run/p....5432"
Apr 27 18:03:08 iZbp144wg7yw6hrfyu76anZ postmaster[14916]: 2018-04-27 18:03:08.767 CST [14916] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
Apr 27 18:03:08 iZbp144wg7yw6hrfyu76anZ postmaster[14916]: 2018-04-27 18:03:08.777 CST [14916] LOG: redirecting log output to logging co...rocess
Apr 27 18:03:08 iZbp144wg7yw6hrfyu76anZ postmaster[14916]: 2018-04-27 18:03:08.777 CST [14916] HINT: Future log output will appear in di..."log".
Apr 27 18:03:08 iZbp144wg7yw6hrfyu76anZ systemd[1]: Started PostgreSQL 10 database server.
Hint: Some lines were ellipsized, use -l to show in full.
8. 再确认看看PostgreSQL是否运行在5432端口:
# netstat -antup | grep 5432
会有类似输出:
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 14916/postmaster
9. 连接PostgreSQL服务器:
PostgreSQL会自动创建postgres用户, 创建数据库之前, 要用postgres用户或root用户登录并重置postgres用户密码.
# su -l postgres
10. 连接数据库, psql命令会激活PostgreSQL数据库终端:
$ psql
会输出下列说明连接进入了PostgreSQL数据库:
psql (10.3)
Type "help" for help. postgres=#
11. 重置postgres用户密码:
postgres=# \password
密码:postgresql
在CentOS 7 / RHEL 7安装PostgreSQL 10的更多相关文章
- 在 CentOS 7.2 上安装 ODOO 10 (2018-10-09 持续更新)
在 CentOS 7.2 上安装 ODOO 10 更新系统 yum update 安装 EPEL 源 1 yum install -y epel-release 安装依赖组件 yum install ...
- 在CentOS或RHEL上安装Nux Dextop仓库
介绍 Nux Dextop是类似CentOS.RHEL.ScientificLinux的第三方RPM仓库(比如:Ardour,Shutter等等).目前,Nux Dextop对CentOS/RHEL ...
- centos 6.4下安装postgresql 9.2
我的linux版本是centos 6.4 ,准备安装postgresql 9.2 根据官方说明: http://www.postgresql.org/download/linux/redhat/ 缺省 ...
- CentOS 7.x编译安装Nginx1.10.3+MySQL5.7.16+PHP5.2 5.3 5.4 5.5 5.6 7.0 7.1多版本全能环境
准备篇 一.防火墙配置 CentOS 7.x默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.se ...
- CentOS 7.4 如何安装 MariaDB 10.3.9 Stable 数据库
CentOS 7.4 如何安装 MariaDB 10.3.9 Stable 数据库 一.CentOS 7.4上卸载 Mariadb 数据库 1.查询所安装的MariaDB组件 [libin@VM_0_ ...
- CentOS 7.4 下面安装 jdk 10 的一点总结
CentOS 7.4 下面安装 jdk 10 的一点总结 一.前期工作 1.检验系统原版本 [root@zck ~]# java -version java version "1.7.0_& ...
- Ubuntu下编译安装postgreSQL 10.5
Ubuntu下编译安装postgreSQL 10.5 ubuntu 16.04 LTS系统postgreSQL 10.5 安装包准备 1.从PostgreSQL官网下载PostgreSQL的安装包 安 ...
- CentOS 7 64位 安装 PostgreSQL 9.2整理
centos版本 LSB Version: :core-4.1-amd64:core-4.1-noarchDistributor ID: CentOSDescription: CentOS Linux ...
- CentOS 6.9下安装PostgreSQL
操作系统:CentOS6.9_x64 PostgreSQL官方网址: https://www.postgresql.org/ 安装数据库 使用如下命令: yum install postgresql- ...
随机推荐
- WinForm控件之【MonthCalendar】
基本介绍 日期月历控件,顾名思义用来主要用来展示月历,获取年份.月份.日期.时分秒信息等 常设置属性 FirstDayOfWeek:面板展示周期的循序,一周的第一天由从周几开始排列: MaxDate: ...
- TigerGraph入门
测试机器配置 1G内存,1个核,CentOS Linux release 7.4.1708 (Core)的云主机,一块50G HDD的云主机. 1. 安装 下载了目前最新的开发者版本,下载链接:htt ...
- 【弱化版】【P3371 【模板】单源最短路径(弱化版)】-C++
→原题传送门← 看到题目描述我就知道,这道题不能用SPFA[手动补滑稽] 那么我这道题目采用的是dijkstra算法不了解的去补一下知识哈. dij的模板: #include<bits/stdc ...
- 编码原理_base64编码原理
1.1 Base64编码原理 1.1.1 概要: Base64是通讯传输中较为常见的编码方式之一. (注意是编码算法,而非加密算法) 参数传输的过程中会经常遇到的一种情况:使用英文不会涉及到乱码, ...
- JS系列1---节流,去抖(防抖)应用场景:intput请求优化,页面监听
在项目开发过程中经常遇到在input的change事件中发起请求,将用户最新输入的字符作为data传给后台,但是如果用户的输入频率过高,或者用户输入的字符还未拼成一个完整的字词,这时候发起请求会浪费网 ...
- 2019杭电多校第一场hdu6581 Vacation
Vacation 题目传送门 update(O(n)) 看了那个O(n)的方法,感觉自己想的那个O(nlogn)的好傻,awsl. 0车最终通过停车线的时候,状态一定是某个车堵住后面的所有车(这个车也 ...
- Django的性能优化
Django的性能优化 一,利用标准数据库优化技术 传统数据库优化技术博大精深,不同的数据库有不同的优化技巧,但重心还是有规则的.在这里算是题外话,挑两点通用的说说: 索引,给关键的字段添加索引, ...
- Java Web项目案例之---登录和注册(精华版)
登录和注册(精华版) (一)实现功能 1.使用cookie记录登录成功的用户名,用户选择记住用户名,则用户再次登录时用户名自动显示 2.实现文件上传功能(上传文件的表单上传于普通的表单上传不同,必须是 ...
- UPC Contest RankList – 2019年第二阶段我要变强个人训练赛第十五场
传送门 A: Colorful Subsequence •题意 给一个长为n的小写字母序列,从中选出字母组成子序列 问最多能组成多少种每个字母都不相同的子序列 (不同位置的相同字母也算是不同的一种) ...
- MySQL8.0 zip压缩包版本 Windows下安装
MySQL zip压缩包版本 Windows下安装 Download MySQL Community Server 解压到相应的目录 我的解压目录:D:\Program Files\mysql-8.0 ...