手机
当前位置:查字典教程网 >操作系统 >Ubuntu/Debian >ubuntu安装postgresql和使用方法
ubuntu安装postgresql和使用方法
摘要:安装组件客户端安装sudoapt-getinstallpostgresql-client服务器安装sudoapt-getinstallpos...

安装组件

客户端安装

sudo apt-get install postgresql-client

服务器安装

sudo apt-get install postgresql postgresql-contrib

获取Installing PostGIS, procedural languages, client interfaces等插件列表

apt-cache search postgres

Ruby PG gem安装,需要生成Native Extension

首先安装相应package

sudo apt-get install libpq-dev

找到pg_config所在位置

sudo find / -name pg_config

安装pg gem

gem install pg -- --with-pg-config=/usr/bin/pg_config

服务器配置

设置postgres用户,用postgres用户登录并修改密码

sudo -u postgres psql postgres

为postgres用户设置密码

password postgres

创建新数据库

sudo -u postgres createdb mydb

服务器高级设置

创建用户

sudo -u postgres createuser --superuser $USER

sudo -u postgres psql

postgres=# password $USER

管理用户及权限

编辑/etc/postgresql/current/main/postgresql.conf文件用以监听其它网络

listen_addresses = '*'

创建新用户tesdb及该用户所拥有的数据库testdb

sudo -u postgres createuser -D -A -P testdb

sudo -u postgres createdb -O testdb testdb

编辑/etc/postgresql/current/main/pg_hba.conf文件,允许testdb用户远程连接testdb数据库

host testdb testdb 0.0.0.0/0 md5

重新加载配置

sudo /etc/init.d/postgresql reload

重启数据库

sudo /etc/init.d/postgresql restart

【ubuntu安装postgresql和使用方法】相关文章:

在Ubuntu中安装VirtualBox并配置USB设备支持的方法

Ubuntu 8.10 Server Ruby 的安装方法

ubuntu下网页打开慢的解决方法

Ubuntu下的apt-get的使用方法详解

Ubuntu 11.04下安装Eclipse的经验分享

linux,Centos5,Ubuntu关掉ipv6的方法

Ubuntu开启.htaccess的支持配置方法分享

ubuntu8.04下源码安装wine 设置中文

Ubuntu开机自动禁用无线网络的方法

ubuntu上安装QQ(包括多个软件安装方法)

精品推荐
分类导航