Skip to content

Instantly share code, notes, and snippets.

@s-en-o
Last active July 13, 2023 06:50
Show Gist options
  • Save s-en-o/b091acb1c8336a19ad10a22ff47e965d to your computer and use it in GitHub Desktop.
Save s-en-o/b091acb1c8336a19ad10a22ff47e965d to your computer and use it in GitHub Desktop.
Ubuntu bash script to install Jenkins
#!/bin/bash
# Change user as root
sudo su -
# Add Jenkins aptitude key
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
# Add the Jenkins debian repo to the aptitude sources list:
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
# Update the source lists and upgrade any out of date packages:
apt update
apt -y upgrade
# Install the software for the Jenkins master: openjdk-11-jdk, nginx, and jenkins.
# Install JDK and nginx first:
apt -y install fontconfig openjdk-11-jre nginx
# Then install jenkins:
apt -y install jenkins
# Confirm that jenkins and nginx are installed:
systemctl status nginx | grep Active
systemctl status jenkins | grep Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment