PostgreSQL 10.0 源码安装

本文涉及的产品
云原生数据库 PolarDB MySQL 版,Serverless 5000PCU 100GB
简介: 源码安装tar zxvf postgresql-10.0.tar.gzmv postgresql-10.0 /usr/local/pgsqlcd /usr/local/pgsql/root用户下安装依赖包yum -y install gcc gcc-c++ automake auto...

源码安装

tar zxvf  postgresql-10.0.tar.gz
mv postgresql-10.0 /usr/local/pgsql
cd /usr/local/pgsql/

root用户下安装依赖包

yum -y install gcc gcc-c++ automake autoconf libtool make readline-devel zlib-devel readline

安装数据库

./configure --prefix=/usr/local/pgsql --without-readline
make
make install

添加用户,设置目录权限

adduser postgres
passwd postgres
chown -R postgres:root /usr/local/pgsql

添加启动服务(确认文件postgresql内的目录正确)

cp /usr/local/pgsql/contrib/start-scripts/linux  /etc/init.d/postgresql 
chmod u+x /etc/init.d/postgresql

添加开启自启动

chkconfig --add postgresql

切换用户,初始化数据并创建测试库(确认data目录下为空)

su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

设置环境变量

> su - postgres
> vim ~/.bash_profile
export PATH=$PATH:/usr/local/pgsql/bin
export PGDATA=/usr/local/pgsql/data
> source ~/.bash_profile
> vim ~/.bashrc
export PGDATA=/usr/local/pgsql/data
> source ~/.bash_profile

启动服务

service postgresql start

启动数据库

/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

创建和连接数据库

createdb test
psql test

允许所有连接

> vim /usr/local/pgsql/data/pg_hba.conf
host    all             all             0.0.0.0/0               trust

侦听所有连接

> vim /usr/local/pgsql/data/postgresql.conf 
listen_addresses = '*'
logging_collector = on

关闭防火墙

启动: systemctl start firewalld
关闭: systemctl stop firewalld
查看状态: systemctl status firewalld 
开机禁用  : systemctl disable firewalld
开机启用  : systemctl enable firewalld
相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
相关文章
|
7月前
|
SQL 关系型数据库 编译器
PostgreSQL 16源码安装
PostgreSQL 16源码编译,涵盖gcc、clang、pg jit
292 0
|
关系型数据库 Linux 数据库
|
JavaScript 关系型数据库 Linux
PostgreSQL 11源码安装
PostgreSQL 11源码安装 测试环境:RedHat 7.0 Linux 64bit PostgreSQL 11源码安装包下载地址link 系统环境准备 RedHat 7.0默认会安装相关系统包,还需要增加PostgreSQL编译时必须包,如下: gcc, bison, gcc-c++, r.
7470 0
|
关系型数据库 数据库 PostgreSQL
|
关系型数据库 数据库 PostgreSQL
|
关系型数据库 C语言 PostgreSQL
|
运维 关系型数据库 数据库
PostgreSQL运维实战精讲之“postgresql源码安装”
一、下载地址 wget https://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar.gz 二、安装: #安装依赖包 yum install -y perl-...
881 0
|
关系型数据库 PostgreSQL 数据库
|
9月前
|
SQL Cloud Native 关系型数据库
ADBPG(AnalyticDB for PostgreSQL)是阿里云提供的一种云原生的大数据分析型数据库
ADBPG(AnalyticDB for PostgreSQL)是阿里云提供的一种云原生的大数据分析型数据库
737 1