Created
September 11, 2016 19:41
-
-
Save Jegp/ca08e012c71e516fa487d73c0d4b47a1 to your computer and use it in GitHub Desktop.
A jenkins installation script
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 installs jenkins on debian based machines | |
## Author: Jegp <jensegholm@protonmail.com> | |
## | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
echo "Installing Jenkins" | |
# Stop running tomcat instances | |
service tomcat* stop &> /dev/null | |
# Add jenkins to repo | |
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add - &> /dev/null | |
sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' | |
apt-get update &> /dev/null | |
# Install Jenkins | |
apt-get install -y jenkins > /dev/null | |
if [[ $? -ne 0 ]]; then | |
echo "Error in installation. Please continue with manual install" | |
exit 2 | |
fi | |
# Print success | |
echo -e "\e[1AInstalling Jenkins complete" | |
echo "---" | |
echo "Congratulations, you now have Jenkins installed." | |
echo "Please continue to configure Jenkins at :8080" | |
echo "Your admin password is: `cat /var/lib/jenkins/secrets/initialAdminPassword`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment