|
| 1 | +#! /bin/bash |
| 2 | + |
| 3 | +## This script installs pre-requisites for system-info python modules on Ubuntu's LTS version of OS machines. |
| 4 | +## Easy to use script when initializing either of the systems with Vagrant or in isolation. |
| 5 | + |
| 6 | +## Tested on Ubuntu 16.04 xenial & 18.04 bionic |
| 7 | + |
| 8 | + |
| 9 | +if [ "$(grep -Ei 'ID=ubuntu|VERSION_ID="16.04"' /etc/os-release)" ]; |
| 10 | +then |
| 11 | + echo "OS is Ubuntu." && echo |
| 12 | + if [ "$(grep -Ei 'VERSION_ID="16.04"' /etc/os-release)" ]; |
| 13 | + then |
| 14 | + echo "OS Version is 16.04 i.e. Ubuntu 16.04 xenial. Python 3.5.2 is available by default on the system." && echo |
| 15 | + echo "Beginning of pre-requistes & installation of pip3 and psutil." && echo |
| 16 | + echo "Performing apt-get update" && echo |
| 17 | + sudo apt-get update -y |
| 18 | + sleep 30 |
| 19 | + echo |
| 20 | + echo "Printing the existing Python3's version." && echo |
| 21 | + python3 -V |
| 22 | + echo "Installing Python3's PIP and other tools." && echo |
| 23 | + sudo apt-get install -y python3-pip build-essential libssl-dev libffi-dev python-dev |
| 24 | + echo "Installing psutil library using pip" && echo |
| 25 | + sudo pip3 install psutil # Installing psutil |
| 26 | + sleep 30 |
| 27 | + echo |
| 28 | + echo "Installation of pre-reqs has been completed!" && echo |
| 29 | + elif [ "$(grep -Ei 'VERSION_ID="18.04"' /etc/os-release)" ]; |
| 30 | + then |
| 31 | + echo "OS Version is 18.04 i.e. Ubuntu 18.04 bionic. Python 3.5.2 is available by default on the system." && echo |
| 32 | + echo "Beginning of pre-requistes & installation of pip3 and psutil." && echo |
| 33 | + echo "Performing apt-get update" && echo |
| 34 | + sudo apt-get update -y |
| 35 | + sleep 30 |
| 36 | + echo |
| 37 | + echo "Printing the existing Python3's version." && echo |
| 38 | + python3 -V |
| 39 | + echo "Installing Python3's PIP and other tools." && echo |
| 40 | + sudo apt-get install -y python3-pip build-essential libssl-dev libffi-dev python-dev |
| 41 | + echo "Installing psutil library using pip" && echo |
| 42 | + sudo pip3 install psutil # Installing psutil |
| 43 | + sleep 30 |
| 44 | + echo |
| 45 | + echo "Installation of pre-reqs has been completed!" && echo |
| 46 | + else |
| 47 | + echo "OS is not one of the LTS ubuntu versions." |
| 48 | + fi |
| 49 | +else |
| 50 | + echo "This was scripted for LTS version of Ubuntu OS's. Either the OS/Version is not Ubuntu or a LTS version of OS. Please contact Ali Muhammad (https://github.com/Tech-Overlord) to add the required Ubuntu OS version into the script." |
| 51 | +fi |
| 52 | + |
| 53 | +# if [ "$(grep -Ei 'ID="centos"|CENTOS_MANTISBT_PROJECT_VERSION="7"' /etc/os-release)" ]; |
| 54 | +# then |
| 55 | + # echo |
| 56 | + # echo "OS is CentOS & Version is 7 i.e. CentOS-7" && echo |
| 57 | + # echo "Beginning of pre-requistes & docker installation." && echo |
| 58 | + # echo "Performing update." && echo |
| 59 | + # sudo sudo yum update -y |
| 60 | + # sleep 30 |
| 61 | + # echo |
| 62 | + # echo "Installing yum-utils" && echo |
| 63 | + # sudo yum install yum-utils -y |
| 64 | + # sleep 5 |
| 65 | + # echo |
| 66 | + # echo "Installing IUS" && echo |
| 67 | + # sudo yum install https://centos7.iuscommunity.org/ius-release.rpm -y |
| 68 | + # echo "Installing Python3.6 - Latest stable version at the time of this script's development." && echo |
| 69 | + # sudo yum install python36u -y |
| 70 | + # sleep 30 |
| 71 | + # echo |
| 72 | + # echo "Installing Python 3.6's pip" && echo |
| 73 | + # sudo yum install python36u-pip -y |
| 74 | + # sleep 10 |
| 75 | + # echo "Installing psutil library using pip" && echo |
| 76 | + # sudo pip3.6 install psutil # Installing psutil |
| 77 | + # echo "Installation of pre-reqs has been completed!" && echo |
| 78 | +# fi |
0 commit comments