1. Environmental preparation
1.1 Install Java
Jenkins depends on Java to run and needs to be installedJDK 8 or JDK 11(Selected according to Jenkins version):
Download JDK:
Install JDK and configure environment variables:
Verify installation:
download
java -version
Oracle JDK 8(Register an account in the historical version)
OpenJDK 8
Create new system variables
JAVA_HOME
, the value is the JDK installation path (such asC:\Program Files\Java\jdk1.8.0_361
)。exist
Path
Added in%JAVA_HOME%\bin
。
2. Download the Jenkins WAR package
-
Visit the official Jenkins repository and select the version (need to be compatible with your Java version):
Supports older versions of Java 8(such as 2.):
/war-stable/2.346.3/New version of Jenkins(Java 11+ required):
/download/→ Select "Generic Java package (.war)"
Will download
Save to local directory (such as
C:\jenkins
)。
3. Run the Jenkins WAR package
3.1 Direct run (temporary test)
Open the command prompt and enterDirectory:
download
cd C:\jenkins
Start Jenkins:
download
java -jar --httpPort=8080
--httpPort
: Specify the port (default8080
, if conflicts can be changed to8081
wait).The console will output the initial administrator password (note it down and use it for later).
Browser access:
http://localhost:8080
3.2 Register as Windows Service (running in the background)
When running the WAR package directly, closing the command line window causes Jenkins to stop. Recommended registration as a system service:
-
Install WinSW (Windows Service Wrapper):
downloadWinSW,choose
.exe
Files (such as)。
Will
Rename to
, and copy to
C:\jenkins
Table of contents.
Create a configuration file:
existC:\jenkins
New file is created, the content is as follows:
download
run
<service> <id>jenkins</id> <name>Jenkins</name> <description>Jenkins CI Server</description> <executable>java</executable> <arguments>-jar "C:\jenkins\" --httpPort=8080</arguments> <logmode>rotate</logmode> <onfailure action="restart" /> </service>
Installation Service:
Open a command prompt as an administrator:
download
cd C:\jenkins install
Start the service:
download
net start jenkins
-
Service status management:
Stop service:
net stop jenkins
Uninstall the service:
uninstall
4. Initialize Jenkins
Browser access
http://localhost:8080
。-
Get the initial administrator password:
The password file path is displayed in the startup log (if it is started through the service, check it
%JENKINS_HOME%\secrets\initialAdminPassword
, the default path isC:\Users\<username>\.jenkins
)。
-
Install plug-ins:
Select the recommended plugin or custom installation.
-
Create an administrator account:
Set username, password, and email.
5. Configure Jenkins
-
Global tool configuration:
Enter
Manage Jenkins > Global Tool Configuration
, configure JDK, Maven, Git and other paths.
-
Plug-in Management:
Install commonly used plug-ins (such as Git, Pipeline, SSH).
6. Frequently Asked Questions
6.1 Port conflict
Modify startup parameters:
download
java -jar --httpPort=8081
6.2 Service startup failed
Check log files:
WinSW's log is locatedC:\jenkins\
。make sure
java
The command isPath
accessible.
6.3 Plug-in installation slow
Replace the domestic mirror source:
EnterManage Jenkins > Manage Plugins > Advanced
。
ReviseUpdate Site
The URL is:
download
/jenkins/updates/
7. Data directory migration (optional)
The default Jenkins data is stored inC:\Users\<username>\.jenkins
. If migration is required:
Stop the Jenkins service.
copy
.jenkins
Folder to a new location (such asD:\jenkins_home
)。Set environment variables
JENKINS_HOME
Point to the new path.Restart the service.
This is all about this article about jenkins-jdk8.0 deployment. For more related jenkins-jdk8.0 deployment content, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!