From d51a61fc5f7ad73bc81e4fc02f4ebe031943c7f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20Budiseli=C4=87?= <marko.budiselic@memgraph.com>
Date: Wed, 21 Jun 2023 23:14:37 +0200
Subject: [PATCH] Update dependencies under `environment/os` (#862)

---
 environment/README.md              |  10 ++
 environment/os/.gitignore          |   3 +
 environment/os/amzn-2.sh           |  44 ++++++++-
 environment/os/centos-7.sh         |  44 ++++++++-
 environment/os/centos-9.sh         |  35 ++++++-
 environment/os/debian-10.sh        |  65 ++++++++++++-
 environment/os/debian-11-arm.sh    |  54 ++++++++++-
 environment/os/debian-11.sh        |  56 ++++++++++-
 environment/os/fedora-36.sh        |  60 ++++++++++--
 environment/os/run.sh              | 145 +++++++++++++++++++++++++++++
 environment/os/template.sh         |  11 +++
 environment/os/ubuntu-18.04.sh     |  60 +++++++++++-
 environment/os/ubuntu-20.04.sh     |  61 ++++++++++--
 environment/os/ubuntu-22.04-arm.sh |  56 ++++++++++-
 environment/os/ubuntu-22.04.sh     |  60 ++++++++++--
 environment/util.sh                |  23 +++++
 init                               |   4 +-
 release/package/run.sh             |  18 +++-
 18 files changed, 759 insertions(+), 50 deletions(-)
 create mode 100644 environment/README.md
 create mode 100755 environment/os/run.sh

diff --git a/environment/README.md b/environment/README.md
new file mode 100644
index 000000000..cc9d90073
--- /dev/null
+++ b/environment/README.md
@@ -0,0 +1,10 @@
+# Memgraph Operating Environments
+
+## os
+
+Under the `os` directory, you can find scripts to install all required system
+dependencies on operating systems where Memgraph natively builds. The testing
+script helps to see how to install all packages (in the case of a new package),
+or make any adjustments in the overall system setup. Also, the testing script
+helps check if Memgraph runs on a freshly installed operating system (with no
+packages installed).
diff --git a/environment/os/.gitignore b/environment/os/.gitignore
index 122d85988..d5b44d8f0 100644
--- a/environment/os/.gitignore
+++ b/environment/os/.gitignore
@@ -1,3 +1,6 @@
 *.deb
+*.deb.*
 *.rpm
+*.rpm.*
 *.tar.gz
+*.tar.gz.*
diff --git a/environment/os/amzn-2.sh b/environment/os/amzn-2.sh
index 6df12312c..f2dcc4cc0 100755
--- a/environment/os/amzn-2.sh
+++ b/environment/os/amzn-2.sh
@@ -41,7 +41,7 @@ TOOLCHAIN_RUN_DEPS=(
 
 MEMGRAPH_BUILD_DEPS=(
     git # source code control
-    make # build system
+    make cmake # build system
     wget # for downloading libs
     libuuid-devel java-11-openjdk # required by antlr
     readline-devel # for memgraph console
@@ -57,9 +57,18 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl-devel # mg-requests
     rpm-build rpmlint # for RPM package building
     doxygen graphviz # source documentation generators
-    which nodejs golang zip unzip java-11-openjdk-devel # for driver tests
+    which nodejs golang custom-golang1.18.9 zip unzip java-11-openjdk-devel jdk-17 custom-maven3.9.2 # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
+    cyrus-sasl-devel
+)
+
+MEMGRAPH_RUN_DEPS=(
+    logrotate openssl python3 libseccomp
+)
+
+NEW_DEPS=(
+    wget curl tar gzip
 )
 
 list() {
@@ -73,6 +82,18 @@ check() {
     local OLD_LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-""}
     LD_LIBRARY_PATH=""
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            if [ ! -f "/opt/go1.18.9/go/bin/go" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
         if [ "$pkg" == "PyYAML" ]; then
             if ! python3 -c "import yaml" >/dev/null 2>/dev/null; then
                 missing="$pkg $missing"
@@ -103,8 +124,27 @@ install() {
     else
         echo "NOTE: export LANG=en_US.utf8"
     fi
+
     yum update -y
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            install_custom_maven "3.9.2"
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            install_custom_golang "1.18.9"
+            continue
+        fi
+        if [ "$pkg" == jdk-17 ]; then
+          if ! yum list installed jdk-17 >/dev/null 2>/dev/null; then
+              wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm
+              rpm -Uvh jdk-17_linux-x64_bin.rpm
+              # NOTE: Set Java 11 as default.
+              update-alternatives --set java java-11-openjdk.x86_64
+              update-alternatives --set javac java-11-openjdk.x86_64
+          fi
+          continue
+        fi
         if [ "$pkg" == libipt ]; then
             if ! yum list installed libipt >/dev/null 2>/dev/null; then
                 yum install -y http://repo.okay.com.mx/centos/8/x86_64/release/libipt-1.6.1-8.el8.x86_64.rpm
diff --git a/environment/os/centos-7.sh b/environment/os/centos-7.sh
index 04ba00197..aa6cce77c 100755
--- a/environment/os/centos-7.sh
+++ b/environment/os/centos-7.sh
@@ -39,7 +39,7 @@ TOOLCHAIN_RUN_DEPS=(
 )
 
 MEMGRAPH_BUILD_DEPS=(
-    make pkgconfig # build system
+    make cmake pkgconfig # build system
     curl wget # for downloading libs
     libuuid-devel java-11-openjdk # required by antlr
     readline-devel # for memgraph console
@@ -56,9 +56,19 @@ MEMGRAPH_BUILD_DEPS=(
     sbcl # for custom Lisp C++ preprocessing
     rpm-build rpmlint # for RPM package building
     doxygen graphviz # source documentation generators
-    which mono-complete dotnet-sdk-3.1 golang nodejs zip unzip java-11-openjdk-devel # for driver tests
+    which mono-complete dotnet-sdk-3.1 golang custom-golang1.18.9 # for driver tests
+    nodejs zip unzip java-11-openjdk-devel jdk-17 custom-maven3.9.2 # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
+    cyrus-sasl-devel
+)
+
+MEMGRAPH_RUN_DEPS=(
+    logrotate openssl python3 libseccomp
+)
+
+NEW_DEPS=(
+    wget curl tar gzip
 )
 
 list() {
@@ -68,6 +78,18 @@ list() {
 check() {
     local missing=""
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            if [ ! -f "/opt/go1.18.9/go/bin/go" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
         if [ "$pkg" == git ]; then
             if ! which "git" >/dev/null; then
                 missing="git $missing"
@@ -110,7 +132,25 @@ install() {
     yum update -y
     yum install -y wget python3 python3-pip
     yum install -y git
+
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            install_custom_maven "3.9.2"
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            install_custom_golang "1.18.9"
+            continue
+        fi
+        if [ "$pkg" == jdk-17 ]; then
+            if ! yum list installed jdk-17 >/dev/null 2>/dev/null; then
+                wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm
+                rpm -ivh jdk-17_linux-x64_bin.rpm
+                update-alternatives --set java java-11-openjdk.x86_64
+                update-alternatives --set javac java-11-openjdk.x86_64
+            fi
+            continue
+        fi
         if [ "$pkg" == libipt ]; then
             if ! yum list installed libipt >/dev/null 2>/dev/null; then
                 yum install -y http://repo.okay.com.mx/centos/8/x86_64/release/libipt-1.6.1-8.el8.x86_64.rpm
diff --git a/environment/os/centos-9.sh b/environment/os/centos-9.sh
index e8fd65f2e..c1499f909 100755
--- a/environment/os/centos-9.sh
+++ b/environment/os/centos-9.sh
@@ -40,7 +40,7 @@ TOOLCHAIN_RUN_DEPS=(
 
 MEMGRAPH_BUILD_DEPS=(
     git # source code control
-    make pkgconf-pkg-config # build system
+    make cmake pkgconf-pkg-config # build system
     wget # for downloading libs
     libuuid-devel java-11-openjdk # required by antlr
     readline-devel # for memgraph console
@@ -56,10 +56,20 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl-devel # mg-requests
     rpm-build rpmlint # for RPM package building
     doxygen graphviz # source documentation generators
-    which nodejs golang zip unzip java-11-openjdk-devel # for driver tests
+    which nodejs golang custom-golang1.18.9 # for driver tests
+    zip unzip java-11-openjdk-devel java-17-openjdk java-17-openjdk-devel custom-maven3.9.2 # for driver tests
     sbcl # for custom Lisp C++ preprocessing
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
+    cyrus-sasl-devel
+)
+
+MEMGRAPH_RUN_DEPS=(
+    logrotate openssl python3 libseccomp
+)
+
+NEW_DEPS=(
+    wget curl tar gzip
 )
 
 list() {
@@ -69,6 +79,18 @@ list() {
 check() {
     local missing=""
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            if [ ! -f "/opt/go1.18.9/go/bin/go" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
         if [ "$pkg" == "PyYAML" ]; then
             if ! python3 -c "import yaml" >/dev/null 2>/dev/null; then
                 missing="$pkg $missing"
@@ -103,7 +125,16 @@ install() {
     fi
     yum update -y
     yum install -y wget git python3 python3-pip
+
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            install_custom_maven "3.9.2"
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            install_custom_golang "1.18.9"
+            continue
+        fi
         # Since there is no support for libipt-devel for CentOS 9 we install
         # Fedoras version of same libs, they are the same version but released
         # for different OS
diff --git a/environment/os/debian-10.sh b/environment/os/debian-10.sh
index 5888e3e93..9318ac5df 100755
--- a/environment/os/debian-10.sh
+++ b/environment/os/debian-10.sh
@@ -40,7 +40,7 @@ TOOLCHAIN_RUN_DEPS=(
 
 MEMGRAPH_BUILD_DEPS=(
     git # source code control
-    make pkg-config # build system
+    make cmake pkg-config # build system
     curl wget # for downloading libs
     uuid-dev default-jre-headless # required by antlr
     libreadline-dev # for memgraph console
@@ -53,10 +53,19 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless # for driver tests
-    dotnet-sdk-3.1 golang nodejs npm
+    mono-runtime mono-mcs zip unzip default-jdk-headless oracle-java17-installer custom-maven3.9.2 # for driver tests
+    dotnet-sdk-3.1 golang custom-golang1.18.9 nodejs npm # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
+    libsasl2-dev
+)
+
+MEMGRAPH_RUN_DEPS=(
+    logrotate openssl python3 libseccomp
+)
+
+NEW_DEPS=(
+    wget curl tar gzip
 )
 
 list() {
@@ -64,7 +73,28 @@ list() {
 }
 
 check() {
-    check_all_dpkg "$1"
+    local missing=""
+    for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            if [ ! -f "/opt/go1.18.9/go/bin/go" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if ! dpkg -s "$pkg" >/dev/null 2>/dev/null; then
+            missing="$pkg $missing"
+        fi
+    done
+    if [ "$missing" != "" ]; then
+        echo "MISSING PACKAGES: $missing"
+        exit 1
+    fi
 }
 
 install() {
@@ -75,8 +105,15 @@ deb http://deb.debian.org/debian/ buster-updates main contrib non-free
 deb-src http://deb.debian.org/debian/ buster-updates main contrib non-free
 deb http://security.debian.org/debian-security buster/updates main contrib non-free
 deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
+EOF
+    apt --allow-releaseinfo-change update
+    cat >/etc/apt/sources.list.d/java.list << EOF
+deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main
+deb-src http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main
 EOF
     cd "$DIR"
+    apt install -y gnupg
+    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EA8CACC073C3DB2A
     apt --allow-releaseinfo-change update
     # If GitHub Actions runner is installed, append LANG to the environment.
     # Python related tests doesn't work the LANG export.
@@ -85,8 +122,26 @@ EOF
     else
         echo "NOTE: export LANG=en_US.utf8"
     fi
-    apt install -y wget
+
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            install_custom_maven "3.9.2"
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            install_custom_golang "1.18.9"
+            continue
+        fi
+        if [ "$pkg" == oracle-java17-installer ]; then
+            if ! dpkg -s "$pkg" 2>/dev/null >/dev/null; then
+              echo oracle-java17-installer shared/accepted-oracle-license-v1-3 select true | /usr/bin/debconf-set-selections
+              echo oracle-java17-installer shared/accepted-oracle-license-v1-3 seen true | /usr/bin/debconf-set-selections
+              apt install -y "$pkg"
+              update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
+              update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
+            fi
+            continue
+        fi
         if [ "$pkg" == dotnet-sdk-3.1 ]; then
             if ! dpkg -s "$pkg" 2>/dev/null >/dev/null; then
                 wget -nv https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
diff --git a/environment/os/debian-11-arm.sh b/environment/os/debian-11-arm.sh
index a5a5dfda2..9225ebb11 100755
--- a/environment/os/debian-11-arm.sh
+++ b/environment/os/debian-11-arm.sh
@@ -54,10 +54,19 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless # for driver tests
-    golang nodejs npm
+    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk custom-maven3.9.2 # for driver tests
+    golang custom-golang1.18.9 nodejs npm
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
+    libsasl2-dev
+)
+
+MEMGRAPH_RUN_DEPS=(
+    logrotate openssl python3 libseccomp
+)
+
+NEW_DEPS=(
+    wget curl tar gzip
 )
 
 list() {
@@ -65,7 +74,28 @@ list() {
 }
 
 check() {
-    check_all_dpkg "$1"
+    local missing=""
+    for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            if [ ! -f "/opt/go1.18.9/go/bin/go" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if ! dpkg -s "$pkg" >/dev/null 2>/dev/null; then
+            missing="$pkg $missing"
+        fi
+    done
+    if [ "$missing" != "" ]; then
+        echo "MISSING PACKAGES: $missing"
+        exit 1
+    fi
 }
 
 install() {
@@ -89,7 +119,25 @@ EOF
         echo "NOTE: export LANG=en_US.utf8"
     fi
     apt install -y wget
+
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            install_custom_maven "3.9.2"
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            install_custom_golang "1.18.9"
+            continue
+        fi
+        if [ "$pkg" == openjdk-17-jdk ]; then
+            if ! dpkg -s "$pkg" 2>/dev/null >/dev/null; then
+                apt install -y "$pkg"
+                # The default Java version should be Java 11
+                update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
+                update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
+            fi
+            continue
+        fi
         apt install -y "$pkg"
     done
 }
diff --git a/environment/os/debian-11.sh b/environment/os/debian-11.sh
index d319f58e8..3bd9bde20 100755
--- a/environment/os/debian-11.sh
+++ b/environment/os/debian-11.sh
@@ -41,7 +41,7 @@ TOOLCHAIN_RUN_DEPS=(
 
 MEMGRAPH_BUILD_DEPS=(
     git # source code control
-    make pkg-config # build system
+    make cmake pkg-config # build system
     curl wget # for downloading libs
     uuid-dev default-jre-headless # required by antlr
     libreadline-dev # for memgraph console
@@ -54,10 +54,19 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless # for driver tests
-    dotnet-sdk-3.1 golang nodejs npm
+    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk custom-maven3.9.2 # for driver tests
+    dotnet-sdk-3.1 golang custom-golang1.18.9 nodejs npm
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
+    libsasl2-dev
+)
+
+MEMGRAPH_RUN_DEPS=(
+    logrotate openssl python3 libseccomp
+)
+
+NEW_DEPS=(
+    wget curl tar gzip
 )
 
 list() {
@@ -65,7 +74,28 @@ list() {
 }
 
 check() {
-    check_all_dpkg "$1"
+    local missing=""
+    for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            if [ ! -f "/opt/go1.18.9/go/bin/go" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if ! dpkg -s "$pkg" >/dev/null 2>/dev/null; then
+            missing="$pkg $missing"
+        fi
+    done
+    if [ "$missing" != "" ]; then
+        echo "MISSING PACKAGES: $missing"
+        exit 1
+    fi
 }
 
 install() {
@@ -89,7 +119,25 @@ EOF
         echo "NOTE: export LANG=en_US.utf8"
     fi
     apt install -y wget
+
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            install_custom_maven "3.9.2"
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            install_custom_golang "1.18.9"
+            continue
+        fi
+        if [ "$pkg" == openjdk-17-jdk ]; then
+            if ! dpkg -s "$pkg" 2>/dev/null >/dev/null; then
+                apt install -y "$pkg"
+                # The default Java version should be Java 11
+                update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
+                update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
+            fi
+            continue
+        fi
         if [ "$pkg" == dotnet-sdk-3.1  ]; then
             if ! dpkg -s "$pkg" 2>/dev/null >/dev/null; then
                 wget -nv https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
diff --git a/environment/os/fedora-36.sh b/environment/os/fedora-36.sh
index c59881f65..ef7021afc 100755
--- a/environment/os/fedora-36.sh
+++ b/environment/os/fedora-36.sh
@@ -41,7 +41,7 @@ TOOLCHAIN_RUN_DEPS=(
 
 MEMGRAPH_BUILD_DEPS=(
     git # source code control
-    make pkgconf-pkg-config # build system
+    make cmake pkgconf-pkg-config # build system
     wget # for downloading libs
     libuuid-devel java-11-openjdk # required by antlr
     readline-devel # for memgraph console
@@ -52,10 +52,21 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl-devel # mg-requests
     rpm-build rpmlint # for RPM package building
     doxygen graphviz # source documentation generators
-    which nodejs golang zip unzip java-11-openjdk-devel # for driver tests
+    java-11-openjdk-devel java-17-openjdk-devel custom-maven3.9.2 # for driver tests
+    which zip unzip
+    nodejs golang custom-golang1.18.9 # for driver tests
     sbcl # for custom Lisp C++ preprocessing
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
+    cyrus-sasl-devel
+)
+
+MEMGRAPH_RUN_DEPS=(
+    logrotate openssl python3 libseccomp
+)
+
+NEW_DEPS=(
+    wget curl tar gzip
 )
 
 list() {
@@ -64,11 +75,25 @@ list() {
 
 check() {
     local missing=""
-    # On Fedora yum/dnf and python10 use newer glibc which is not compatible
-    # with ours, so we need to momentarely disable env
-    local OLD_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
-    LD_LIBRARY_PATH=""
+    if [ -v LD_LIBRARY_PATH ]; then
+        # On Fedora yum/dnf and python10 use newer glibc which is not compatible
+        # with ours, so we need to momentarely disable env
+        local OLD_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
+        LD_LIBRARY_PATH=""
+    fi
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            if [ ! -f "/opt/go1.18.9/go/bin/go" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
         if ! dnf list installed "$pkg" >/dev/null 2>/dev/null; then
             missing="$pkg $missing"
         fi
@@ -77,7 +102,10 @@ check() {
         echo "MISSING PACKAGES: $missing"
         exit 1
     fi
-    LD_LIBRARY_PATH=${OLD_LD_LIBRARY_PATH}
+    if [ -v OLD_LD_LIBRARY_PATH ]; then
+        echo "Restoring LD_LIBRARY_PATH..."
+        LD_LIBRARY_PATH=${OLD_LD_LIBRARY_PATH}
+    fi
 }
 
 install() {
@@ -94,7 +122,25 @@ install() {
         echo "NOTE: export LANG=en_US.utf8"
     fi
     dnf update -y
+
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            install_custom_maven "3.9.2"
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            install_custom_golang "1.18.9"
+            continue
+        fi
+        if [ "$pkg" == java-17-openjdk-devel ]; then
+            if ! dnf list installed "$pkg" >/dev/null 2>/dev/null; then
+                dnf install -y "$pkg"
+                # The default Java version should be Java 11
+                update-alternatives --set java java-11-openjdk.x86_64
+                update-alternatives --set javac java-11-openjdk.x86_64
+            fi
+            continue
+        fi
         dnf install -y "$pkg"
     done
 }
diff --git a/environment/os/run.sh b/environment/os/run.sh
new file mode 100755
index 000000000..e7c370f62
--- /dev/null
+++ b/environment/os/run.sh
@@ -0,0 +1,145 @@
+#!/bin/bash
+set -Eeuo pipefail
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+IFS=' '
+# NOTE: docker_image_name could be local image build based on release/package images.
+# NOTE: each line has to be under quotes, docker_container_type, script_name and docker_image_name separate with a space.
+# "docker_container_type script_name docker_image_name"
+OPERATING_SYSTEMS=(
+  "mgrun amzn-2 amazonlinux:2"
+  "mgrun centos-7 centos:7"
+  "mgrun centos-9 dokken/centos-stream-9"
+  "mgrun debian-10 debian:10"
+  "mgrun debian-11 debian:11"
+  "mgrun fedora-36 fedora:36"
+  "mgrun ubuntu-18.04 ubuntu:18.04"
+  "mgrun ubuntu-20.04 ubuntu:20.04"
+  "mgrun ubuntu-22.04 ubuntu:22.04"
+  # "mgbuild centos-7 package-mgbuild_centos-7"
+)
+
+if [ ! "$(docker info)" ]; then
+  echo "ERROR: Docker is required"
+  exit 1
+fi
+print_help () {
+  echo -e "$0 all\t\t\t\t  => start + init all containers in the background"
+  echo -e "$0 check\t\t\t\t  => check all containers"
+  echo -e "$0 delete\t\t\t\t  => stop + remove all containers"
+  echo -e "$0 copy src_container dst_container => copy build package from src to dst container"
+  exit 1
+}
+
+# NOTE: This is an idempotent operation!
+# TODO(gitbuda): Consider making docker_run always delete + start a new container or add a new function.
+docker_run () {
+  cnt_name="$1"
+  cnt_image="$2"
+  if [ ! "$(docker ps -q -f name=$cnt_name)" ]; then
+      if [ "$(docker ps -aq -f status=exited -f name=$cnt_name)" ]; then
+          echo "Cleanup of the old exited container..."
+          docker rm $cnt_name
+      fi
+      docker run -d --volume "$SCRIPT_DIR/../../:/memgraph" --network host --name "$cnt_name" "$cnt_image" sleep infinity
+  fi
+  echo "The $cnt_image container is active under $cnt_name name!"
+}
+
+docker_exec () {
+  cnt_name="$1"
+  cnt_cmd="$2"
+  docker exec -it "$cnt_name" bash -c "$cnt_cmd"
+}
+
+docker_stop_and_rm () {
+  cnt_name="$1"
+  if [ "$(docker ps -q -f name=$cnt_name)" ]; then
+      docker stop "$1"
+      if [ "$(docker ps -aq -f status=exited -f name=$cnt_name)" ]; then
+        docker rm "$1"
+      fi
+  fi
+}
+
+# TODO(gitbuda): Make the call to `install NEW_DEPS` configurable, the question what else is useful?
+start_all () {
+  for script_docker_pair in "${OPERATING_SYSTEMS[@]}"; do
+    read -a script_docker <<< "$script_docker_pair"
+    docker_container_type="${script_docker[0]}"
+    script_name="${script_docker[1]}"
+    docker_image="${script_docker[2]}"
+    docker_name="${docker_container_type}_$script_name"
+    echo ""
+    echo "~~~~ OPERATING ON $docker_image as $docker_name..."
+    docker_run "$docker_name" "$docker_image"
+    docker_exec "$docker_name" "/memgraph/environment/os/$script_name.sh install NEW_DEPS"
+    echo "---- DONE EVERYHING FOR $docker_image as $docker_name..."
+    echo ""
+  done
+}
+
+check_all () {
+  for script_docker_pair in "${OPERATING_SYSTEMS[@]}"; do
+    read -a script_docker <<< "$script_docker_pair"
+    docker_container_type="${script_docker[0]}"
+    script_name="${script_docker[1]}"
+    docker_image="${script_docker[2]}"
+    docker_name="${docker_container_type}_$script_name"
+    echo ""
+    echo "~~~~ OPERATING ON $docker_image as $docker_name..."
+    docker_exec "$docker_name" "/memgraph/environment/os/$script_name.sh check NEW_DEPS"
+    echo "---- DONE EVERYHING FOR $docker_image as $docker_name..."
+    echo ""
+  done
+}
+
+delete_all () {
+  for script_docker_pair in "${OPERATING_SYSTEMS[@]}"; do
+    read -a script_docker <<< "$script_docker_pair"
+    docker_container_type="${script_docker[0]}"
+    script_name="${script_docker[1]}"
+    docker_image="${script_docker[2]}"
+    docker_name="${docker_container_type}_$script_name"
+    docker_stop_and_rm "$docker_name"
+    echo "~~~~ $docker_image as $docker_name DELETED"
+  done
+}
+
+# TODO(gitbuda): Copy file between containers is a useful util, also delete, + consider copying of a whole folder.
+# TODO(gitbuda): Add args: src_cnt dst_cnt abs_path; both file and recursive folder, always delete + copy.
+copy_build_package () {
+  src_container="$1"
+  dst_container="$2"
+  src="$src_container:/memgraph/build/output"
+  tmp_dst="$SCRIPT_DIR/../../build"
+  mkdir -p "$tmp_dst"
+  rm -rf "$tmp_dst/output"
+  dst="$dst_container:/"
+  docker cp "$src" "$tmp_dst"
+  docker cp "$tmp_dst/output" "$dst"
+}
+
+if [ "$#" -eq 0 ]; then
+  print_help
+else
+  case $1 in
+    all)
+      start_all
+    ;;
+    check)
+      check_all
+    ;;
+    delete)
+      delete_all
+    ;;
+    copy) # src_container dst_container
+      if [ "$#" -ne 3 ]; then
+        print_help
+      fi
+      copy_build_package "$2" "$3"
+    ;;
+    *)
+      print_help
+    ;;
+  esac
+fi
diff --git a/environment/os/template.sh b/environment/os/template.sh
index 47c9725fd..b1f2f8fe4 100755
--- a/environment/os/template.sh
+++ b/environment/os/template.sh
@@ -6,6 +6,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 source "$DIR/../util.sh"
 
 check_operating_system "todo-os-name"
+check_architecture "todo-arch-name"
 
 TOOLCHAIN_BUILD_DEPS=(
     pkg
@@ -19,6 +20,16 @@ MEMGRAPH_BUILD_DEPS=(
     pkg
 )
 
+MEMGRAPH_RUN_DEPS=(
+    pkg
+)
+
+# NEW_DEPS is useful when you won't to test the installation of a new package.
+# During the test you can put here packages like wget curl tar gzip
+NEW_DEPS=(
+  pkg
+)
+
 list() {
     echo "$1"
 }
diff --git a/environment/os/ubuntu-18.04.sh b/environment/os/ubuntu-18.04.sh
index dfda2534e..e4b20ae1e 100755
--- a/environment/os/ubuntu-18.04.sh
+++ b/environment/os/ubuntu-18.04.sh
@@ -41,7 +41,7 @@ TOOLCHAIN_RUN_DEPS=(
 
 MEMGRAPH_BUILD_DEPS=(
     git # source code control
-    make pkg-config # build system
+    make cmake pkg-config # build system
     curl wget # downloading libs
     uuid-dev default-jre-headless # required by antlr
     libreadline-dev # memgraph console
@@ -53,9 +53,19 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs nodejs zip unzip default-jdk-headless # driver tests
+    mono-runtime mono-mcs nodejs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.2 # driver tests
+    custom-golang1.18.9 # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
+    libsasl2-dev
+)
+
+MEMGRAPH_RUN_DEPS=(
+    logrotate openssl python3 libseccomp2
+)
+
+NEW_DEPS=(
+    wget curl tar gzip
 )
 
 list() {
@@ -63,11 +73,53 @@ list() {
 }
 
 check() {
-    check_all_dpkg "$1"
+    local missing=""
+    for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            if [ ! -f "/opt/go1.18.9/go/bin/go" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if ! dpkg -s "$pkg" >/dev/null 2>/dev/null; then
+            missing="$pkg $missing"
+        fi
+    done
+    if [ "$missing" != "" ]; then
+        echo "MISSING PACKAGES: $missing"
+        exit 1
+    fi
 }
 
 install() {
-    apt install -y $1
+    apt update -y
+
+    for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            install_custom_maven "3.9.2"
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            install_custom_golang "1.18.9"
+            continue
+        fi
+        if [ "$pkg" == openjdk-17-jdk-headless ]; then
+            if ! dpkg -s "$pkg" 2>/dev/null >/dev/null; then
+                apt install -y "$pkg"
+                # The default Java version should be Java 11
+                update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
+                update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
+            fi
+            continue
+        fi
+        apt install -y "$pkg"
+    done
 }
 
 deps=$2"[*]"
diff --git a/environment/os/ubuntu-20.04.sh b/environment/os/ubuntu-20.04.sh
index f440aff98..5b3fcfcf5 100755
--- a/environment/os/ubuntu-20.04.sh
+++ b/environment/os/ubuntu-20.04.sh
@@ -40,7 +40,7 @@ TOOLCHAIN_RUN_DEPS=(
 
 MEMGRAPH_BUILD_DEPS=(
     git # source code control
-    make pkg-config # build system
+    make cmake pkg-config # build system
     curl wget # for downloading libs
     uuid-dev default-jre-headless # required by antlr
     libreadline-dev # for memgraph console
@@ -53,10 +53,19 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless # for driver tests
-    dotnet-sdk-3.1 golang nodejs npm
+    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.2 # for driver tests
+    dotnet-sdk-3.1 golang custom-golang1.18.9 nodejs npm # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
+    libsasl2-dev
+)
+
+MEMGRAPH_RUN_DEPS=(
+    logrotate openssl python3 libseccomp2
+)
+
+NEW_DEPS=(
+    wget curl tar gzip
 )
 
 list() {
@@ -64,12 +73,35 @@ list() {
 }
 
 check() {
-    check_all_dpkg "$1"
+    local missing=""
+    for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            if [ ! -f "/opt/go1.18.9/go/bin/go" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if ! dpkg -s "$pkg" >/dev/null 2>/dev/null; then
+            missing="$pkg $missing"
+        fi
+    done
+    if [ "$missing" != "" ]; then
+        echo "MISSING PACKAGES: $missing"
+        exit 1
+    fi
 }
 
 install() {
     cd "$DIR"
-    apt update
+    export DEBIAN_FRONTEND=noninteractive
+    apt update -y
+    apt install -y wget
     # If GitHub Actions runner is installed, append LANG to the environment.
     # Python related tests doesn't work the LANG export.
     if [ -d "/home/gh/actions-runner" ]; then
@@ -77,8 +109,16 @@ install() {
     else
         echo "NOTE: export LANG=en_US.utf8"
     fi
-    apt install -y wget
+
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            install_custom_maven "3.9.2"
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            install_custom_golang "1.18.9"
+            continue
+        fi
         if [ "$pkg" == dotnet-sdk-3.1 ]; then
             if ! dpkg -s dotnet-sdk-3.1 2>/dev/null >/dev/null; then
                 wget -nv https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
@@ -88,6 +128,15 @@ install() {
             fi
             continue
         fi
+        if [ "$pkg" == openjdk-17-jdk-headless ]; then
+            if ! dpkg -s "$pkg" 2>/dev/null >/dev/null; then
+                apt install -y "$pkg"
+                # The default Java version should be Java 11
+                update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
+                update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
+            fi
+            continue
+        fi
         apt install -y "$pkg"
     done
 }
diff --git a/environment/os/ubuntu-22.04-arm.sh b/environment/os/ubuntu-22.04-arm.sh
index d3bf8f040..d1e8856e0 100755
--- a/environment/os/ubuntu-22.04-arm.sh
+++ b/environment/os/ubuntu-22.04-arm.sh
@@ -40,7 +40,7 @@ TOOLCHAIN_RUN_DEPS=(
 
 MEMGRAPH_BUILD_DEPS=(
     git # source code control
-    make pkg-config # build system
+    make cmake pkg-config # build system
     curl wget # for downloading libs
     uuid-dev default-jre-headless # required by antlr
     libreadline-dev # for memgraph console
@@ -53,10 +53,19 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless # for driver tests
-    dotnet-sdk-6.0 golang nodejs npm
+    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.2 # for driver tests
+    dotnet-sdk-6.0 golang custom-golang1.18.9 nodejs npm
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
+    libsasl2-dev
+)
+
+MEMGRAPH_RUN_DEPS=(
+    logrotate openssl python3 libseccomp2
+)
+
+NEW_DEPS=(
+    wget curl tar gzip
 )
 
 list() {
@@ -64,7 +73,28 @@ list() {
 }
 
 check() {
-    check_all_dpkg "$1"
+    local missing=""
+    for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            if [ ! -f "/opt/go1.18.9/go/bin/go" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if ! dpkg -s "$pkg" >/dev/null 2>/dev/null; then
+            missing="$pkg $missing"
+        fi
+    done
+    if [ "$missing" != "" ]; then
+        echo "MISSING PACKAGES: $missing"
+        exit 1
+    fi
 }
 
 install() {
@@ -78,7 +108,16 @@ install() {
         echo "NOTE: export LANG=en_US.utf8"
     fi
     apt install -y wget
+
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            install_custom_maven "3.9.2"
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            install_custom_golang "1.18.9"
+            continue
+        fi
         if [ "$pkg" == dotnet-sdk-6.0 ]; then
             if ! dpkg -s dotnet-sdk-6.0 2>/dev/null >/dev/null; then
                 wget -nv https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
@@ -88,6 +127,15 @@ install() {
             fi
             continue
         fi
+        if [ "$pkg" == openjdk-17-jdk-headless ]; then
+            if ! dpkg -s "$pkg" 2>/dev/null >/dev/null; then
+                apt install -y "$pkg"
+                # The default Java version should be Java 11
+                update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
+                update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
+            fi
+            continue
+        fi
         apt install -y "$pkg"
     done
 }
diff --git a/environment/os/ubuntu-22.04.sh b/environment/os/ubuntu-22.04.sh
index 75fffae29..02b659d1d 100755
--- a/environment/os/ubuntu-22.04.sh
+++ b/environment/os/ubuntu-22.04.sh
@@ -40,7 +40,7 @@ TOOLCHAIN_RUN_DEPS=(
 
 MEMGRAPH_BUILD_DEPS=(
     git # source code control
-    make pkg-config # build system
+    make cmake pkg-config # build system
     curl wget # for downloading libs
     uuid-dev default-jre-headless # required by antlr
     libreadline-dev # for memgraph console
@@ -53,10 +53,19 @@ MEMGRAPH_BUILD_DEPS=(
     libcurl4-openssl-dev # mg-requests
     sbcl # for custom Lisp C++ preprocessing
     doxygen graphviz # source documentation generators
-    mono-runtime mono-mcs zip unzip default-jdk-headless # for driver tests
-    dotnet-sdk-6.0 golang nodejs npm
+    mono-runtime mono-mcs zip unzip default-jdk-headless openjdk-17-jdk-headless custom-maven3.9.2 # for driver tests
+    dotnet-sdk-6.0 golang custom-golang1.18.9 nodejs npm # for driver tests
     autoconf # for jemalloc code generation
     libtool  # for protobuf code generation
+    libsasl2-dev
+)
+
+MEMGRAPH_RUN_DEPS=(
+    logrotate openssl python3 libseccomp2
+)
+
+NEW_DEPS=(
+    wget curl tar gzip
 )
 
 list() {
@@ -64,12 +73,34 @@ list() {
 }
 
 check() {
-    check_all_dpkg "$1"
+    local missing=""
+    for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            if [ ! -f "/opt/apache-maven-3.9.2/bin/mvn" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            if [ ! -f "/opt/go1.18.9/go/bin/go" ]; then
+              missing="$pkg $missing"
+            fi
+            continue
+        fi
+        if ! dpkg -s "$pkg" >/dev/null 2>/dev/null; then
+            missing="$pkg $missing"
+        fi
+    done
+    if [ "$missing" != "" ]; then
+        echo "MISSING PACKAGES: $missing"
+        exit 1
+    fi
 }
 
 install() {
     cd "$DIR"
-    apt update
+    apt update -y
+    apt install -y wget
     # If GitHub Actions runner is installed, append LANG to the environment.
     # Python related tests doesn't work the LANG export.
     if [ -d "/home/gh/actions-runner" ]; then
@@ -77,8 +108,16 @@ install() {
     else
         echo "NOTE: export LANG=en_US.utf8"
     fi
-    apt install -y wget
+
     for pkg in $1; do
+        if [ "$pkg" == custom-maven3.9.2 ]; then
+            install_custom_maven "3.9.2"
+            continue
+        fi
+        if [ "$pkg" == custom-golang1.18.9 ]; then
+            install_custom_golang "1.18.9"
+            continue
+        fi
         if [ "$pkg" == dotnet-sdk-6.0 ]; then
             if ! dpkg -s dotnet-sdk-6.0 2>/dev/null >/dev/null; then
                 wget -nv https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
@@ -88,6 +127,15 @@ install() {
             fi
             continue
         fi
+        if [ "$pkg" == openjdk-17-jdk-headless ]; then
+            if ! dpkg -s "$pkg" 2>/dev/null >/dev/null; then
+                apt install -y "$pkg"
+                # The default Java version should be Java 11
+                update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
+                update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
+            fi
+            continue
+        fi
         apt install -y "$pkg"
     done
 }
diff --git a/environment/util.sh b/environment/util.sh
index e2ecf67cf..c6c48cc68 100644
--- a/environment/util.sh
+++ b/environment/util.sh
@@ -76,3 +76,26 @@ function install_all_apt() {
         apt install -y "$pkg"
     done
 }
+
+function install_custom_golang() {
+    # NOTE: The official https://go.dev/doc/manage-install doesn't seem to be working.
+    GOVERSION="$1"
+    GOINSTALLDIR="/opt/go$GOVERSION"
+    GOROOT="$GOINSTALLDIR/go" # GOPATH=$HOME/go
+    if [ ! -f "$GOROOT/bin/go" ]; then
+      curl -LO https://go.dev/dl/go$GOVERSION.linux-amd64.tar.gz
+      mkdir -p "$GOINSTALLDIR"
+      tar -C "$GOINSTALLDIR" -xzf go$GOVERSION.linux-amd64.tar.gz
+    fi
+    echo "go $GOVERSION installed under $GOROOT"
+}
+
+function install_custom_maven() {
+  MVNVERSION="$1"
+  MVNINSTALLDIR="/opt/apache-maven-$MVNVERSION"
+  if [ ! -f "$MVNINSTALLDIR/bin/mvn" ]; then
+    curl -LO "https://dlcdn.apache.org/maven/maven-3/$MVNVERSION/binaries/apache-maven-$MVNVERSION-bin.tar.gz"
+    tar -C "/opt" -xzf "apache-maven-$MVNVERSION-bin.tar.gz"
+  fi
+  echo "maven $MVNVERSION installed under $MVNINSTALLDIR"
+}
diff --git a/init b/init
index bbcd116a3..029160f88 100755
--- a/init
+++ b/init
@@ -77,7 +77,9 @@ fi
 
 # Fix for centos 7 during release
 if [ "${DISTRO}" = "centos-7" ] || [ "${DISTRO}" = "debian-11" ] || [ "${DISTRO}" = "amzn-2" ]; then
-  python3 -m pip uninstall -y virtualenv
+  if python3 -m pip show virtualenv >/dev/null 2>/dev/null; then
+    python3 -m pip uninstall -y virtualenv
+  fi
   python3 -m pip install virtualenv
 fi
 
diff --git a/release/package/run.sh b/release/package/run.sh
index cdf95466a..baaca8f34 100755
--- a/release/package/run.sh
+++ b/release/package/run.sh
@@ -17,7 +17,8 @@ ACTIVATE_TOOLCHAIN="source /opt/${TOOLCHAIN_VERSION}/activate"
 HOST_OUTPUT_DIR="$PROJECT_ROOT/build/output"
 
 print_help () {
-    echo "$0 init|package {os} [--for-docker|--for-platform]|docker|test"
+    # TODO(gitbuda): Update the release/package/run.sh help
+    echo "$0 init|package|docker|test {os} [--for-docker|--for-platform]"
     echo ""
     echo "    OSs: ${SUPPORTED_OS[*]}"
     exit 1
@@ -35,7 +36,7 @@ make_package () {
         package_command=" cpack -G RPM --config ../CPackConfig.cmake && rpmlint --file='../../release/rpm/rpmlintrc' memgraph*.rpm "
     fi
     if [[ "$os" =~ ^"debian".* ]]; then
-        docker exec "$build_container" bash -c "apt update"
+        docker exec "$build_container" bash -c "apt --allow-releaseinfo-change -y update"
         package_command=" cpack -G DEB --config ../CPackConfig.cmake "
     fi
     if [[ "$os" =~ ^"ubuntu".* ]]; then
@@ -64,6 +65,7 @@ make_package () {
         git fetch origin master:master
     fi
     docker exec "$build_container" mkdir -p /memgraph
+    # TODO(gitbuda): Revisit copying the whole repo -> makese sense under CI.
     docker cp "$PROJECT_ROOT/." "$build_container:/memgraph/"
 
     container_build_dir="/memgraph/build"
@@ -74,6 +76,8 @@ make_package () {
     # environment/os/{os}.sh does not come within the toolchain package. When
     # migrating to the next version of toolchain do that, and remove the
     # TOOLCHAIN_RUN_DEPS installation from here.
+    # TODO(gitbuda): On the other side, having this here allows updating deps
+    # wihout reruning the build containers.
     echo "Installing dependencies using '/memgraph/environment/os/$os.sh' script..."
     docker exec "$build_container" bash -c "/memgraph/environment/os/$os.sh install TOOLCHAIN_RUN_DEPS"
     docker exec "$build_container" bash -c "/memgraph/environment/os/$os.sh install MEMGRAPH_BUILD_DEPS"
@@ -83,6 +87,7 @@ make_package () {
     docker exec "$build_container" bash -c "cd /memgraph && git config --global --add safe.directory '*'"
     docker exec "$build_container" bash -c "cd /memgraph && $ACTIVATE_TOOLCHAIN && ./init"
     docker exec "$build_container" bash -c "cd $container_build_dir && rm -rf ./*"
+    # TODO(gitbuda): cmake fails locally if remote is clone via ssh because of the key -> FIX
     if [[ "$os" =~ "-arm" ]]; then
         docker exec "$build_container" bash -c "cd $container_build_dir && $ACTIVATE_TOOLCHAIN && cmake -DCMAKE_BUILD_TYPE=release -DMG_ARCH="ARM64" $telemetry_id_override_flag .."
     else
@@ -108,8 +113,13 @@ make_package () {
 case "$1" in
     init)
         cd "$SCRIPT_DIR"
-        docker-compose build --build-arg TOOLCHAIN_VERSION="${TOOLCHAIN_VERSION}"
-        docker-compose up -d
+        if ! which "docker-compose" >/dev/null; then
+            docker_compose_cmd="docker compose"
+        else
+            docker_compose_cmd="docker-compose"
+        fi
+        $docker_compose_cmd build --build-arg TOOLCHAIN_VERSION="${TOOLCHAIN_VERSION}"
+        $docker_compose_cmd up -d
     ;;
 
     docker)