Ubuntu下Postgres安装与配置
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安装与配置的更多相关文章
- [转]:Ubuntu 下Apache安装和配置
[转]:Ubuntu 下Apache安装和配置_服务器应用_Linux公社-Linux系统门户网站 https://www.linuxidc.com/Linux/2013-06/85827.htm ...
- Torch7在Ubuntu下的安装与配置
Torch7的本系列教程的主要目的是介绍Torch的入门使用.今天首先分享一下Torch7的安装.(在Ubuntu14.04安装torch7) 为什么选择Torch Torch的目标是在建立科学算法的 ...
- 【转载】Ubuntu下SVN安装和配置
一.SVN安装 1.安装包 1.$ sudo apt-get install subversion 2.创建项目目录 $ sudo mkdir /home/xiaozhe/svn $ cd /home ...
- Ubuntu下SVN安装和配置
一.SVN安装 1.安装包 1.$ sudo apt-get install subversion 2.创建项目目录 $ sudo mkdir /home/xiaozhe/svn $ cd /home ...
- Ubuntu 下Apache安装和配置
在Ubuntu上安装Apache,有两种方式:1 使用开发包的打包服务,例如使用apt-get命令:2 从源码构建Apache.本文章将详细描述这两种不同的安装方式. 方法一:使用开发包的打包服务—— ...
- MySQL在Win10与Ubuntu下的安装与配置
本文首发于cartoon的博客 转载请注明出处:https://cartoonyu.github.io/cartoon-blog 近段时间把自己电脑(win).虚拟机(Ubun ...
- ubuntu下Pycharm安装及配置
从知乎里看到了Pycharm的介绍,感觉还不错,记录下今天的安装过程 1.从http://www.jetbrains.com/pycharm/download/下载最新的Pycharm 2.在终端中进 ...
- Ubuntu 下Apache安装和配置2
在Ubuntu上安装Apache,有两种方式:1 使用开发包的打包服务,例如使用apt-get命令:2 从源码构建Apache.本文章将详细描述这两种不同的安装方式. 方法一:使用开发包的打包服务—— ...
- eclipse(1)----ubuntu下的安装与配置
eclipse的安装与配置 1.eclipse官网下载,最新版本eclipse-jee-oxygen-3-linux-gtk-x86_64.tar.gz 2.tar包存在~/Download/下,解压 ...
随机推荐
- silverlight xap应用程序库
- web开发并部署到Tomcat上
1. eclipse配置tomcat https://jingyan.baidu.com/article/e4d08ffdabb0710fd2f60de9.html https://blog.csdn ...
- 总结open与fopen的区别
https://www.zybuluo.com/yiltoncent/note/87461 参考链接1 参考链接2 对于这两个名字很类似的函数,对于很多初学者来说,不容易搞清楚它们有什么不同,只知道按 ...
- 极客时间_Vue开发实战_04.开发环境搭建
Vue CLI的形式搭建环境: vue create hello-world 我们选择default默认的配置,提供babel和eslint的支持.如果你已经对工程化的东西非常了解了.你可以选择自定义 ...
- 01 mybatis框架整体概况(2018.7.10)-
01 mybatis框架整体概况(2018.7.10)- F:\廖雪峰 JavaEE 企业级分布式高级架构师课程\廖雪峰JavaEE一期\第一课(2018.7.10) maven用的是3.39的版本 ...
- python 网络编程(网络基础之网络协议篇)
前言 C/S B/S 架构 client<----->server browser<--->server 学习socket编程就是要编写一个客户端软件和服务端软件,然后实现服 ...
- Eclipse SVN 图标解释
[转]http://blog.sina.com.cn/s/blog_64941c8101018dno.html - 已忽略版本控制的文件.可以通过Window → Preferences → Team ...
- Spring Boot 学习系列(07)—properties文件读取
此文已由作者易国强授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 传统的properties读取方式 一般的,我们都可以自定义一个xxx.properties文件,然后在工程 ...
- 洛谷 - P2257 - YY的GCD - 莫比乌斯反演 - 整除分块
https://www.luogu.org/problemnew/show/P2257 求 \(n,m\) 中 \(gcd(i,j)==p\) 的数对的个数 求 $\sum\limits_p \sum ...
- atcoder057D(组合数模板)
题目链接:http://abc057.contest.atcoder.jp/tasks/abc057_d 题意:给出n个数,可以选择x~y个数,使其平均值最大,求其最大平均数以及选择方案数. 思路:只 ...