安装配置postgreSQL+pgcli+pgadmin3

本文涉及的产品
云原生数据库 PolarDB MySQL 版,Serverless 5000PCU 100GB
简介: 记录了postgreSQL数据库的完整的安装配置过程,以及postgreSQL的pgcli命令行智能提醒扩展,pgadmin3图形化管理客户端的配置安装。此postgresql是bigsql版安装详情,另bigsql刚出新版9.6 www.bigsql.org1.环境前提linux(ubuntu16.04)postgresql-95 在postgreSQL官网

记录了postgreSQL数据库的完整的安装配置过程,以及postgreSQL的pgcli命令行智能提醒扩展,pgadmin3图形化管理客户端的配置安装。此postgresql是bigsql版安装详情,另bigsql刚出新版9.6 www.bigsql.org

1.环境前提

  • linux(ubuntu16.04)
  • postgresql-95
    在postgreSQL官网下载deb安装包

2.安装postgresql,使用dkpg命令进行安装

sudo dpkg -i /home/wxl/Downloads/postgresql-9.5.3-1-x64-bigsql.deb

3.配置并初始化postgreSQL 服务

3.1.开启服务

hwclock.sh              rc                     x11-common
wxl@wxl-pc:/etc/init.d$ sudo /etc/init.d/postgresql-95 start
PostgreSQL 9.5 Configuration
---------------------------------
This will initialize PostgreSQL database cluster. The following
questions will determine the database server port, superuser password
 and to start server on system boot. Press <ENTER> to accept defaults.

Specify PostgreSQL server port [5432]:
Specify superuser password [password]:
Do you want PostgreSQL server to be started on boot (y/n) [y]: n
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
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 locales
  COLLATE:  en_US.UTF-8
  CTYPE:    en_US.UTF-8
  MESSAGES: en_US.UTF-8
  MONETARY: zh_CN.UTF-8
  NUMERIC:  zh_CN.UTF-8
  TIME:     zh_CN.UTF-8
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /opt/postgresql/pg95/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
creating template1 database in /opt/postgresql/pg95/data/base/1 ... ok
initializing pg_authid ... ok
setting password ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    /opt/postgresql/pg95/bin/pg_ctl -D /opt/postgresql/pg95/data -l logfile start

Starting PostgreSQL 9.5:
waiting for server to start.... done
server started
PostgreSQL 9.5 started successfully
To load this postgres into your environment, source the env file:
. /opt/postgresql/pg95/pg95.env

3.2.配置系统变量,让postgreSQL环境变量生效

a.拷贝/opt/postgresql/pg95/pg95.env并重名为postgresql.sh,将postgreSQL.sh放置/etc/profile.d/下

wxl@wxl-pc: sudo cp /opt/postgresql/pg95/pg95.env /etc/profile.d/postgresql.sh

b.让变量生效

wxl@wxl-pc: source /etc/profile

3.3.进入postgresql 密码默认是password可以直接psql也可以psql -U postgres -d postgres进入sql

wxl@wxl-pc:~$ psql
Password:
psql (9.5.3)
Type "help" for help.

postgres=# help
You are using psql, the command-line interface to PostgreSQL.
Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit
postgres=# \q

3.4.修改默认密码(默认用户名是 postgres,密码是 postgres)

ALTER USER postgres WITH PASSWORD 'newpassword';
wxl@wxl-pc:~$ psql -U postgres -d postgres
Password for user postgres:
psql (9.5.3)
Type "help" for help.

postgres=# ALTER USER postgres WITH PASSWORD 'newpassword';
ALTER ROLE
postgres=# \q

这里写图片描述

4.安装图形界面

4.1.快速安装安装pgcli

a.安装pip

wxl@wxl-pc:~$ sudo apt install python-pip

b.通过pip快速安装pgcli

wxl@wxl-pc:~$ sudo pip install pgcli

c.如果!!如下报错,因为没有写入路径的权限,加sudo

wxl@wxl-pc:~$ pip install pgcli
Collecting pgcli
  Using cached pgcli-1.1.0.tar.gz
Collecting pgspecial>=1.5.0 (from pgcli)
  Using cached pgspecial-1.5.0.tar.gz
Collecting click>=4.1 (from pgcli)
  Using cached click-6.6.tar.gz
Requirement already satisfied (use --upgrade to upgrade): Pygments>=2.0 in /usr/local/lib/python2.7/dist-packages (from pgcli)
Requirement already satisfied (use --upgrade to upgrade): prompt_toolkit<1.1.0,>=1.0.0 in /usr/local/lib/python2.7/dist-packages (from pgcli)
Collecting psycopg2>=2.5.4 (from pgcli)
  Using cached psycopg2-2.6.2.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/psycopg2.egg-info
    writing pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    Error: pg_config executable not found.

    Please add the directory containing pg_config to the PATH
    or specify the full executable path with the option:

        python setup.py build_ext --pg-config /path/to/pg_config build ...

    or with the pg_config option in 'setup.cfg'.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-sD12wU/psycopg2/

4.2.验证postgreSQL安装是否正确,并查看pgcli版本

a.开启postgreSQL

#开启postgreSQL
sudo /etc/init.d/postgresql-95 start
#环境变量生效
wxl@wxl-pc:~$ . /opt/postgresql/pg95/pg95.env

b.查看pgcli版本

wxl@wxl-pc:~$ pgcli
Password:
Version: 1.1.0
Chat: https://gitter.im/dbcli/pgcli
Mail: https://groups.google.com/forum/#!forum/pgcli
Home: http://pgcli.com
postgres>

这里写图片描述

5.安装pgadmin3可视化数据库管理工具

5.1.pgadmin3安装

wxl@wxl-pc:~$ sudo install pgadmin3

这里写图片描述

5.2.pdadmin3链接postgresql

正确填写信息 name,host,password等信息

这里写图片描述

这里写图片描述

相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
4月前
|
关系型数据库 数据库 PostgreSQL
flink postgresql cdc实时同步(含pg安装配置等)
flink postgresql cdc实时同步(含pg安装配置等)
158 0
|
存储 Ubuntu 关系型数据库
Ubuntu Server 20.04 LTS 安装配置 PostgreSQL
本节我们学习 Ubuntu Server 20.04 LTS 环境安装配置 PostgreSQL 数据库,并讲解 psql 的一些常用命令,分别介绍 pgsql 的两种安装方式,以及角色&身份认证方式和远程访问配置等相关操作...
708 0
Ubuntu Server 20.04 LTS 安装配置 PostgreSQL
|
关系型数据库 数据库 数据安全/隐私保护
CentOS7.5安装配置PostgreSQL11
CentOS7.5安装配置PostgreSQL11
245 0
CentOS7.5安装配置PostgreSQL11
|
关系型数据库 数据库 数据安全/隐私保护
CentOS7.5安装配置PostgreSQL10
CentOS7.5安装配置PostgreSQL10
250 0
CentOS7.5安装配置PostgreSQL10
|
Ubuntu 关系型数据库 Linux
在Linux环境下安装配置PostgreSQL 11和PostGIS 3
Ubuntu 首先添加PostgreSQL的官方源。 Ubuntu 16.04 sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" > /etc/apt/sources.
2695 0
|
关系型数据库 数据库 数据安全/隐私保护
postgresql安装配置
一,什么是postgresql PostgreSQL是以加州大学伯克利分校计算机系开发的 POSTGRES 版本 4.2 为基础的对象关系型数据库管理系统(ORDBMS),简称pgsql,它支持大部分 SQL 标准并且提供了许多其他现代特性:复杂查询 外键 触发器 视图 事务完整性 多版本并发控制 同样,PostgreSQL 可以用许多方法扩展,比如, 通过增加新的:数据类型 函数 操作符 聚集函数 索引方法 过程语言 并且,因为许可证的灵活,任何人都可以以任何目的免费使用,修改,和分发 PostgreSQL, 不管是私用,商用,还是学术研究使用。
1024 0
|
29天前
|
关系型数据库 分布式数据库 数据库
成都晨云信息技术完成阿里云PolarDB数据库产品生态集成认证
近日,成都晨云信息技术有限责任公司(以下简称晨云信息)与阿里云PolarDB PostgreSQL版数据库产品展开产品集成认证。测试结果表明,晨云信息旗下晨云-站群管理系统(V1.0)与阿里云以下产品:开源云原生数据库PolarDB PostgreSQL版(V11),完全满足产品兼容认证要求,兼容性良好,系统运行稳定。
|
1月前
|
关系型数据库 分布式数据库 数据库
PolarDB常见问题之数据库不能自己减少节点如何解决
PolarDB是阿里云推出的下一代关系型数据库,具有高性能、高可用性和弹性伸缩能力,适用于大规模数据处理场景。本汇总囊括了PolarDB使用中用户可能遭遇的一系列常见问题及解答,旨在为数据库管理员和开发者提供全面的问题指导,确保数据库平稳运行和优化使用体验。
|
1月前
|
缓存 关系型数据库 分布式数据库
PolarDB常见问题之数据库cpu突然飙高如何解决
PolarDB是阿里云推出的下一代关系型数据库,具有高性能、高可用性和弹性伸缩能力,适用于大规模数据处理场景。本汇总囊括了PolarDB使用中用户可能遭遇的一系列常见问题及解答,旨在为数据库管理员和开发者提供全面的问题指导,确保数据库平稳运行和优化使用体验。
|
2月前
|
关系型数据库 分布式数据库 数据库
阿里云PolarDB登顶2024中国数据库流行榜:技术实力与开发者影响力
近日,阿里云旗下的自研云原生数据库PolarDB在2024年中国数据库流行度排行榜中夺冠,并刷新了榜单总分纪录,这一成就引起了技术圈的广泛关注。这一成就源于PolarDB在数据库技术上的突破与创新,以及对开发者和用户的实际需求的深入了解体会。那么本文就来分享一下关于数据库流行度排行榜的影响力以及对数据库选型的影响,讨论PolarDB登顶的关键因素,以及PolarDB“三层分离”新版本对开发者使用数据库的影响。
77 3
阿里云PolarDB登顶2024中国数据库流行榜:技术实力与开发者影响力