Skip to content

Commit d19ad5c

Browse files
Merge pull request #76 from LabKey/fb_amzn_linux_2023
Add installation support for Amazon Linux 2023
2 parents b253cf4 + baf3e76 commit d19ad5c

2 files changed

Lines changed: 105 additions & 45 deletions

File tree

install-labkey.bash

Lines changed: 100 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -317,22 +317,45 @@ function step_os_prereqs() {
317317
case "_$(platform)" in
318318
_amzn)
319319
# amzn stuff goes here
320-
# Add adoptium repo
321-
if [ ! -f "/etc/yum.repos.d/adoptium.repo" ]; then
322-
NewFile="/etc/yum.repos.d/adoptium.repo"
323-
(
324-
/bin/cat <<-AMZN_JDK_HERE
320+
# For versions of Amazon Linux prior to 2023 - Add adoptium repo
321+
if [ "$(platform_version)" == "2" ]; then
322+
if [ ! -f "/etc/yum.repos.d/adoptium.repo" ]; then
323+
NewFile="/etc/yum.repos.d/adoptium.repo"
324+
(
325+
/bin/cat <<-AMZN_JDK_HERE
325326
[Adoptium]
326327
name=Adoptium
327328
baseurl=https://packages.adoptium.net/artifactory/rpm/amazonlinux/\$releasever/\$basearch
328329
enabled=1
329330
gpgcheck=1
330331
gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public
331332
AMZN_JDK_HERE
332-
) >"$NewFile"
333+
) >"$NewFile"
334+
fi
335+
sudo yum update -y
336+
sudo yum install -y "$ADOPTOPENJDK_VERSION"
337+
else
338+
# Add adoptium repo for Amazon Linux 2023 (AL2023 is fedora based)
339+
DISTRIBUTION_NAME="fedora"
340+
MAJOR_VERSION="42"
341+
ARCH="$(uname -m)"
342+
if [ ! -f "/etc/yum.repos.d/adoptium.repo" ]; then
343+
NewFile="/etc/yum.repos.d/adoptium.repo"
344+
(
345+
/bin/cat <<-AMZN_JDK_HERE
346+
[Adoptium]
347+
name=Adoptium
348+
baseurl=https://packages.adoptium.net/artifactory/rpm/${DISTRIBUTION_NAME}/${MAJOR_VERSION}/${ARCH}
349+
enabled=1
350+
gpgcheck=1
351+
gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public
352+
AMZN_JDK_HERE
353+
) >"$NewFile"
354+
fi
355+
sudo dnf update -y
356+
sudo dnf upgrade --security --assumeyes --releasever=latest
357+
sudo dnf install -y "$ADOPTOPENJDK_VERSION" tomcat-native.x86_64 apr fontconfig
333358
fi
334-
sudo yum update -y
335-
sudo yum install -y "$ADOPTOPENJDK_VERSION"
336359
;;
337360

338361
_almalinux)
@@ -679,52 +702,87 @@ function step_postgres_configure() {
679702

680703
case "_$(platform)" in
681704
_amzn)
682-
# Install the Postgresql repository RPM
683-
# note this method is required for AMZN linux and supports PG versions 12-15 - v16 not supported by PG repo
684-
if [[ -z $POSTGRES_VERSION ]]; then
685-
DEFAULT_POSTGRES_VERSION="15"
686-
else
687-
DEFAULT_POSTGRES_VERSION=$POSTGRES_VERSION
688-
fi
705+
# Amazon Linux 2
706+
if [ "$(platform_version)" == "2" ]; then
707+
# Install the Postgresql repository RPM
708+
# note this method is required for AMZN linux and supports PG versions 12-15 - v16 not supported by PG repo
709+
if [[ -z $POSTGRES_VERSION ]]; then
710+
DEFAULT_POSTGRES_VERSION="15"
711+
else
712+
DEFAULT_POSTGRES_VERSION=$POSTGRES_VERSION
713+
fi
689714

690-
if [ ! -f "/etc/yum.repos.d/pgdg.repo" ]; then
691-
NewPGRepoFile="/etc/yum.repos.d/pgdg.repo"
692-
(
693-
/bin/cat <<-PG_REPO_HERE
715+
if [ ! -f "/etc/yum.repos.d/pgdg.repo" ]; then
716+
NewPGRepoFile="/etc/yum.repos.d/pgdg.repo"
717+
(
718+
/bin/cat <<-PG_REPO_HERE
694719
[pgdg$DEFAULT_POSTGRES_VERSION]
695720
name=PostgreSQL $DEFAULT_POSTGRES_VERSION for RHEL/CentOS 7 - x86_64
696721
baseurl=https://download.postgresql.org/pub/repos/yum/$DEFAULT_POSTGRES_VERSION/redhat/rhel-7-x86_64
697722
enabled=1
698723
gpgcheck=0
699724
700725
PG_REPO_HERE
701-
) >"$NewPGRepoFile"
702-
fi
726+
) >"$NewPGRepoFile"
727+
fi
703728

704-
if [ "$POSTGRES_SVR_LOCAL" == "TRUE" ]; then
705-
sudo yum clean metadata
706-
sudo yum update -y
707-
sudo yum install "postgresql$DEFAULT_POSTGRES_VERSION-server" -y
708-
# TODO: These are pre-reqs for Amazon Linux - Move to the pre-reqs function
709-
sudo yum install tomcat-native.x86_64 apr fontconfig -y
729+
if [ "$POSTGRES_SVR_LOCAL" == "TRUE" ]; then
730+
sudo yum clean metadata
731+
sudo yum update -y
732+
sudo yum install "postgresql$DEFAULT_POSTGRES_VERSION-server" -y
733+
# TODO: These are pre-reqs for Amazon Linux - Move to the pre-reqs function
734+
sudo yum install tomcat-native.x86_64 apr fontconfig -y
710735

711-
if [ ! -f "/var/lib/pgsql/data/$DEFAULT_POSTGRES_VERSION" ]; then
712-
"/usr/pgsql-$DEFAULT_POSTGRES_VERSION/bin/postgresql-$DEFAULT_POSTGRES_VERSION-setup" initdb "postgresql-$DEFAULT_POSTGRES_VERSION"
736+
if [ ! -f "/var/lib/pgsql/data/$DEFAULT_POSTGRES_VERSION" ]; then
737+
"/usr/pgsql-$DEFAULT_POSTGRES_VERSION/bin/postgresql-$DEFAULT_POSTGRES_VERSION-setup" initdb "postgresql-$DEFAULT_POSTGRES_VERSION"
738+
fi
739+
sudo systemctl start "postgresql-$DEFAULT_POSTGRES_VERSION"
740+
sudo -u postgres psql -c "create user $POSTGRES_USER password '$POSTGRES_PASSWORD';"
741+
sudo -u postgres psql -c "create database $POSTGRES_DB with owner $POSTGRES_USER;"
742+
sudo -u postgres psql -c "revoke all on database $POSTGRES_DB from public;"
743+
sed -i 's/host all all 127.0.0.1\/32 ident/host all all 127.0.0.1\/32 md5/' "/var/lib/pgsql/$DEFAULT_POSTGRES_VERSION/data/pg_hba.conf"
744+
sudo systemctl restart "postgresql-$DEFAULT_POSTGRES_VERSION"
745+
console_msg "Postgres Server and Client Installed ..."
746+
else
747+
sudo yum clean metadata
748+
sudo yum install "postgresql-client-$DEFAULT_POSTGRES_VERSION" -y
749+
# TODO: These are pre-reqs for Amazon Linux - Move to the pre-reqs function
750+
sudo yum install tomcat-native.x86_64 apr fontconfig -y
751+
console_msg "Postgres Client Installed ..."
713752
fi
714-
sudo systemctl enable "postgresql-$DEFAULT_POSTGRES_VERSION"
715-
sudo systemctl start "postgresql-$DEFAULT_POSTGRES_VERSION"
716-
sudo -u postgres psql -c "create user $POSTGRES_USER password '$POSTGRES_PASSWORD';"
717-
sudo -u postgres psql -c "create database $POSTGRES_DB with owner $POSTGRES_USER;"
718-
sudo -u postgres psql -c "revoke all on database $POSTGRES_DB from public;"
719-
sed -i 's/host all all 127.0.0.1\/32 ident/host all all 127.0.0.1\/32 md5/' "/var/lib/pgsql/$DEFAULT_POSTGRES_VERSION/data/pg_hba.conf"
720-
sudo systemctl restart "postgresql-$DEFAULT_POSTGRES_VERSION"
721-
console_msg "Postgres Server and Client Installed ..."
722753
else
723-
sudo yum clean metadata
724-
sudo yum install "postgresql-client-$DEFAULT_POSTGRES_VERSION" -y
725-
# TODO: These are pre-reqs for Amazon Linux - Move to the pre-reqs function
726-
sudo yum install tomcat-native.x86_64 apr fontconfig -y
727-
console_msg "Postgres Client Installed ..."
754+
# Amazon Linux 2023
755+
if [ "$(platform_version)" == "2023" ]; then
756+
# AL 2023 supports installing Postgresql 15, 16, or 17 from its repo - however, only one version can be installed
757+
# default to v15 unless another version is supplied
758+
if [[ -z $POSTGRES_VERSION ]]; then
759+
DEFAULT_POSTGRES_VERSION="15"
760+
else
761+
DEFAULT_POSTGRES_VERSION=$POSTGRES_VERSION
762+
fi
763+
764+
if [ "$POSTGRES_SVR_LOCAL" == "TRUE" ]; then
765+
sudo dnf install "postgresql$DEFAULT_POSTGRES_VERSION-server" -y
766+
767+
if [ ! -f "/var/lib/pgsql/data/PG_VERSION" ]; then
768+
sudo /usr/bin/postgresql-setup initdb
769+
fi
770+
sudo systemctl enable postgresql
771+
sudo systemctl start postgresql
772+
sudo -u postgres psql -c "create user $POSTGRES_USER password '$POSTGRES_PASSWORD';"
773+
sudo -u postgres psql -c "create database $POSTGRES_DB with owner $POSTGRES_USER;"
774+
sudo -u postgres psql -c "revoke all on database $POSTGRES_DB from public;"
775+
sed -i 's/host all all 127.0.0.1\/32 ident/host all all 127.0.0.1\/32 md5/' "/var/lib/pgsql/data/pg_hba.conf"
776+
sudo systemctl restart postgresql
777+
console_msg "Postgres Server and Client Installed ..."
778+
else
779+
sudo dnf clean metadata
780+
sudo dnf install "postgresql$DEFAULT_POSTGRES_VERSION" -y
781+
console_msg "Postgres Client Installed ..."
782+
fi
783+
else
784+
console_msg "Error: Postgresql install on Amazon Linux version $(platform_version) not supported ..."
785+
fi
728786
fi
729787
;;
730788

sample_embedded_envs.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ export LABKEY_BASE_SERVER_URL="https://localhost"
1111
#export LABKEY_INSTALL_SKIP_REQUIRED_ENVS_STEP=1
1212
#export LABKEY_INSTALL_SKIP_START_LABKEY_STEP=1
1313
export POSTGRES_SVR_LOCAL="TRUE"
14+
# Default POSTGRES version is 15, use this var to specify v16, 17 etc
15+
#export POSTGRES_VERSION="16"
1416

15-
export LABKEY_DIST_URL="https://lk-binaries.s3.us-west-2.amazonaws.com/downloads/release/community/25.3.2/LabKey25.3.2-3-community.tar.gz"
16-
export LABKEY_DIST_FILENAME="LabKey25.3.2-3-community.tar.gz"
17-
export LABKEY_VERSION="25.3.2"
17+
export LABKEY_DIST_URL="https://lk-binaries.s3.us-west-2.amazonaws.com/downloads/release/community/25.7.7/LabKey25.7.7-8-community.tar.gz"
18+
export LABKEY_DIST_FILENAME="LabKey25.7.7-8-community.tar.gz"
19+
export LABKEY_VERSION="25.7.7"
1820
export LABKEY_DISTRIBUTION="community"

0 commit comments

Comments
 (0)