diff --git a/install-labkey.bash b/install-labkey.bash index 968e73d..b3677a3 100755 --- a/install-labkey.bash +++ b/install-labkey.bash @@ -317,11 +317,12 @@ function step_os_prereqs() { case "_$(platform)" in _amzn) # amzn stuff goes here - # Add adoptium repo - if [ ! -f "/etc/yum.repos.d/adoptium.repo" ]; then - NewFile="/etc/yum.repos.d/adoptium.repo" - ( - /bin/cat <<-AMZN_JDK_HERE + # For versions of Amazon Linux prior to 2023 - Add adoptium repo + if [ "$(platform_version)" == "2" ]; then + if [ ! -f "/etc/yum.repos.d/adoptium.repo" ]; then + NewFile="/etc/yum.repos.d/adoptium.repo" + ( + /bin/cat <<-AMZN_JDK_HERE [Adoptium] name=Adoptium baseurl=https://packages.adoptium.net/artifactory/rpm/amazonlinux/\$releasever/\$basearch @@ -329,10 +330,32 @@ function step_os_prereqs() { gpgcheck=1 gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public AMZN_JDK_HERE - ) >"$NewFile" + ) >"$NewFile" + fi + sudo yum update -y + sudo yum install -y "$ADOPTOPENJDK_VERSION" + else + # Add adoptium repo for Amazon Linux 2023 (AL2023 is fedora based) + DISTRIBUTION_NAME="fedora" + MAJOR_VERSION="42" + ARCH="$(uname -m)" + if [ ! -f "/etc/yum.repos.d/adoptium.repo" ]; then + NewFile="/etc/yum.repos.d/adoptium.repo" + ( + /bin/cat <<-AMZN_JDK_HERE + [Adoptium] + name=Adoptium + baseurl=https://packages.adoptium.net/artifactory/rpm/${DISTRIBUTION_NAME}/${MAJOR_VERSION}/${ARCH} + enabled=1 + gpgcheck=1 + gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public + AMZN_JDK_HERE + ) >"$NewFile" + fi + sudo dnf update -y + sudo dnf upgrade --security --assumeyes --releasever=latest + sudo dnf install -y "$ADOPTOPENJDK_VERSION" tomcat-native.x86_64 apr fontconfig fi - sudo yum update -y - sudo yum install -y "$ADOPTOPENJDK_VERSION" ;; _almalinux) @@ -679,18 +702,20 @@ function step_postgres_configure() { case "_$(platform)" in _amzn) - # Install the Postgresql repository RPM - # note this method is required for AMZN linux and supports PG versions 12-15 - v16 not supported by PG repo - if [[ -z $POSTGRES_VERSION ]]; then - DEFAULT_POSTGRES_VERSION="15" - else - DEFAULT_POSTGRES_VERSION=$POSTGRES_VERSION - fi + # Amazon Linux 2 + if [ "$(platform_version)" == "2" ]; then + # Install the Postgresql repository RPM + # note this method is required for AMZN linux and supports PG versions 12-15 - v16 not supported by PG repo + if [[ -z $POSTGRES_VERSION ]]; then + DEFAULT_POSTGRES_VERSION="15" + else + DEFAULT_POSTGRES_VERSION=$POSTGRES_VERSION + fi - if [ ! -f "/etc/yum.repos.d/pgdg.repo" ]; then - NewPGRepoFile="/etc/yum.repos.d/pgdg.repo" - ( - /bin/cat <<-PG_REPO_HERE + if [ ! -f "/etc/yum.repos.d/pgdg.repo" ]; then + NewPGRepoFile="/etc/yum.repos.d/pgdg.repo" + ( + /bin/cat <<-PG_REPO_HERE [pgdg$DEFAULT_POSTGRES_VERSION] name=PostgreSQL $DEFAULT_POSTGRES_VERSION for RHEL/CentOS 7 - x86_64 baseurl=https://download.postgresql.org/pub/repos/yum/$DEFAULT_POSTGRES_VERSION/redhat/rhel-7-x86_64 @@ -698,33 +723,66 @@ function step_postgres_configure() { gpgcheck=0 PG_REPO_HERE - ) >"$NewPGRepoFile" - fi + ) >"$NewPGRepoFile" + fi - if [ "$POSTGRES_SVR_LOCAL" == "TRUE" ]; then - sudo yum clean metadata - sudo yum update -y - sudo yum install "postgresql$DEFAULT_POSTGRES_VERSION-server" -y - # TODO: These are pre-reqs for Amazon Linux - Move to the pre-reqs function - sudo yum install tomcat-native.x86_64 apr fontconfig -y + if [ "$POSTGRES_SVR_LOCAL" == "TRUE" ]; then + sudo yum clean metadata + sudo yum update -y + sudo yum install "postgresql$DEFAULT_POSTGRES_VERSION-server" -y + # TODO: These are pre-reqs for Amazon Linux - Move to the pre-reqs function + sudo yum install tomcat-native.x86_64 apr fontconfig -y - if [ ! -f "/var/lib/pgsql/data/$DEFAULT_POSTGRES_VERSION" ]; then - "/usr/pgsql-$DEFAULT_POSTGRES_VERSION/bin/postgresql-$DEFAULT_POSTGRES_VERSION-setup" initdb "postgresql-$DEFAULT_POSTGRES_VERSION" + if [ ! -f "/var/lib/pgsql/data/$DEFAULT_POSTGRES_VERSION" ]; then + "/usr/pgsql-$DEFAULT_POSTGRES_VERSION/bin/postgresql-$DEFAULT_POSTGRES_VERSION-setup" initdb "postgresql-$DEFAULT_POSTGRES_VERSION" + fi + sudo systemctl start "postgresql-$DEFAULT_POSTGRES_VERSION" + sudo -u postgres psql -c "create user $POSTGRES_USER password '$POSTGRES_PASSWORD';" + sudo -u postgres psql -c "create database $POSTGRES_DB with owner $POSTGRES_USER;" + sudo -u postgres psql -c "revoke all on database $POSTGRES_DB from public;" + 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" + sudo systemctl restart "postgresql-$DEFAULT_POSTGRES_VERSION" + console_msg "Postgres Server and Client Installed ..." + else + sudo yum clean metadata + sudo yum install "postgresql-client-$DEFAULT_POSTGRES_VERSION" -y + # TODO: These are pre-reqs for Amazon Linux - Move to the pre-reqs function + sudo yum install tomcat-native.x86_64 apr fontconfig -y + console_msg "Postgres Client Installed ..." fi - sudo systemctl enable "postgresql-$DEFAULT_POSTGRES_VERSION" - sudo systemctl start "postgresql-$DEFAULT_POSTGRES_VERSION" - sudo -u postgres psql -c "create user $POSTGRES_USER password '$POSTGRES_PASSWORD';" - sudo -u postgres psql -c "create database $POSTGRES_DB with owner $POSTGRES_USER;" - sudo -u postgres psql -c "revoke all on database $POSTGRES_DB from public;" - 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" - sudo systemctl restart "postgresql-$DEFAULT_POSTGRES_VERSION" - console_msg "Postgres Server and Client Installed ..." else - sudo yum clean metadata - sudo yum install "postgresql-client-$DEFAULT_POSTGRES_VERSION" -y - # TODO: These are pre-reqs for Amazon Linux - Move to the pre-reqs function - sudo yum install tomcat-native.x86_64 apr fontconfig -y - console_msg "Postgres Client Installed ..." + # Amazon Linux 2023 + if [ "$(platform_version)" == "2023" ]; then + # AL 2023 supports installing Postgresql 15, 16, or 17 from its repo - however, only one version can be installed + # default to v15 unless another version is supplied + if [[ -z $POSTGRES_VERSION ]]; then + DEFAULT_POSTGRES_VERSION="15" + else + DEFAULT_POSTGRES_VERSION=$POSTGRES_VERSION + fi + + if [ "$POSTGRES_SVR_LOCAL" == "TRUE" ]; then + sudo dnf install "postgresql$DEFAULT_POSTGRES_VERSION-server" -y + + if [ ! -f "/var/lib/pgsql/data/PG_VERSION" ]; then + sudo /usr/bin/postgresql-setup initdb + fi + sudo systemctl enable postgresql + sudo systemctl start postgresql + sudo -u postgres psql -c "create user $POSTGRES_USER password '$POSTGRES_PASSWORD';" + sudo -u postgres psql -c "create database $POSTGRES_DB with owner $POSTGRES_USER;" + sudo -u postgres psql -c "revoke all on database $POSTGRES_DB from public;" + 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" + sudo systemctl restart postgresql + console_msg "Postgres Server and Client Installed ..." + else + sudo dnf clean metadata + sudo dnf install "postgresql$DEFAULT_POSTGRES_VERSION" -y + console_msg "Postgres Client Installed ..." + fi + else + console_msg "Error: Postgresql install on Amazon Linux version $(platform_version) not supported ..." + fi fi ;; diff --git a/sample_embedded_envs.sh b/sample_embedded_envs.sh index ec40954..729a75e 100755 --- a/sample_embedded_envs.sh +++ b/sample_embedded_envs.sh @@ -11,8 +11,10 @@ export LABKEY_BASE_SERVER_URL="https://localhost" #export LABKEY_INSTALL_SKIP_REQUIRED_ENVS_STEP=1 #export LABKEY_INSTALL_SKIP_START_LABKEY_STEP=1 export POSTGRES_SVR_LOCAL="TRUE" +# Default POSTGRES version is 15, use this var to specify v16, 17 etc +#export POSTGRES_VERSION="16" -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" -export LABKEY_DIST_FILENAME="LabKey25.3.2-3-community.tar.gz" -export LABKEY_VERSION="25.3.2" +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" +export LABKEY_DIST_FILENAME="LabKey25.7.7-8-community.tar.gz" +export LABKEY_VERSION="25.7.7" export LABKEY_DISTRIBUTION="community"