SHARE
TWEET

Untitled

a guest Sep 11th, 2019 125 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. source rabbitInstaller.conf
  3.  
  4. echo
  5. echo "Script started"
  6. echo _______________
  7. echo
  8.  
  9. #Check if script is run with sudo permissions
  10. if [ "$EUID" -ne 0 ]
  11.     then echo -e "Please run this script as a root \n"&& exit
  12. fi
  13.  
  14. DOCKER_INSTALLED=`docker -v &> /dev/null && echo 1 || echo 0`
  15.  
  16. if [ $DOCKER_INSTALLED = 1 ]
  17.     then
  18.         echo "Docker already installed: "
  19.         docker -v
  20.         echo
  21.         echo "Recommended version is "
  22.         read -p "Do you want to continue [Y/N]: " ANSWER
  23.         if [ $ANSWER != "Y" ] && [ $ANSWER != "y" ]
  24.             then
  25.                 echo
  26.                 echo exit
  27.         fi
  28.     else
  29.         echo
  30.         echo "Executing 'yum install -y yum-utils device-mapper-persistent-data lvm2' command..."
  31.         echo
  32.         yum install -y yum-utils device-mapper-persistent-data lvm2
  33.  
  34.         echo
  35.         echo "Executing 'yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo' command..."
  36.         echo
  37.         yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
  38.  
  39.         echo
  40.         echo "Executing 'yum install -y docker-ce docker-ce-cl containerd.io' command..."
  41.         echo
  42.         yum install -y docker-ce docker-ce-cl containerd.io
  43. fi
  44.  
  45.  
  46. echo
  47. echo "Executing 'systemctl start docker' command..."
  48. echo
  49. systemctl start docker
  50.  
  51. echo
  52. echo "Executing 'docker pull rabbitmq' command..."
  53. echo
  54. docker pull rabbitmq
  55.  
  56. #check if Container with specified name already exists
  57. docker ps -a | grep $CONTAINERNAME && echo -e "\nContainer with this name already exists, exiting.\n" && exit
  58.  
  59. echo
  60. echo "Executing 'docker run -d --hostname $HOSTNAME --name $CONTAINERNAME -p 15672:15672 -p 5671:5671 -p 5672:5672 -p 25672:25672 -p 4369:4369 -e RABBITMQ_DEFAULT_USER=$USER -e RABBITMQ_DEFAULT_PASS=$PASSWORD rabbitmq:3-management' command..."
  61. echo
  62.  
  63.  
  64. docker run -d --hostname $HOSTNAME --name $CONTAINERNAME -p 15672:15672 -p 5671:5671 -p 5672:5672 -p 25672:25672 -p 4369:4369 -e RABBITMQ_DEFAULT_USER=$USER -e RABBITMQ_DEFAULT_PASS=$PASSWORD rabbitmq:3-management || echo -e "\nFailed to run rabbit\n" && exit
  65. echo "Completed"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top