Linux下PostgreSQL如何源码安装
发表于:2025-02-04 作者:千家信息网编辑
千家信息网最后更新 2025年02月04日,这篇文章将为大家详细讲解有关Linux下PostgreSQL如何源码安装,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。1、首先安装依赖包,避免在安装过程中出现问题s
千家信息网最后更新 2025年02月04日Linux下PostgreSQL如何源码安装
这篇文章将为大家详细讲解有关Linux下PostgreSQL如何源码安装,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
1、首先安装依赖包,避免在安装过程中出现问题
shell> yum install gcc gcc-c++ automake autoconf libtool makeshell> yum install readline-develshell> yum install zlib-devel
2、创建postgre用户及用户组
shell> groupadd postgreshell> useradd -g postgre postgre shell> passwd postgre #修改密码shell> id postgreuid=500(postgre) gid=501(postgre) 组=501(postgre)
3、编译安装postgre
shell> tar zxvf postgresql-9.3.6.tar.gzshell> cd postgresql-9.3.6shell> ./configure --prefix=/db/pgsqlshell> make && make install PostgreSQL installation complete.
4、设置数据库目录权限并初始化数据库
shell> mkdir -p /db/pgsql/datashell> chown -R postgre.postgre /db/pgsql/shell> cp contrib/start-scripts/linux /etc/rc.d/init.d/postgresqlshell> su - postgre# 初始化数据库shell> /db/pgsql/bin/initdb -D /db/pgsql/data/The files belonging to this database system will be owned by user "postgre".This user must also own the server process.The database cluster will be initialized with locale "zh_CN.UTF-8".The default database encoding has accordingly been set to "UTF8".initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"The default text search configuration will be set to "simple".Data page checksums are disabled.fixing permissions on existing directory /db/pgsql/data ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBcreating configuration files ... okcreating template1 database in /db/pgsql/data/base/1 ... okinitializing pg_authid ... okinitializing dependencies ... okcreating system views ... okloading system objects' descriptions ... okcreating collations ... okcreating conversions ... okcreating dictionaries ... oksetting privileges on built-in objects ... okcreating information schema ... okloading PL/pgSQL server-side language ... okvacuuming database template1 ... okcopying template1 to template0 ... okcopying template1 to postgres ... oksyncing data to disk ... okWARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.Success. You can now start the database server using: /db/pgsql/bin/postgres -D /db/pgsql/data/or /db/pgsql/bin/pg_ctl -D /db/pgsql/data/ -l logfile start
5、设置环境变量
shell> vi .bash_profile==================================================================PATH=$PATH:$HOME/bin:/db/pgsql/binexport PGDATA=/db/pgsql/dataexport PGHOME=/db/pgsqlexport LANG=zh_CN.UTF-8export PGPORT=5432export PATH==================================================================shell> source .bash_profile
6、开启postgre服务
shell> pg_ctl -D /db/pgsql/data/ -l /db/pgsql/log/logfile start server startingshell> tail -f /db/pgsql/logfileLOG: database system was shut down at 2015-04-20 17:59:36 CSTLOG: database system is ready to accept connectionsLOG: autovacuum launcher started
7、测试连接数据库
shell> createdb mydbshell> psql -h 127.0.0.1 -p 5432 -U postgre -W mydbPassword for user postgre: psql (9.3.6)Type "help" for help.mydb=# # 显示当前数据库mydb=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+---------+----------+-------------+-------------+--------------------- mydb | postgre | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | postgres | postgre | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | template0 | postgre | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgre + | | | | | postgre=CTc/postgre template1 | postgre | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgre + | | | | | postgre=CTc/postgre(4 rows)# 退出命令行mydb=# \q
关于"Linux下PostgreSQL如何源码安装"这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
数据
数据库
篇文章
源码
更多
用户
不错
实用
内容
变量
命令
密码
文章
权限
环境
用户组
目录
知识
过程
问题
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
京东科技互联网电视机
数据库建设图片标准
棋牌游戏软件开发怎么谈
灿尔科技软件开发
吉林网络安全的公司
mysql数据库节点
数据库原理和技术课后答案
网络安全实验教学大纲
安卓软件开发应聘简历
苹果注册id显示无法联系服务器
mysql数据库临时表
如何登录linux服务器
服务器的芯片是不是特别挣钱
网络安全行业就业率
江苏网站服务器云主机
数据库中创建关键
右下角显示服务器图标
怎样制作小程序软件开发
深圳未来互联网科技园
小学开展网络安全活动报道
服务器推出
净化网络安全视频
怎么查是什么数据库类型
上海楽客网络技术有限公司
软件开发公司岗位安置
校团委网络安全保障方案
校园网络安全展望
地区表数据库设计
mangodb是实时数据库吗
网络安全设备分类有哪些