Skip to content

Instantly share code, notes, and snippets.

@dnavarrom
Last active May 27, 2018 16:45
Show Gist options
  • Save dnavarrom/2a19396b19be55cc2510fa8168a5acc3 to your computer and use it in GitHub Desktop.
Save dnavarrom/2a19396b19be55cc2510fa8168a5acc3 to your computer and use it in GitHub Desktop.
install Jenkins on Linux mint 18 - then open https://localhost/jenkins
#!/bin/sh
set -e
jenkins_install()
{
wget -q -O - http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key | \
sudo apt-key add -
echo deb http://pkg.jenkins-ci.org/debian-stable binary/ | \
sudo tee /etc/apt/sources.list.d/jenkins.list
sudo apt-get update -y
sudo apt-get install -y jenkins openjdk-8-jdk
cat <<EOF | sudo tee -a /etc/default/jenkins
JENKINS_ARGS="\$JENKINS_ARGS --prefix=\$PREFIX"
JENKINS_ARGS="\$JENKINS_ARGS -Djenkins.install.runSetupWizard=false"
EOF
sudo service jenkins restart
}
apache_install()
{
sudo apt install -y apache2
cat << EOF | sudo tee /etc/apache2/conf-available/jenkins.conf
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /jenkins http://localhost:8080/jenkins
ProxyPassReverse /jenkins http://localhost:8080/jenkins
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
AllowEncodedSlashes NoDecode
<Proxy http://localhost:8080/jenkins>
Order deny,allow
Allow from all
</Proxy>
EOF
for mod in ssl proxy proxy_http headers; do
sudo a2enmod ${mod}
done
sudo a2enconf jenkins
sudo a2ensite default-ssl.conf
sudo service apache2 restart
}
jenkins_main()
{
jenkins_install
apache_install
}
jenkins_main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment