Last active
August 29, 2015 14:03
-
-
Save jmettes/d680c886aa3ef9dc6c55 to your computer and use it in GitHub Desktop.
Script for installing Jenkins
This file contains hidden or 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
# configure HTTP proxy | |
export http_proxy=http://rhe-proxy.prod.lan:8080 | |
# install Jenkins | |
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | |
rpm --import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key | |
yum -y install jenkins | |
# set up proxy for plugins | |
echo "<?xml version='1.0' encoding='UTF-8'?> | |
<proxy> | |
<name>rhe-proxy.prod.lan</name> | |
<port>8080</port> | |
<noProxyHost>127.0.0.1 | |
localhost</noProxyHost> | |
<secretPassword>DAEjLylOm9ldIqGpFMEdXw==</secretPassword> | |
<testUrl>http://google.com</testUrl> | |
</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> | |
<installations> | |
<hudson.tasks.Maven_-MavenInstallation> | |
<name>maven-3.2.2</name> | |
<home>/usr/local/apache-maven</home> | |
<properties/> | |
</hudson.tasks.Maven_-MavenInstallation> | |
</installations> | |
</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 http://maven.apache.org/download.cgi#Installation_Instructions | |
/usr/bin/wget http://apache.mirror.serversaustralia.com.au/maven/maven-3/3.2.2/binaries/apache-maven-3.2.2-bin.tar.gz | |
tar xvf apache-maven-3.2.2-bin.tar.gz | |
mv apache-maven-3.2.2 /usr/local/apache-maven | |
echo "<settings> | |
<servers> | |
<server> | |
<id>nexus</id> | |
<username>deployment</username> | |
<password>deployment123</password> | |
</server> | |
</servers> | |
<mirrors> | |
<mirror> | |
<!--This sends everything else to /public --> | |
<id>nexus</id> | |
<mirrorOf>*</mirrorOf> | |
<url>http://10.10.36.14:8081/nexus/content/groups/public</url> | |
</mirror> | |
</mirrors> | |
<profiles> | |
<profile> | |
<id>nexus</id> | |
<!--Enable snapshots for the built in central repo to direct --> | |
<!--all requests to nexus via the mirror --> | |
<repositories> | |
<repository> | |
<id>central</id> | |
<url>http://central</url> | |
<releases><enabled>true</enabled></releases> | |
<snapshots><enabled>true</enabled></snapshots> | |
</repository> | |
</repositories> | |
<pluginRepositories> | |
<pluginRepository> | |
<id>central</id> | |
<url>http://central</url> | |
<releases><enabled>true</enabled></releases> | |
<snapshots><enabled>true</enabled></snapshots> | |
</pluginRepository> | |
</pluginRepositories> | |
</profile> | |
</profiles> | |
<activeProfiles> | |
<!--make the profile active all the time --> | |
<activeProfile>nexus</activeProfile> | |
</activeProfiles> | |
</settings>" > /usr/local/apache-maven/conf/settings.xml | |
# install git | |
yum -y install git | |
# set up persistent environment variables | |
echo "export http_proxy=http://rhe-proxy.prod.lan:8080 | |
export no_proxy='localhost, 127.0.0.1' | |
export M2_HOME=/usr/local/apache-maven | |
export M2=\$M2_HOME/bin | |
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre | |
export GIT_HOME=/usr/bin/git | |
export PATH=\$PATH:\$M2:\$JAVA_HOME/bin" > /etc/profile.d/jenkins.sh | |
source /etc/profile.d/jenkins.sh | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installs via RedHat RPM package:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+RedHat+distributions