centos安装postgresql数据库过程
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了centos安装postgresql数据库过程,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2063字,纯文字阅读大概需要3分钟。
内容图文
1.1.1 软件安装
1.设置用户组和用户级别
Postgresql不能以root身份运行,要以其他的身份运行,所以必须建立对应的用户和组。
(1)新增database用户组:groupadd database
(2) 新增 pgsql 用户属于 postgresql 用户组: useradd -g database pgsql
(3)修改pgsql用户密码:passwd pgsql(这里设置密码为postgres)
2. 操作系统信息:centos 5 x86
3.准备安装包,下载PostgreSQL源码:http://www.postgresql.org/ftp/source,现在已经更新到了9.1beta版本了,本次安装使用8.4.6
4.上传下载到的postgresql-8.4.6.tar.gz到/pgsql目录下。
5
-
[pgsql@localhost opt]$$ cd pgsql
-
[pgsql@localhost opt]$$tar -zxvf postgresql-8.4.6.tar.gz
-
[pgsql@localhost opt]$ cd postgresql-8.4.6/
-
[pgsql@localhost postgresql-8.4.6]$./configure --prefix=/opt/postgresql
-
[pgsql@localhost postgresql-8.4.6]$make
-
[pgsql@localhost postgresql-8.4.6]$make install
6.报错
[pgsql@vps postgresql-8.4.6]$ make install
make -C doc install
make[1]: Entering directory `/home/pgsql/pgsql/postgresql-8.4.6/doc‘
mkdir -p -- /opt/postgresql/share/doc//html
mkdir: cannot create directory `/opt/postgresql‘: Permission denied
make[1]: *** [installdirs] Error 1
make[1]: Leaving directory `/home/pgsql/pgsql/postgresql-8.4.6/doc‘
make: *** [install] Error 2
[pgsql@vps postgresql-8.4.6]$ make install
make -C doc install
make[1]: Entering directory `/home/pgsql/pgsql/postgresql-8.4.6/doc‘
mkdir -p -- /opt/postgresql/share/doc//html
mkdir: cannot create directory `/opt/postgresql‘: Permission denied
make[1]: *** [installdirs] Error 1
make[1]: Leaving directory `/home/pgsql/pgsql/postgresql-8.4.6/doc‘
make: *** [install] Error 2
处理办法,把opt的改为777.
8.初始化数据库。
-
[pgsql@localhost postgresql-8.4.2]$ cd /opt/postgresql/bin/
-
[pgsql@localhost bin]$./initdb --encoding=utf8 -D /opt/postgresql/data
初始化完成后屏幕打印如下信息:
Success. You can now start the database server using:
./postgres -D /home/pgsql/data
or
./pg_ctl -D /home/pgsql/data -l logfile start
10. 启动数据库
-
[postgres@localhost bin]$./postgres -D /home/pgsql/data/
当然,可以通过日志重写向,将启动信息写入日志,例如:
-
[postgres@localhost bin]$ ./pg_ctl -D /home/pgsql/data/ - /home/pgsql/log/pg_server.log start
将日志信息记录在文件/home/pgsql/log/pg_server.log中,
11.安装完毕。
本文出自 “不一样的地域” 博客,谢绝转载!
原文:http://changeing.blog.51cto.com/4079776/1596061
内容总结
以上是互联网集市为您收集整理的centos安装postgresql数据库过程全部内容,希望文章能够帮你解决centos安装postgresql数据库过程所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。