harbor 默认安装会使用官方打包的PostgreSQL docker 镜像 goharbor/harbor-db,harbor 启动之后的数据均存放在改数据库上,后续管理可能存在不便,故使用 harbor 配置外部数据库。
安装依赖:
1
|
yum install -y readline-devel zlib-devel make openssl-devel gcc
|
2.源码安装
1
2
3
4
5
6
7
8
9
|
tar -xf postgresql-13.3.tar
cd postgresql-13.3
./configure --prefix=/usr/local/pgsql
make
make install
|
3、创建 postgres 用户
1
2
3
|
groupadd postgres
useradd -g postgres postgres
|
4、创建数据目录并授权
1
2
3
|
mkdir /usr/local/pgsql/data
chown postgres:postgres /usr/local/pgsql/data
|
5、切换到 postgres 用户
6、初始化
1
|
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
|
7.启动
1
|
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/logfile start
|
二、配置 postgres
1、进入数据库
1
2
3
|
su - postgres
/usr/local/pgsql/bin/psql
|
2、创建表结构
1
2
3
4
5
|
postgres=# create database registry;
postgres=# create database notaryserver;
postgres=# create database notarysigner;
|
3、修改配置文件
1
2
3
4
5
|
vim pg_hba.conf #最后添加以下两行
host all postgres 0.0.0.0/0 trust
host all postgres 192.168.56.43/32 trust
|
4、重启 postgresql
1
|
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/data/logfile restart
|
三、修改 harbor.yml
1、vim harbor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
external_database:
harbor:
host: 192.168.56.42
port: 5432
db_name: registry
username: postgres
password:
ssl_mode: disable
max_idle_conns: 50
max_open_conns: 100
notary_signer:
host: 192.168.56.42
port: 5432
db_name: notarysigner
username: postgres
password:
ssl_mode: disable
notary_server:
host: 192.168.56.42
port: 5432
db_name: notaryserver
username: postgres
password:
ssl_mode: disable
|
关闭防火墙:
1
2
|
systemctl stop firewalld
systemctl disable firewalld
|