Created
July 23, 2024 16:21
-
-
Save hassan00dev/68519e275e70bb0f50468706d141189d to your computer and use it in GitHub Desktop.
wget 'file path in raw install_jenkins.sh'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment