Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering Jenkins

You're reading from  Mastering Jenkins

Product type Book
Published in Oct 2015
Publisher Packt
ISBN-13 9781784390891
Pages 334 pages
Edition 1st Edition
Languages
Authors (2):
jmcallister - jmcallister -
Jonathan McAllister Jonathan McAllister
Profile icon Jonathan McAllister
View More author details

Table of Contents (18) Chapters

Mastering Jenkins
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Setup and Configuration of Jenkins 2. Distributed Builds – Master/Slave Mode 3. Creating Views and Jobs in Jenkins 4. Managing Views and Jobs in Jenkins 5. Advanced Automated Testing 6. Software Deployments and Delivery 7. Build Pipelines 8. Continuous Practices 9. Integrating Jenkins with Other Technologies 10. Extending Jenkins Index

Jenkins on Linux and UNIX


Jenkins offers a wide spectrum of support for the Linux and Unix operating systems. Its cross-platform capabilities have made it a very popular automation tool. The Jenkins community has created native installation packages for most Linux and Unix distributions. Currently, there are installation packages available for the following Linux and Unix flavors:

  • Ubuntu/Debian

  • Red Hat/Fedora/CentOS

  • OpenSUSE

  • FreeBSD

  • Solaris/OpenIndiana

  • Gentoo

  • Docker

The easiest way to install Jenkins on a Linux or Unix system is to use a standard package manager, such as YUM, OpenCSW, IPS, or Aptitude. For the purpose of brevity, we will focus primarily on CentOS (YUM) and Debian oriented (APT) distributions.

Configuring the JVM

On Linux and Unix hosts, configuring the JVM memory parameters involves modifying the service scripts that initialize the Jenkins daemon. For Debian/Ubuntu systems, the file you will need to modify is usually located in /etc/default/Jenkins.

For CentOS-based systems, the file you will need to modify is usually located in /etc/sysconfig/Jenkins.

Regardless of the operating system, the setting that lets us adjust the JVM options is the 'JAVA_ARGS=' property.

With the advent of Java 1.8, as mentioned earlier, there are some new and deprecated memory settings. The definitions of available memory options are described in table below:

Title

Example Arg

Description

Initial heap size

-Xms = 512

Sets the initial Java heap size

Maximum heap size

-Xmx = 1024m

Sets the max Java heap size

Initial permanent generation memory

-XX:PermSize = 512m

Sets the initial available permanent generation memory

Maximum permanent generation memory

-XX:MaxPermSize = 1024m

Sets the highest amount of PermGen memory that can allocated

Maximum metaspace

-XX:MaxMetaspaceSize = 1024m

Sets the max metaspace amount (similar to PermGen, but dynamic by default)

Java memory arguments and descriptions for Linux (same as Windows)

Adjusting the memory setting for Java in Linux is simply a matter of adapting the JAVA_ARGS= property to contain the correct switches. An example of how to change the initial heap size property is shown here:

JAVA_ARGS=-Xmx=512m

Once you have completed the modifications to fit your hardware configuration, you will need to restart the Jenkins service to make it take effect.

Tip

Memory allocation tip

The larger the initial heap and/or maximum heap memory size, the larger the permanent generation memory allocation will need to be. This is because the permanent generation memory stores data about the contents of the heap. These memory settings are designed to let you customize the JVM environment that Jenkins operates in.

You have been reading a chapter from
Mastering Jenkins
Published in: Oct 2015 Publisher: Packt ISBN-13: 9781784390891
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}