Offline Jenkins Deployment Guide: Step‑by‑Step Setup and Troubleshooting
This guide explains how to install Jenkins, Java, Maven, and Git in an offline Linux environment, covering required dependencies, downloading and installing packages, configuring tools, adding plugins, handling common errors, and finalizing the Jenkins setup for continuous integration pipelines.
Background
The author previously demonstrated online Jenkins deployment on Windows and now needs to replicate the setup in an offline Linux environment, documenting encountered issues and solutions.
Dependencies
Required offline packages include Ubuntu 20+, Jenkins war 2.426.1, Java (11/17/21), Maven 3.8.8, and Git 2.9.5.
Download Jenkins
Download the Jenkins war from https://get.jenkins.io/war-stable/ (version 2.426.1) and run it with Java.
Install Java
Create a target directory, copy the JDK tarball, extract it, remove the archive, and configure environment variables in /etc/profile :
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export JAVA_HOME=/usr/local/java
export PATH=$PATH:$JAVA_HOME/binReload the profile and verify with java -version .
Start Jenkins
Two start methods are provided:
Direct start: java -jar jenkins.war --httpPort=8082
Background silent start: nohup java -jar jenkins.war --httpPort=8082 >nohup.out 2>&1 &
Access Jenkins at http:// :8082 . If a Fontconfig error occurs, copy the fontconfig.bfc from a Java 8 installation to /usr/local/java/lib .
Configure Maven
Download Maven, extract to /usr/local/maven , and add to /etc/profile :
export M2_HOME=/usr/local/maven
export MAVEN_HOME=/usr/local/maven
export PATH=${M2_HOME}/bin:${PATH}Reload the profile and verify with mvn -version .
Configure Git
Download the Git tarball, extract to /usr/local/git , compile, and add its bin directory to PATH . Verify with git --version .
Install Jenkins Plugins Offline
Since the server has no internet, download plugin .hpi/.jpi files from https://plugins.jenkins.io/ or http://updates.jenkins-ci.org/download/plugins/ and copy them into /home/ /.jenkins/plugins/ , then restart Jenkins.
Configure Global Tools in Jenkins
Set Maven settings, Maven installation path, Java JDK path, and Git executable path via Jenkins “Global Tool Configuration”.
Common Issues and Solutions
Pipeline editor missing due to plugin problems – replace all plugin files with a clean set.
Batch scripts not recognized on Linux – replace bat with sh .
Sudo prompts for password – grant the Jenkins user password‑less sudo in /etc/sudoers ( jenkins ALL=(ALL) NOPASSWD:ALL ).
RoleBasedAuthorizationStrategy errors – revert to a default authorization strategy in ~/.jenkins/config .
Missing plugin dependencies – download required plugins and restart.
Git certificate verification failures – disable SSL verification with git config --global http.sslVerify false .
PATH issues causing sudo not found – ensure /usr/local/sbin:/usr/local/bin precede other entries in /etc/profile .
Timezone offset – set Jenkins timezone to Asia/Shanghai via script console: System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone','Asia/Shanghai') .
Conclusion
The article provides a complete offline deployment process for Jenkins, its plugins, Maven, Java, and Git, along with troubleshooting steps to help readers quickly resolve similar problems.
Wukong Talks Architecture
Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.