-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathstep01_rocky9_deps.sh
124 lines (111 loc) · 4.42 KB
/
step01_rocky9_deps.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
PGVER=${PGVER:-pg15}
JAVAVER=${JAVAVER:-openjdk11}
# General additional packages installation
#start-general
dnf -y install python3 unzip bzip2 wget bc openssl
#end-general
# Java installation
if [ "$JAVAVER" = "openjdk1.8" ]; then
dnf -y install java-1.8.0-openjdk
elif [ "$JAVAVER" = "openjdk1.8-devel" ]; then
dnf -y install java-1.8.0-openjdk-devel
elif [ "$JAVAVER" = "openjdk11" ]; then
#start-recommended-java
dnf -y install java-11-openjdk
#end-recommended-java
elif [ "$JAVAVER" = "openjdk11-devel" ]; then
dnf -y install java-11-openjdk-devel
fi
# ICE installation
#start-recommended-ice
if grep -q "Rocky" /etc/redhat-release; then
dnf -y install 'dnf-command(config-manager)'
dnf config-manager --set-enabled crb
fi
if grep -q "Red Hat" /etc/redhat-release; then
subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
fi
dnf -y install expat libdb-cxx
cd /tmp
wget https://github.com/glencoesoftware/zeroc-ice-rhel9-x86_64/releases/download/20231130/Ice-3.6.5-rhel9-x86_64.tar.gz
tar xf Ice-3.6.5-rhel9-x86_64.tar.gz
mv Ice-3.6.5 /opt/ice-3.6.5
echo /opt/ice-3.6.5/lib64 > /etc/ld.so.conf.d/ice-x86_64.conf
ldconfig
#end-recommended-ice
# PostgreSQL installation
if [ "$PGVER" != "pg13" ]; then
#start-pg-enabling
dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf -qy module disable postgresql
#end-pg-enabling
fi
if [ "$PGVER" = "pg13" ]; then
dnf -y install postgresql-server postgresql
if [ -f /.dockerenv ]; then
su - postgres -c "/usr/bin/initdb -D /var/lib/pgsql/data --encoding=UTF8"
echo "listen_addresses='*'" >> /var/lib/pgsql/data/postgresql.conf
else
PGSETUP_INITDB_OPTIONS=--encoding=UTF8 /usr/bin/postgresql-setup --initdb
fi
sed -i.bak -re 's/^(host.*)ident/\1md5/' /var/lib/pgsql/data/pg_hba.conf
sed -i 's/ ident/ trust/g' /var/lib/pgsql/data/pg_hba.conf
elif [ "$PGVER" = "pg14" ]; then
dnf -y install postgresql14-server postgresql14
if [ -f /.dockerenv ]; then
su - postgres -c "/usr/pgsql-14/bin/initdb -D /var/lib/pgsql/14/data --encoding=UTF8"
echo "listen_addresses='*'" >> /var/lib/pgsql/14/data/postgresql.conf
ln -s /usr/pgsql-14/bin/pg_ctl /usr/bin/pg_ctl
ln -s /var/lib/pgsql/14/data /var/lib/pgsql/data
else
PGSETUP_INITDB_OPTIONS=--encoding=UTF8 /usr/pgsql-14/bin/postgresql-14-setup initdb
fi
sed -i.bak -re 's/^(host.*)ident/\1md5/' /var/lib/pgsql/14/data/pg_hba.conf
sed -i 's/ ident/ trust/g' /var/lib/pgsql/14/data/pg_hba.conf
elif [ "$PGVER" = "pg15" ]; then
#start-recommended-postgres
dnf -y install postgresql15-server postgresql15
if [ -f /.dockerenv ]; then
su - postgres -c "/usr/pgsql-15/bin/initdb -D /var/lib/pgsql/15/data --encoding=UTF8"
echo "listen_addresses='*'" >> /var/lib/pgsql/15/data/postgresql.conf
ln -s /usr/pgsql-15/bin/pg_ctl /usr/bin/pg_ctl
ln -s /var/lib/pgsql/15/data /var/lib/pgsql/data
else
PGSETUP_INITDB_OPTIONS=--encoding=UTF8 /usr/pgsql-15/bin/postgresql-15-setup initdb
fi
sed -i.bak -re 's/^(host.*)ident/\1md5/' /var/lib/pgsql/15/data/pg_hba.conf
sed -i 's/ ident/ trust/g' /var/lib/pgsql/15/data/pg_hba.conf
#end-recommended-postgres
elif [ "$PGVER" = "pg16" ]; then
dnf -y install postgresql16-server postgresql16
if [ -f /.dockerenv ]; then
su - postgres -c "/usr/pgsql-16/bin/initdb -D /var/lib/pgsql/16/data --encoding=UTF8"
echo "listen_addresses='*'" >> /var/lib/pgsql/16/data/postgresql.conf
ln -s /usr/pgsql-16/bin/pg_ctl /usr/bin/pg_ctl
ln -s /var/lib/pgsql/16/data /var/lib/pgsql/data
else
PGSETUP_INITDB_OPTIONS=--encoding=UTF8 /usr/pgsql-16/bin/postgresql-16-setup initdb
fi
sed -i.bak -re 's/^(host.*)ident/\1md5/' /var/lib/pgsql/16/data/pg_hba.conf
sed -i 's/ ident/ trust/g' /var/lib/pgsql/16/data/pg_hba.conf
fi
if [ -f /.dockerenv ]; then
su - postgres -c "/usr/bin/pg_ctl start -D /var/lib/pgsql/data -w"
else
if [ "$PGVER" = "pg13" ]; then
systemctl start postgresql
systemctl enable postgresql
elif [ "$PGVER" = "pg14" ]; then
systemctl start postgresql-14
systemctl enable postgresql-14
elif [ "$PGVER" = "pg15" ]; then
#start-recommended-pg-start
systemctl start postgresql-15
systemctl enable postgresql-15
#end-recommended-pg-start
elif [ "$PGVER" = "pg16" ]; then
systemctl start postgresql-16
systemctl enable postgresql-16
fi
fi