记录了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等信息

安装配置postgreSQL+pgcli+pgadmin3的更多相关文章

  1. 安装配置Postgresql

    //关闭selinuxgetenforcesetenfroce 0vi /etc/selinux/configSELINUX=disabledSELINUXTYPE=targeted//关闭防火墙#c ...

  2. Centos 7.3 安装配置 PostgreSQL 9.x

    一.安装 PostgresSQL Centos 7 自带的 PostgresSQL 是 9.2 版的.因为,yum 已经做了国内源,速度飞快,所以直接就用 yum 安装了.依次执行以下命令即可,非常简 ...

  3. windows下安装配置postgreSQL

    1.下载 postgresql-10.4-1-windows-x64.exe 进行安装 2.环境配置(1)文本使用的IDE是VS2010,我们需要配置包含目录(include).库目录(lib).链接 ...

  4. centos7 安装配置postgresql

    考:https://www.linuxidc.com/Linux/2017-10/147536.htm http://blog.51cto.com/12482328/2090844 https://w ...

  5. hadoop集群监控工具Apache Ambari安装配置教程

    ambari 1.2.4 下载地址:http://www.apache.org/dist/incubator/ambari/ambari-1.2.4/ambari-1.2.4-incubating.t ...

  6. [原创]OpenEuler20.03安装配置PostgreSQL13.4详细图文版

    OpenEuler安装配置PostgreSQL 编写时间:2021年9月18日 作者:liupp 邮箱:liupp@88.com 序号 更新内容 更新日期 更新人 1 完成第一至三章内容编辑: 202 ...

  7. postgresql安装配置

    一,什么是postgresql PostgreSQL是以加州大学伯克利分校计算机系开发的 POSTGRES 版本 4.2 为基础的对象关系型数据库管理系统(ORDBMS),简称pgsql,它支持大部分 ...

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

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

  9. CentOS7 yum安装、配置PostgreSQL 9.5

    PostgreSQL 9.5安装 1.添加RPM yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7 ...

随机推荐

  1. 数组其他部分及java常见排序

    数据结构的基本概述: 数据结构是讲什么,其实大概就分为两点: 1.数据与数据之间的逻辑关系:集合.一对一.一对多.多对多 2.数据的存储结构: 一对一的:线性表:顺序表(比如:数组).链表.栈(先进后 ...

  2. c++primer 学习笔记

    1.1 编写简单的c++程序 函数4元素:函数类型.函数名.形参表.函数体 调用GNU(UNIX) g++ prog1.cc -o prog1 //生成可执行文件prog1,UNIX下默认a.out ...

  3. autokeras 在windows10下的安装与使用

    注意:autokeras只适用于python3.6 先打开命令行(cmd), 输入 python --version 查看python版本,是否需要降级和升级. 降级的命令如下: conda inst ...

  4. BZOJ - 2741 分块维护最大连续异或和

    题意:给定\(a[l...r]\),多次询问区间\([l,r]\)中的最大连续异或和\(a_i⊕a_{i+1}⊕...⊕a_{j},l≤i≤j≤r\) 一眼过去认为是不可做的,但题目给出\(n=1.2 ...

  5. alpha-beta搜索算法

    alpha-beta搜索(min-max搜索): 简称mfs,用来解决双方最优决策博弈问题. 核心思想:在搜索树中,下一层越小,对当前层越有利,由于取max,一旦下一层出现了比其他孩子结果更大的值,那 ...

  6. 使用webbench工具测试网站访问压力

    介绍 Webbench是一个在Linux下使用的网站压测工具.它使用fork()模拟多个客户端 同时访问我们设定的URL,测试网站在压力下工作的性能, 最多可以模拟3万个并发连接去测试网站的负载能力. ...

  7. 二级C语言真题笔记

    二级C语言真题笔记 1. 知识重点:数据类型.循环.数组.函数.指针.结构体与共同体 2. 求程序的运行结果 #include <stdio.h> main() {     short i ...

  8. $bzoj1016-JSOI2008$ 最小生成树计数 最小生成树 $dfs/matrix-tree$定理

    题面描述 现在给出了一个简单无向加权图.你不满足于求出这个图的最小生成树,而希望知道这个图中有多少个不同的最小生成树.(如果两颗最小生成树中至少有一条边不同,则这两个最小生成树就是不同的).由于不同的 ...

  9. Oracle PL/SQL编程之基础

    1.简介:pl/sql块由三个部分组成:定义部分.执行部分.例外处理部分,如下所示: declare: /*定义部分---定义常量.变量.游标.例外.复杂数据类型 begin /*执行部分---要执行 ...

  10. css消除空白节点的方法

    在做配置页面的时候,出现一个现在现象,两个同样的div(外框尺寸也是一样的),div里面包含有三个小的div ,三个小的div宽度也是一样的,同为33.3%,但是出现奇怪现象的就是左边一个有滚动条,右 ...