Linux下PostgreSQL如何源码安装
发表于:2025-11-07 作者:千家信息网编辑
千家信息网最后更新 2025年11月07日,这篇文章将为大家详细讲解有关Linux下PostgreSQL如何源码安装,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。1、首先安装依赖包,避免在安装过程中出现问题s
千家信息网最后更新 2025年11月07日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安全错误
数据库的锁怎样保障安全
网络安全性测试是什么意思
数据库联合主键修改
服务器 挂qq
有关网络安全的新闻
山东省网络安全员竞赛
冷水滩国家网络安全宣传周活动
服务器电源二手的
春季高考网络技术专业考什么
描述软件开发的瀑布模型
数据库更新用户访问不受影响
cod战区无法连接服务器
宁波市信息网络技术
yii查询数据库
广东dns服务器名称云主机
物联网数据库开源
网络技术与应用教案选修课
四级数据库工程师题库软件
七日杀服务器ip有什么用
计算机网络安全论文文库
微软数据库用户数
网络切片有服务器吗
vfp数据库表怎么打开
网络安全调剂大学
世界互联网大会科技之光大会
江苏微型软件开发产业化
工会网络安全问卷调查平台
对计算机网络技术的前景
数据库系统结构与数据模型
吴中区推广软件开发口碑
微软数据库用户数