postgres8.4安装配置:
1.安装postgres8.4
~$ sudo apt-get install postgresql

2.修改超级管理员postgres密码:
以系统用户运行psql
~$ sudo -u postgres psql postgres
修改postgres密码(123456)
postgres=# /password postgres

3.备份修改的配置文件:
备份pg_hba.conf文件
~$ sudo cp /etc/postgresql/8.4/main/pg_hba.conf  /etc/postgresql/8.4/main/pg_hba.conf.original
备份postgresql.conf文件
~$ sudo cp /etc/postgresql/8.4/main/postgresql.conf /etc/postgresql/8.4/main/postgresql.conf.original

4.创建测试用户(密码:123456):
建立测试用户 usertest1,usertest2
createuser -A -D -P -R usertest1
createuser -A -D -P -R usertest2

-A 不允许创建其他用户
-D 不允许创建数据库
-P  创建密码
-R  不允许创建角色

5.创建测试数据库:
建立dbtest1 拥有者为usertest1
建立dbtest2 拥有者为usertest2

6.修改配置文件:
修改postgresql.conf
改变行  #listen_addresses = 'localhost'  修改为 listen_addresses = '*'   监听所有端口
改变行  #password_encryption = on        修改为  password_encryption = on  允许密码访问

修改pg_hba.conf
host    all         all         127.0.0.1/32          md5
host    all         all         192.168.10.0/24       md5
host    dbtest1     usertest1     172.18.67.107/32      md5
host    dbtest2     usertest2     172.18.67.109/32      md5

参考文档:

http://wiki.ubuntu.org.cn/PostgreSQL

http://wiki.ubuntu.org.cn/UbuntuHelp:PostgreSQL

http://community.itbbs.cn/topic/7011-postgresql%E5%AE%89%E8%A3%85%E5%92%8C%E7%AE%80%E5%8D%95%E4%BD%BF%E7%94%A8/?s=27253e5f5998aa7f7f10e86e74fa6bf2

安装postgresql:

sudo apt-get install postgresql

安装pgAdmin3

sudo apt-get install pgadmin3

启动&关闭:

sudo /etc/init.d/postgresql-8.4 start

sudo /etc/init.d/postgresql-8.4 stop

以系统用户运行psql:

sudo -u postgres psql postgres

设置密码:

/password postgres

创建用户(postgres):

createuser -A -D -P -R user1

-A 不允许创建其他用户

-D 不允许创建数据库

-P  创建密码

-R  不允许创建角色

创建数据库:

sudo -u postgres  createdb mydb

激活数据库:

sudo -u postgres psql mydb

使用pgadmin图形客户端:

在终端中输入:pdadmin3

限制ip访问

限制用户名和数据库

修改配置文件:

配置文件放在:/etc/postgresql/8.4/main

管理用户和权限:

编辑/etc/postgresql/8.4/main/pg_hba.conf 并修改它的默认配置

/etc/postgresql/8.4/main/postgresql

sudo gedit /etc/postgresql/8.4/main/postgresql.conf

改变行:#listen_addresses = ‘localhost’ 修改为:listen_addresses = ‘*’

改变行:#password_encryption = on 修改为:password_encryption = on

参考文档

http://www.pgsqldb.org/pgsqldoc-cvs/client-authentication.html

http://www.linuxsir.org/main/node/254

用psql登录

sudo -u postgres psql -U user1 -d test_user1 -h 192.168.10.251

参考文档:

http://bbs.chinaunix.net/viewthread.php?tid=809390

http://blog.csdn.net/wyswlp/article/details/5723327

Ubuntu下Postgres安装与配置的更多相关文章

  1. [转]:Ubuntu 下Apache安装和配置

    [转]:Ubuntu 下Apache安装和配置_服务器应用_Linux公社-Linux系统门户网站  https://www.linuxidc.com/Linux/2013-06/85827.htm ...

  2. Torch7在Ubuntu下的安装与配置

    Torch7的本系列教程的主要目的是介绍Torch的入门使用.今天首先分享一下Torch7的安装.(在Ubuntu14.04安装torch7) 为什么选择Torch Torch的目标是在建立科学算法的 ...

  3. 【转载】Ubuntu下SVN安装和配置

    一.SVN安装 1.安装包 1.$ sudo apt-get install subversion 2.创建项目目录 $ sudo mkdir /home/xiaozhe/svn $ cd /home ...

  4. Ubuntu下SVN安装和配置

    一.SVN安装 1.安装包 1.$ sudo apt-get install subversion 2.创建项目目录 $ sudo mkdir /home/xiaozhe/svn $ cd /home ...

  5. Ubuntu 下Apache安装和配置

    在Ubuntu上安装Apache,有两种方式:1 使用开发包的打包服务,例如使用apt-get命令:2 从源码构建Apache.本文章将详细描述这两种不同的安装方式. 方法一:使用开发包的打包服务—— ...

  6. MySQL在Win10与Ubuntu下的安装与配置

        本文首发于cartoon的博客     转载请注明出处:https://cartoonyu.github.io/cartoon-blog     近段时间把自己电脑(win).虚拟机(Ubun ...

  7. ubuntu下Pycharm安装及配置

    从知乎里看到了Pycharm的介绍,感觉还不错,记录下今天的安装过程 1.从http://www.jetbrains.com/pycharm/download/下载最新的Pycharm 2.在终端中进 ...

  8. Ubuntu 下Apache安装和配置2

    在Ubuntu上安装Apache,有两种方式:1 使用开发包的打包服务,例如使用apt-get命令:2 从源码构建Apache.本文章将详细描述这两种不同的安装方式. 方法一:使用开发包的打包服务—— ...

  9. eclipse(1)----ubuntu下的安装与配置

    eclipse的安装与配置 1.eclipse官网下载,最新版本eclipse-jee-oxygen-3-linux-gtk-x86_64.tar.gz 2.tar包存在~/Download/下,解压 ...

随机推荐

  1. httpServlet,GenericServlet,Servlet源码分析

    httpServlet源码:   /* * Licensed to the Apache Software Foundation (ASF) under one or more * contribut ...

  2. mysql添加DATETIME类型字段导致Invalid default value错误的问题

    例如: CREATE TABLE foo ( `creation_time` DATETIME DEFAULT CURRENT_TIMESTAMP, `modification_time` DATET ...

  3. java的Set, List, Map简单介绍

    Set, List, Map Set和List,Map都是集合,Set和List都是继承于Collection接口,而Map不是. 1.Map(映射) :Map是以key,Value的形式存储数据的映 ...

  4. Lua 不是 C++

    http://blog.codingnow.com/2008/08/lua_is_not_c_plus_plus.html 嗯,首先,此贴不是牢骚帖. 话题从最近私人的一点工作开始.应 dingdan ...

  5. 萌新java入门笔记

    首先声明以下内容只是散乱笔记,如果有误还望大侠指出!不胜感激! 基本数据类型: 大体和C语言类似: boolean truth = true;//逻辑型 //文字型 char c; String st ...

  6. IT兄弟连 JavaWeb教程 JSP定义

    JSP页面是指扩展名为.jsp的文件,在一个JSP页面中,可以包括指令标识.HTML代码.JavaScript代码.嵌入的Java代码.注释和JSP动作标识等内容.但这些内容并不是一个JSP页面所必须 ...

  7. AutoLayout 根据文字、图片自动计算 UITableViewCell 高度

    原文网址: http://lvwenhan.com/ios/449.html 此系列文章代码仓库在 https://github.com/johnlui/AutoLayout ,有不明白的地方可以参考 ...

  8. spark 1.1.0 单机与yarn部署

    环境:ubuntu 14.04, jdk 1.6, scala 2.11.4, spark 1.1.0, hadoop 2.5.1 一 spark 单机模式 部分操作参考:http://www.cnb ...

  9. C 语言实例 - 两个矩阵相加

    C 语言实例 - 两个矩阵相加 C 语言实例 C 语言实例 使用多维数组将两个矩阵相加. 实例 #include <stdio.h> int main(){ ][], b[][], sum ...

  10. (转)java 线程同步

    转自 http://blog.csdn.net/column/details/java-thread.html http://leo-faith.iteye.com/blog/177779 http: ...