From 845efdcb938450f1b81481a4a5d7ed65b908cb22 Mon Sep 17 00:00:00 2001 From: bohung Date: Thu, 15 Sep 2022 16:39:48 +0800 Subject: [PATCH] Fix bug for ubuntu 22. --- install_orbit_environment.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/install_orbit_environment.sh b/install_orbit_environment.sh index bde346d..9fb91a4 100644 --- a/install_orbit_environment.sh +++ b/install_orbit_environment.sh @@ -1,12 +1,22 @@ #!/bin/bash ubuntu_version=$(lsb_release -rs) +ubuntu_codename=$(lsb_release -cs) if [[ -e "/etc/needrestart/needrestart.conf" ]]; then sudo sed -E -i "s/(^|#)\\\$nrconf\{restart\}\s*=.*/\$nrconf\{restart\} = 'a';/g" /etc/needrestart/needrestart.conf sudo sed -E -i "s/(^|#)\\\$nrconf\{kernelhints\}\s*=.*/\$nrconf\{kernelhints\} = -1;/g" /etc/needrestart/needrestart.conf fi sudo apt update sudo apt install -y git -sudo apt install -y linux-kernel-headers build-essential +org_pwd=$(pwd) +if [[ $ubuntu_version > '22' ]]; then #In ubuntu 22, install linux-libc-dev instead of linux-kernel-headers + sudo apt install -y linux-libc-dev build-essential +else + sudo apt install -y linux-kernel-headers build-essential +fi +if [[ ! -e "/usr/lib/x86_64-linux-gnu/librt.so" ]]; then + sudo apt install -y libc6 libc6-dev + sudo ln -s /usr/lib/x86_64-linux-gnu/librt.so.1 /usr/lib/x86_64-linux-gnu/librt.so +fi org_pwd=$(pwd) if [[ $ubuntu_version =~ '14' ]]; then sudo apt install libgmp-dev -y @@ -116,7 +126,7 @@ if [[ $ubuntu_version =~ '14' ]]; then else # install mongod 6.0 apt_add_key_func https://www.mongodb.org/static/pgp/server-6.0.asc - if [[ $ubuntu_version =~ '20' ]] || [[ $ubuntu_version =~ '21' ]]; then + if [[ $ubuntu_version > '20' ]]; then sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0-dev_1.0.2n-1ubuntu5_amd64.deb sudo dpkg -i libssl1.0-dev_1.0.2n-1ubuntu5_amd64.deb sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb @@ -152,7 +162,7 @@ else sudo rm -rf /var/lib/mongodb apt_add_key_func https://www.mongodb.org/static/pgp/server-5.0.asc # install mongod 5.0 - if [[ $ubuntu_version =~ '20' ]] || [[ $ubuntu_version =~ '21' ]]; then + if [[ $ubuntu_version > '20' ]]; then sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0-dev_1.0.2n-1ubuntu5_amd64.deb sudo dpkg -i libssl1.0-dev_1.0.2n-1ubuntu5_amd64.deb sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb @@ -185,7 +195,7 @@ else sudo rm -rf /var/log/mongodb sudo rm -rf /var/lib/mongodb apt_add_key_func https://www.mongodb.org/static/pgp/server-4.4.asc - if [[ $ubuntu_version =~ '20' ]] || [[ $ubuntu_version =~ '21' ]]; then + if [[ $ubuntu_version > '20' ]]; then echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list elif [[ $ubuntu_version =~ '18' ]] || [[ $ubuntu_version =~ '19' ]]; then echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list