Skip to content

Commit

Permalink
Merge pull request #277 from dominikl/rocky9_v2
Browse files Browse the repository at this point in the history
Simplify rocky9 installation
  • Loading branch information
jburel authored Nov 7, 2023
2 parents 4b0130e + 8cc3309 commit 515036a
Show file tree
Hide file tree
Showing 8 changed files with 249 additions and 81 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
os: [rockylinux9, debian10, ubuntu1804, ubuntu2004, ubuntu2204]
pg: [pg13, pg14]
os: [rockylinux9, debian10, ubuntu2204]
pg: [pg13, pg14, pg15, pg16]
exclude:
- os: ubuntu2204
pg: pg13
- os: debian10
pg: pg15
- os: debian10
pg: pg16
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
118 changes: 94 additions & 24 deletions linux/autogenerate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,27 @@ echo "$line" >> $file
N=$OS
if [[ $OS =~ "centos" ]] ; then
N="centos"
elif [[ $OS =~ "rocky" ]] ; then
N="centos"
elif [[ $OS =~ "ubuntu1804" ]] ; then
N="ubuntu1804"
elif [[ $OS =~ "ubuntu" ]] ; then
N="ubuntu"
fi
echo -en '\n' >> $file
echo "# install Java" >> $file
number=$(sed -n '/#start-recommended/=' $dir/step01_"$N"_java_deps.sh)
ns=$((number+1))
number=$(sed -n '/#end-recommended/=' $dir/step01_"$N"_java_deps.sh)
ne=$((number-1))
line=$(sed -n ''$ns','$ne'p' $dir/step01_"$N"_java_deps.sh)
if [[ $OS =~ "rocky" ]] ; then
number=$(sed -n '/#start-recommended-java/=' $dir/step01_rocky9_deps.sh)
ns=$((number+1))
number=$(sed -n '/#end-recommended-java/=' $dir/step01_rocky9_deps.sh)
ne=$((number-1))
line=$(sed -n ''$ns','$ne'p' $dir/step01_rocky9_deps.sh)
else
number=$(sed -n '/#start-recommended/=' $dir/step01_"$N"_java_deps.sh)
ns=$((number+1))
number=$(sed -n '/#end-recommended/=' $dir/step01_"$N"_java_deps.sh)
ne=$((number-1))
line=$(sed -n ''$ns','$ne'p' $dir/step01_"$N"_java_deps.sh)
fi

# remove leading whitespace
line="$(echo -e "${line}" | sed -e 's/^[[:space:]]*//')"
echo "$line" >> $file
Expand All @@ -74,11 +81,18 @@ echo "# install dependencies" >> $file
N=$OS
if [[ $OS =~ "ubuntu" ]] ; then
N="ubuntu1804"
elif [[ $OS =~ "rocky" ]] ; then
N="centos7"
fi

line=$(sed -n '2,$p' $dir/step01_"$N"_deps.sh)
if [[ $OS =~ "rocky" ]] ; then
number=$(sed -n '/#start-general/=' $dir/step01_rocky9_deps.sh)
ns=$((number+1))
number=$(sed -n '/#end-general/=' $dir/step01_rocky9_deps.sh)
ne=$((number-1))
line=$(sed -n ''$ns','$ne'p' $dir/step01_rocky9_deps.sh)
else
line=$(sed -n '2,$p' $dir/step01_"$N"_deps.sh)
fi

echo "$line" >> $file
echo "#end-step01" >> $file

Expand All @@ -87,23 +101,29 @@ echo "#end-step01" >> $file
echo "# install Ice" >> $file
N=$OS
echo "#start-recommended-ice" >> $file
number=$(sed -n '/#start-recommended/=' $dir/step01_"$N"_ice_deps.sh)
ns=$((number+1))
number=$(sed -n '/#end-recommended/=' $dir/step01_"$N"_ice_deps.sh)
ne=$((number-1))
line=$(sed -n ''$ns','$ne'p' $dir/step01_"$N"_ice_deps.sh)
# remove leading whitespace
line="$(echo -e "${line}" | sed -e 's/^[[:space:]]*//')"
if [[ $OS =~ "rocky" ]] ; then
number=$(sed -n '/#start-recommended-ice/=' $dir/step01_rocky9_deps.sh)
ns=$((number+1))
number=$(sed -n '/#end-recommended-ice/=' $dir/step01_rocky9_deps.sh)
ne=$((number-1))
line=$(sed -n ''$ns','$ne'p' $dir/step01_rocky9_deps.sh)
else
number=$(sed -n '/#start-recommended/=' $dir/step01_"$N"_ice_deps.sh)
ns=$((number+1))
number=$(sed -n '/#end-recommended/=' $dir/step01_"$N"_ice_deps.sh)
ne=$((number-1))
line=$(sed -n ''$ns','$ne'p' $dir/step01_"$N"_ice_deps.sh)
# remove leading whitespace
line="$(echo -e "${line}" | sed -e 's/^[[:space:]]*//')"
fi

echo "$line" >> $file
echo "#end-recommended-ice" >> $file

echo -en '\n' >> $file

# install postgres
N=$OS
if [[ $OS =~ "rocky" ]] ; then
N="centos"
fi
echo -en '\n' >> $file
echo "# install Postgres" >> $file
if [[ $N =~ "centos" ]] ; then
Expand All @@ -123,6 +143,34 @@ if [[ $N =~ "centos" ]] ; then
line=$(sed -n ''$nrs','$nre'p' $dir/step01_"$OS"_pg_deps.sh)
# remove docker conditional
line=`remove_docker_workaround "${line}"`
elif [[ $OS =~ "rocky" ]] ; then
number=$(sed -n '/#start-pg-enabling/=' $dir/step01_rocky9_deps.sh)
nrs=$((number+1))
number=$(sed -n '/#end-pg-enabling/=' $dir/step01_rocky9_deps.sh)
nre=$((number-1))
line=$(sed -n ''$nrs','$nre'p' $dir/step01_rocky9_deps.sh)
line="$(echo -e "${line}" | sed -e 's/^[[:space:]]*//')"
echo "$line" >> $file

number=$(sed -n '/#start-recommended-postgres/=' $dir/step01_rocky9_deps.sh)
nrs=$((number+1))
number=$(sed -n '/#end-recommended-postgres/=' $dir/step01_rocky9_deps.sh)
nre=$((number-1))
line=$(sed -n ''$nrs','$nre'p' $dir/step01_rocky9_deps.sh)


# remove docker conditional
line=`remove_docker_workaround "${line}"`
line="$(echo -e "${line}" | sed -e 's/^[[:space:]]*//')"
echo "$line" >> $file

number=$(sed -n '/#start-recommended-pg-start/=' $dir/step01_rocky9_deps.sh)
nrs=$((number+1))
number=$(sed -n '/#end-recommended-pg-start/=' $dir/step01_rocky9_deps.sh)
nre=$((number-1))
line=$(sed -n ''$nrs','$nre'p' $dir/step01_rocky9_deps.sh)
# remove docker conditional
line=`remove_docker_workaround "${line}"`
else
number=$(sed -n '/#start-recommended/=' $dir/step01_"$N"_pg_deps.sh)
ns=$((number+1))
Expand Down Expand Up @@ -274,11 +322,33 @@ echo "$line" >> $file
echo "#end-step07" >> $file

if [[ $OS =~ "centos" ]]; then
echo "#start-selinux" >> $file
line=$(sed -n '2,$p' $dir/setup_centos_selinux.sh)
echo "$line" >> $file
echo "#end-selinux" >> $file
echo "#start-selinux" >> $file
line=$(sed -n '2,$p' $dir/setup_centos_selinux.sh)
echo "$line" >> $file
echo "#end-selinux" >> $file
fi

if [[ $OS =~ "rocky" ]]; then
echo "#start-step08: As root, configure" >> $file
number=$(sed -n '/#start-recommended/=' $dir/step08_rocky9_config.sh)
nrs=$((number+1))
number=$(sed -n '/#end-recommended/=' $dir/step08_rocky9_config.sh)
nre=$((number-1))
line=$(sed -n ''$nrs','$nre'p' $dir/step08_rocky9_config.sh)
# remove docker conditional
line=`remove_docker_workaround "${line}"`
echo "$line" >> $file

number=$(sed -n '/#start-open-omero-server-port/=' $dir/step08_rocky9_config.sh)
nrs=$((number+1))
number=$(sed -n '/#end-open-omero-server-port/=' $dir/step08_rocky9_config.sh)
nre=$((number-1))
line=$(sed -n ''$nrs','$nre'p' $dir/step08_rocky9_config.sh)
line="$(echo -e "${line}" | sed -e 's/^[[:space:]]*//')"
echo "$line" >> $file
echo "#end-step08" >> $file
fi

}

#generate scripts for all os by default.
Expand Down
17 changes: 4 additions & 13 deletions linux/install_rocky9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,12 @@
set -e -u -x

OMEROVER=${OMEROVER:-latest}
PGVER=${PGVER:-pg15}
JAVAVER=${JAVAVER:-openjdk11}

. `dirname $0`/settings.env

bash -eux step01_centos7_init.sh

bash -eux step01_centos7_deps.sh

# install java
bash -eux step01_centos_java_deps.sh

# install ice
bash -eux step01_rocky9_ice_deps.sh

# install Postgres
bash -eux step01_rocky9_pg_deps.sh
PGVER=$PGVER JAVAVER=$JAVAVER bash -eux step01_rocky9_deps.sh

bash -eux step02_all_setup.sh

Expand All @@ -41,4 +32,4 @@ fi
#If you don't want to use the systemd scripts you can start OMERO manually:
#su - omero-server -c ". /home/omero-server/settings.env omero admin start"

bash -eux step06_centos7_daemon.sh
bash -eux step08_rocky9_config.sh
125 changes: 125 additions & 0 deletions linux/step01_rocky9_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#!/bin/bash

PGVER=${PGVER:-pg15}
JAVAVER=${JAVAVER:-openjdk11}
# General additional packages installation
#start-general
dnf -y install python 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/20230928/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
#start-recommended-pg-start
systemctl start postgresql
systemctl enable postgresql
#end-recommended-pg-start
elif [ "$PGVER" = "pg14" ]; then
systemctl start postgresql-14
systemctl enable postgresql-14
elif [ "$PGVER" = "pg15" ]; then
systemctl start postgresql-15
systemctl enable postgresql-15
elif [ "$PGVER" = "pg16" ]; then
systemctl start postgresql-16
systemctl enable postgresql-16
fi
fi
13 changes: 0 additions & 13 deletions linux/step01_rocky9_ice_deps.sh

This file was deleted.

28 changes: 0 additions & 28 deletions linux/step01_rocky9_pg_deps.sh

This file was deleted.

Loading

0 comments on commit 515036a

Please sign in to comment.