2018-12-18 02:08:53 +01:00
|
|
|
#!/usr/bin/env bash
|
2018-12-14 03:15:13 +01:00
|
|
|
set -x
|
|
|
|
set -e
|
|
|
|
|
2019-01-04 21:40:27 +01:00
|
|
|
is_prod=false
|
|
|
|
args="$(getopt -o '' --long prod -- "$@")"
|
|
|
|
eval "set -- $args"
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
2020-10-15 04:55:57 +02:00
|
|
|
--prod)
|
|
|
|
is_prod=true
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
2019-01-04 21:40:27 +01:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2018-12-17 19:41:03 +01:00
|
|
|
is_centos=false
|
2018-12-18 15:40:05 +01:00
|
|
|
is_rhel=false
|
2018-12-17 19:41:03 +01:00
|
|
|
if [ -e /etc/centos-release ]; then
|
|
|
|
is_centos=true
|
|
|
|
yum install -y epel-release
|
2019-01-04 21:40:27 +01:00
|
|
|
|
|
|
|
if [ "$is_prod" = true ]; then
|
|
|
|
# IUS is needed for installing python36u-mod_wsgi on prod env
|
|
|
|
yum localinstall -y https://centos7.iuscommunity.org/ius-release.rpm
|
|
|
|
fi
|
|
|
|
|
2018-12-18 15:40:05 +01:00
|
|
|
elif grep -q "Red Hat" /etc/redhat-release; then
|
|
|
|
is_rhel=true
|
|
|
|
yum localinstall -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
2018-12-17 19:41:03 +01:00
|
|
|
fi
|
2019-01-04 21:40:27 +01:00
|
|
|
|
2018-12-16 22:33:54 +01:00
|
|
|
yum update -y
|
2018-12-14 03:15:13 +01:00
|
|
|
|
|
|
|
# "Development Tools" is the equivalent of build-essential
|
|
|
|
yum groupinstall -y "Development Tools"
|
|
|
|
|
|
|
|
RHVER="$(rpm -qf --queryformat="%{VERSION}" /etc/redhat-release)"
|
|
|
|
RHARCH="$(rpm -qf --queryformat="%{ARCH}" /etc/redhat-release)"
|
2018-12-16 20:29:45 +01:00
|
|
|
PGVER=10
|
2018-12-17 19:41:03 +01:00
|
|
|
if [ "$is_centos" = true ]; then
|
|
|
|
# PostgreSQL $PGVER
|
2020-06-08 08:55:28 +02:00
|
|
|
yum localinstall -y "https://yum.postgresql.org/$PGVER/redhat/rhel-$RHVER-$RHARCH/pgdg-redhat-repo-latest.noarch.rpm"
|
2018-12-14 03:15:13 +01:00
|
|
|
|
2018-12-17 19:41:03 +01:00
|
|
|
# PGroonga
|
|
|
|
# https://pgroonga.github.io/install/centos.html
|
|
|
|
yum localinstall -y https://packages.groonga.org/centos/groonga-release-latest.noarch.rpm
|
2018-12-18 15:40:05 +01:00
|
|
|
elif [ "$is_rhel" = true ]; then
|
|
|
|
yum localinstall -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-latest-x86_64/pgdg-redhat10-10-2.noarch.rpm
|
|
|
|
yum localinstall -y https://packages.groonga.org/centos/groonga-release-latest.noarch.rpm
|
2018-12-17 19:41:03 +01:00
|
|
|
else
|
2021-07-19 10:57:13 +02:00
|
|
|
# TODO make the postgres version a variable.
|
2021-03-22 05:46:27 +01:00
|
|
|
PGVER=13
|
2021-07-19 10:57:13 +02:00
|
|
|
dnf install -y "https://download.postgresql.org/pub/repos/yum/reporpms/F-$RHVER-x86_64/pgdg-fedora-repo-latest.noarch.rpm"
|
2018-12-17 19:41:03 +01:00
|
|
|
fi
|