Fix bug for ubuntu 22.
This commit is contained in:
parent
8c87cdb600
commit
845efdcb93
|
@ -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
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue