Pg安装
1、 创建用户, 这个用户随意,不一定非要叫postgres。
Useradd pumpkin ;
2、 下载pg源码安装包,目前我用的是9.3.5。
3、 源码安装pg
[pumpkin@hl231 ~]$ ll
总用量 21436
-rw-r--r--. 1 pumpkin pumpkin 21946446 7月 25 2014 postgresql-9.3.5.tar.gz
[pumpkin@hl231 ~]$ tar zxf postgresql-9.3.5.tar.gz -- 解压到当前目录
[pumpkin@hl231 ~]$ mkdir /home/pumpkin/pg9.3 -- 创建安装目录
[pumpkin@hl231 ~]$ ls -- 当前的目录结构
pg9.3 postgresql-9.3.5 postgresql-9.3.5.tar.gz
[pumpkin@hl231 ~]$ cd postgresql-9.3.5 -- 切换进入解压目录
[pumpkin@hl231 postgresql-9.3.5]$ ./configure --prefix=/home/pumpkin/pg9.3/ --with-openssl -- 开始初始化并安装
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking which template to use... linux
checking whether to build with 64-bit integer date/time support... yes
checking whether NLS is wanted... no
checking for default port number... 5432
checking for block size... 8kB
checking for segment size... 1GB
checking for WAL block size... 8kB
checking for WAL segment size... 16MB
checking for gcc... gcc
checking
….. 以下都省略了 太多了.
[pumpkin@hl231 postgresql-9.3.5]$ make
…..
[pumpkin@hl231 postgresql-9.3.5]$ make install
…
make[1]: Leaving directory `/home/pumpkin/postgresql-9.3.5/config'
PostgreSQL installation complete. – 看到这些说明已经安装成功了
4、 配置一下环境变量
[pumpkin@hl231 ~]$ vim ~/.bash_profile
PATH=$PATH:$HOME/bin
PG_HOME=/home/pumpkin/pg9.3
export PG_HOME
PG_DATA=/home/pumpkin/pgdata
export PG_DATA
PG_PORT=5434
export PG_PORT
PATH=$PG_HOME/bin:$PATH
export PATH
[pumpkin@hl231 ~]$ source ~/.bash_profile -- 生效
5、 初始化pgdata
[pumpkin@hl231 ~]$ mkdir ~/pgdata – 创建目录
[pumpkin@hl231 ~]$ initdb -D ~/pgdata/ --encoding=UTF8 --locale=C -- 初始化一个数据库实例
The files belonging to this database system will be owned by user "pumpkin".
This user must also own the server process.
The database cluster will be initialized with locale "C".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /home/pumpkin/pgdata ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in /home/pumpkin/pgdata/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You 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:
postgres -D /home/pumpkin/pgdata/
or
pg_ctl -D /home/pumpkin/pgdata/ -l logfile start
- 初始化完成
初始化完毕之后修改几个参数:
Postgresql.conf 中 修改
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5434 # (change requires restart)
pg_hba.conf 中按照自己的要求进行修改,本次只是用来进行演示,所以我就不改了。
6、 启动数据库
[pumpkin@hl231 ~]$ pg_ctl start -D ~/pgdata/ -- 启动数据库
server starting
$[pumpkin@hl231 ~]$ psql -U postgres
psql (9.3.5)
Type "help" for help.
postgres=# select version();
version
--------------------------------------------------------------------------------
------------------------------
PostgreSQL 9.3.5 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120
313 (Red Hat 4.4.7-4), 64-bit
(1 row)
postgres=#
到此数据库安装完毕
7、
8、
分享到:
相关推荐
PostgreSQL 13.4源码安装,包含安装文档,PG13.4源码,也适合其他版本源码安装
Linux环境PostgreSQL源码编译安装Linux环境PostgreSQL源码编译安装Linux环境PostgreSQL源码编译安装PostgreSQL版
postgresql &pg源码安装编译教程
在centos7下postgresql11.2源码安装,从零开始,一步步进阶,终有一天会成为大师。注意:安装前关闭防火墙,因不是生产环境,因此未涉及相关参数的修改。
通过源码安装PostgreSQL
这是PostgreSQL源代码,供有兴趣的人下载练习windows下编译客户端psql
postgresql-11 Ubuntu22.04离线安装包,deb格式。 执行压缩包内 install.sh 可一键安装。 适用于无互联网环境。
postgresql14加postgis3.2在centos离线编译安装
postgresql源码包编译安装
windows下编译postgresql源码编译环境搭建
postgresql-8.0.23.tar.gz源代码
4500页的源码解读 光是SELECT语句相关实现,就阐述了300多页 看完了你就是postgreSQL达人了 章节明细,需要精读那个功能点就仔细看
PostgreSQL from github
Python编写PostgreSQL数据库结构比对程序源代码,该源代码导入PyCharm即可运行使用。
PostgreSQL 是最初的伯克利的代码的一个开放源码的继承人。 它支持大部分 SQL:2003 标准并且提供了许多其他现代特性:复杂查询、外键、触发器、视图、事务完整性、多版本并发控制 同样,PostgreSQL 可以用...
PostgreSQL-14.2官网正式版源码 & 全自动一键部署脚本(基于CentOS 7,其他系统修改脚本命令即可兼容)。 详细安装过程见博客: https://blog.csdn.net/kinshy/article/details/112134102
Linux 安装postgresql 源码ftp 地址,所有不同版本,官方下载地址
在下载的源码文件夹里找到该文件,放到指定目录,再次运行sql,提示找不到dll文件,将dll文件放到指定目录,再运行,提示找不到zhprs_start函数,看来是dll没有正常explort出函数,修改源代码中的相关函数声明,再次...
Ubuntu下源码安装Postgresql,包括编译和安装的详细过程,实践可行