Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
Script for installing Jenkins
# configure HTTP proxy
export http_proxy=
# install Jenkins
wget -O /etc/yum.repos.d/jenkins.repo
rpm --import
yum -y install jenkins
# set up proxy for plugins
echo "<?xml version='1.0' encoding='UTF-8'?>
</proxy>" > /var/lib/jenkins/proxy.xml
chown jenkins:jenkins /var/lib/jenkins/proxy.xml
# modify Jenkins Maven settings
echo "<?xml version='1.0' encoding='UTF-8'?>
</hudson.tasks.Maven_-DescriptorImpl>" > /var/lib/jenkins/hudson.tasks.Maven.xml
chown jenkins:jenkins /var/lib/jenkins/hudson.tasks.Maven.xml
# install Maven as per
tar xvf apache-maven-3.2.2-bin.tar.gz
mv apache-maven-3.2.2 /usr/local/apache-maven
echo "<settings>
<!--This sends everything else to /public -->
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<!--make the profile active all the time -->
</settings>" > /usr/local/apache-maven/conf/settings.xml
# install git
yum -y install git
# set up persistent environment variables
echo "export http_proxy=
export no_proxy='localhost,'
export M2_HOME=/usr/local/apache-maven
export M2=\$M2_HOME/bin
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-
export GIT_HOME=/usr/bin/git
export PATH=\$PATH:\$M2:\$JAVA_HOME/bin" > /etc/profile.d/
source /etc/profile.d/
# start Jenkins
/sbin/chkconfig jenkins on
/etc/init.d/jenkins start
# allow 8080 connections
/sbin/iptables -I INPUT 5 -p tcp -m state --state NEW --dport 8080 -j ACCEPT
/etc/init.d/iptables save

This comment has been minimized.

Copy link
Owner Author

@jmettes jmettes commented Jul 15, 2014

Installs via RedHat RPM package:

  • creates jenkins user
  • creates init.d service
  • installs Jenkins to /var/lib/jenkins (launch config in /usr/lib/jenkins)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment