#!/bin/bash # this script is only tested on ubuntu focal 20.04 (LTS) # install docker sudo apt-get update sudo apt-get install -y \ apt-transport-https \ ca-certificates \ curl \ gnupg \ lsb-release curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io systemctl enable docker systemctl start docker usermod -aG docker ubuntu # run jenkins mkdir -p /var/jenkins_home chown -R 1000:1000 /var/jenkins_home/ docker run -p 8080:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home -d --name jenkins jenkins/jenkins:lts # show endpoint echo 'Jenkins installed' echo 'You should now be able to access jenkins at: http://'$(curl -4 -s ifconfig.co)':8080'