1. 选择版本,安装PGSQL
例如MADlib 1.20 支持pgsql 11或者12。
yum 安装pgsql12,其安装脚本在官网上可以找到。
# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install PostgreSQL:
sudo yum install -y postgresql12-server
# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl enable postgresql-12
sudo systemctl start postgresql-12
2. 配置pgsql
- bin命令在/usr/pgsql-12/bin中,需在~/.bash_profile中配置环境变量PATH
- 配置文件在/var/lib/pgsql/12/data中,修改pg_hba.conf文件
#添加以下配置,开启远程连接
host all postgres 192.168.11.0/24 trust
- 修改postgresql.conf
# 修改配置
listen_addresses = '*'
- 添加依赖
yum install postgresql-plpython
- 修改postgres用户密码
su postgres
psql
ALTER USER postgres WITH PASSWORD 'postgres';
- 重启
3. 安装MADlib
- 官网下载rpm安装包,安装: rpm -ivh apache-madlib-1.20.0-CentOS7.rpm
- 切换到postgres用户,创建madlib schema
提前创建好madlib_test数据库
# -p:指定要安装的数据库类型
/usr/local/madlib/bin/madpack -p postgres -c postgres@192.168.11.102:5432/madlib_test install