惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
罗磊的独立博客
F
Fortinet All Blogs
T
Threatpost
Y
Y Combinator Blog
博客园_首页
美团技术团队
Security Latest
Security Latest
博客园 - 三生石上(FineUI控件)
T
Tailwind CSS Blog
V
V2EX - 技术
The Cloudflare Blog
L
LINUX DO - 热门话题
博客园 - 司徒正美
Jina AI
Jina AI
P
Proofpoint News Feed
宝玉的分享
宝玉的分享
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
The Hacker News
The Hacker News
P
Privacy International News Feed
T
The Exploit Database - CXSecurity.com
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
M
MIT News - Artificial intelligence
Latest news
Latest news
NISL@THU
NISL@THU
Google DeepMind News
Google DeepMind News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cisco Blogs
雷峰网
雷峰网
Application and Cybersecurity Blog
Application and Cybersecurity Blog
B
Blog RSS Feed
W
WeLiveSecurity
D
DataBreaches.Net
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
GRAHAM CLULEY
Spread Privacy
Spread Privacy
Know Your Adversary
Know Your Adversary
TaoSecurity Blog
TaoSecurity Blog
S
Securelist
Help Net Security
Help Net Security

博客园 - Jaypei

archlinux中启用sshd [转] AT89C52资料 VirtualBox中安装PuppyLinux4 [转]比较全的Vim 中的正则表达式 luacurl的一个获得html的函数 [转]使用Mac OS X系统必须了解的10条命令 [原]Qt4.5中Plugins使用方法 用nuSOAP传递对象数组的问题终于解决 粗心导致的gsoap一个错误 MinGW环境使用gSOAP rdesktop中剪切板共享 [转]在Windows XP下用GCC 4.3.2编译Qt 4.4.3实战 [原创]关于python的Singleton [转]如何讀取文字檔? (C/C++) (STL) 简单的python读写windows剪切板 关于SOAPpy传递对象参数调用WebService的问题总结 LinkedServer的用法 解决Smarty中trancate使用UTF8时中文乱码问题 关于wxPython中多线程修改主界面 - Jaypei
Ubuntu下安装Postgresql 8.3
Jaypei · 2009-02-08 · via 博客园 - Jaypei

2009-02-08 21:15  Jaypei  阅读(2840)  评论()    收藏  举报

以下是安装Postgresql 8.3到Ubuntu 8.10的过程。

在Ubuntu下安装Postgresql和pgAdmin3

sudo apt-get install postgresql-8.3 postgresql-client-8.3 postgresql-contrib-8.3

sudo apt-get install pgadmin3

以上指令安装客户端和服务端,一些额外的工具、pgAdmin3都可以工作在数据库下工作。

配置Postgresql

现在我们需要重置“postgres”用户的密码。

sudo su postgres -c psql template1
template1=# ALTER USER postgres WITH PASSWORD ‘jaypei’;
template1=# \q

这样就修改了数据库中的密码,现在我们也需要在unix用户“postgres”这么作。

sudo passwd -d postgres
sudo su postgres -c passwd

然后输入跟之前一样的密码。

现在,我们就可以在数据库服务器上使用psql或者pgAdmin操作数据库了。

但是若想在pgAdmin中能够更好的记录日志和监视的华,在启动pgAdmin前需要建立PostgreSQL admin pack。打开命令行。

首先,我们需要编辑postgresql.conf:

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

现在,我们需要修改“连接和权限”两行。

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

保存并关闭gedit。

最后一步,我们必须设置谁才可以操作数据服务器,这一切都是在pg_hba.conf中完成的。

sudo gedit /etc/postgresql/8.3/main/pg_hba.conf

把以下内容复制到pg_hba.conf底部:

# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database
# super user can access the database using some other method.
# Noninteractive
# access to all databases is required during automatic maintenance
# (autovacuum, daily cronjob, replication, and similar tasks).
#
# Database administrative login by UNIX sockets
local all postgres ident sameuser
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# “local” is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Connections for all PCs on the subnet
#
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
host all all [ip address] [subnet mask] md5

在最后一行中,添加你的子网掩码(如255.255.255.0)和机器IP地址(如138.250.192.115). 如果要使用一个IP地址范围,只需要把最后一个数字用0替换,那么所有这个网段的IP都可以使用了。

重启服务器即可。

sudo /etc/init.d/postgresql-8.3 restart

现在可以在Ubuntu下使用PostgreSQL了。

使用命令行创建数据库

sudo -u postgres createuser -D -A -P mynewuser
sudo -u postgres createdb -O mynewuser mydatabase

参考自:

http://www.ubuntugeek.com/howto-setup-database-server-with-postgresql-and-pgadmin3.html