Centos jenkins is automatically deployed to the tomcat container

Jenkins installation: Official download address: https://jenkins.io/download/ Download what you need as needed

#1. Download the installation package, do not need the latest version, the latest version has problems

wget  https://pkg.jenkins.io/redhat-stable/jenkins-2.60.3-1.1.noarch.rpm

#2. Installation

rpm -i  jenkins-2.60.3-1.1.noarch.rpm

#3 Start the jenkins service

systemctl  start  jenkins

Service started successfully:

Visit localhost:8080 to enter the jenkins page

According to the prompt, there is the initial password of the administrator in /var/lib/jenkins/secrets/initialAdminPassword

Login to enter:

1. Forgot administrator password solution

In the following directory there is an existing jenkins user folder whose name is the login name

1.cd /var/lib/jenkins/users/

2. Edit the configuration file vi/var/lib/jenkins/users/aidan/config.xml

找到<passwordHash></passwordHash>

Change the value to:

#jbcrypt:$2a$10$DdaWzN64JgUtLdvxWIflcuQu2fgrrMSAMabF5TSrGK5nXitqK9ZMS

The login password is 111111

systemctl restart jenkins #Restart login

2. Jenkins configuration file introduction

vi /etc/init.d/jenkins

candidates="

/etc/alternatives/java

/usr/lib/jvm/java-1.8.0/bin/java

/usr/lib/jvm/jre-1.8.0/bin/java

/usr/lib/jvm/java-1.7.0/bin/java

/usr/lib/jvm/jre-1.7.0/bin/java

/usr/bin/java

"

#Add the jdk installed by yourself in the last line

vi /etc/sysconfig/jenkins

Port number can be modified

3. Problem: jenkins calls mvn not found mvn command

Modify: The parameter in /etc/sysconfig/jenkins is changed to root

JENKINS_USER="root"

4. Configure maven

5. Git installation

1. Install dependent packages

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

2. Download the source package

wget  https://github.com/git/git/releases/tag/v2.11.0

tar zxvf git-2.11.0.tar.gz

cd git-2.11.0

3 Compile and install
make prefix=/usr/local/git all
make prefix=/usr/local/git install

4 View git
whereis git
git --version

5 Configure the environment variable
vim /etc/profile and
add export PATH=$PATH:/usr/local/git/bin to the
effective configuration file source /etc/profile

 

6. Global configuration plugin configuration

1.Maven

Manage Jenkins->GlobalTool Configuration

The configuration of the setting file in Maven, you can also choose use default maven setting

Name can be taken at will, it is best to add the version

MAVEN_HEME is the environment variable set when installing maven on this machine

2.JDK

Name can be taken at will, it is best to add the version

JAVA_HOME is the environment variable set when installing jdk on this machine

3.Git

Path to git executable is the installation path of git, which only needs to be the executable file git in linux

4. Plug-in installation



Create Project Choose Freestyle


Project configuration






WAR/EAR files fill in the name of your target/your war package

Context path Fill in the access path as above and visit http://localhost:8080 /AgilentSolr

Tomcat URL Fill in the path to access the tomcat home page, such as http://localhost:8080

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326174825&siteId=291194637