-
Notifications
You must be signed in to change notification settings - Fork 11
/
install.sh
executable file
·47 lines (39 loc) · 980 Bytes
/
install.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash -ex
#
# Note: Need to run this as root
#
[ -z $BUCARDO_LOCAL_PASSWORD ] && echo "Plase set BUCARDO_LOCAL_PASSWORD" && exit 1
# Install prerequisites
apt update
apt install -y \
cpanminus \
gcc \
libdbi-perl \
libpq-dev \
make \
postgresql \
postgresql-client-common \
postgresql-plperl-12
# Create bucardo user in the local Postgresql
sudo -u postgres psql -w postgres <<EOF
CREATE USER bucardo WITH LOGIN SUPERUSER ENCRYPTED PASSWORD '$BUCARDO_LOCAL_PASSWORD';
EOF
# Create bucardo database in the local Postgresql
sudo -u postgres psql -w postgres <<EOF
CREATE DATABASE bucardo;
EOF
# Install Perl modules required by Bucardo
cpanm CGI
cpanm DBD::Pg
cpanm DBIx::Safe
cpanm Encode::Locale
# Download and install Bucardo from source
curl -L https://github.com/bucardo/bucardo/archive/5.5.0.tar.gz -o bucardo.tar.gz
tar -zxvf bucardo.tar.gz
pushd bucardo-5.5.0
perl Makefile.PL
make
make install
popd
mkdir -p /var/run/bucardo
mkdir -p /var/log/bucardo