Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS6.8 deployment Tomcat+jenkins+git+maven+ant continuous Integration

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

CentOS 6.8 Deployment Tomcat+jenkins+git+maven+ant Continuous Integration

I. Introduction to Environment:

Operating system: CentOS 6.8 IP: 192.168.1.100

JDK version: jdk1.8.0_101

Tomcat version: tomcat-9.0.0.M21

4. Jenkins Version: Jenkins ver. 2.46.3

git version 2.9.4

Maven Version: 3.5.0

Version 1.10.1

II. Environmental deployment

1. Download the required software package

# mkdir /tmp/soft ; cd /tmp/soft

##### tomcat

# wget http://apache.communilink.net/tomcat/tomcat-9/v9.0.0.M21/bin/apache-tomcat-9.0.0.M21.tar.gz

#####download git

# wget https://www.kernel.org/pub/software/scm/git/git-2.9.4.tar.gz

#####download jdk

#Download address: download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz

#####Download maven

# wget http://ftp.cuhk.edu.hk/pub/packages/apache.org/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz

#####Download Jenkins

# wget http://mirrors.jenkins.io/war/latest/jenkins.war

#####Download ant

# wget http://apache.communilink.net//ant/binaries/apache-ant-1.10.1-bin.tar.gz

2. Install and deploy jdk

###Install all software to/export/servers directory for future management convenience

A. Decompress jdk

# tar -xf jdk-8u131-linux-x64.tar.gz -C /export/servers

b. Configure environmental variables

###Edit the/etc/profile file and add the following information:

# vim /etc/profile

export JAVA_HOME=/export/servers/jdk1.8.0_131

export JAVA_BIN=$JAVA_HOME/bin

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$ JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export JAVA_OPTS="-Djava.library.path=/usr/local/lib -server -Xms1024m -Xmx2048m -XX:MaxPermSize=256m -Djava.awt.headless=true -Dsun.net.client.defaultReadTimeout=60000 -Djmagick.systemclassloader=no -Dnetworkaddress.cache.ttl=300 -Dsun.net.inetaddr.ttl=300"

export JAVA_HOME JAVA_BIN PATH CLASSPATH JAVA_OPTS

c. Test whether the installation is successful

# java -version

java version "1.8.0_131"

Java(TM) SE Runtime Environment (build 1.8.0_131-b11)

Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

3. Install Tomcat

a. Decompress Tomcat

# tar xf apache-tomcat-9.0.0.M21.tar.gz -C /export/servers

# mv /export/servers/apache-tomcat-9.0.0.M21 /export/servers/tomcat-9.0.0.M21

b. Configure tomcat

###Modify Tomcat character set to UTF-8

# vim /export/servers/apache-tomcat-9.0.0.M21/conf/server.xml

#Modify to add URIEncoding as follows:

4. Install Jenkins

a. Clean up tomcat working directory

# cd /export/servers/tomcat-9.0.0.M21/webapps/ROOT/

# rm -rf *

b. unpack jenkins

# cp /tmp/soft/jenkins.war ./

# java -jar jenkins.war

5. Install git

a. Install dependency packages

# cd /tmp/soft

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

b. Install git

# mkdir -p /export/servers/git-2.9.4

# tar -xf git-2.9.4.tar.gz

# make -j 20 prefix=/export/servers/git-2.9.4 all

# make prefix=/export/servers/git-2.9.4 install

c. Configure git environment variables

###Add the following information to the end of/etc/profile:

# vim /etc/profile

export GIT_HOME=/export/servers/git-2.9.4

export PATH=$GIT_HOME/bin:$PATH

6. Install Maven

a. Decompression and installation

# cd /tmp/soft

# tar -xf apache-maven-3.5.0-bin.tar.gz

# mv apache-maven-3.5.0 maven-3.5.0

# mv maven-3.5.0 /export/servers/

b. Configure environmental variables

Add the following information to/etc/profile

# vim /etc/profile

export MAVEN_HOME=/export/servers/maven-3.5.0

export PATH=$PATH:$MAVEN_HOME/bin

7. Install Ant

a. Decompression and installation

# tar xf apache-ant-1.10.1-bin.tar.gz

# mv apache-ant-1.10.1 ant-1.10.1

# mv ant-1.10.1 /export/servers/

b. Configure environmental variables

Add the following information to/etc/profile

# vim /etc/profile

export ANT_HOME=/export/servers/ant-1.10.1

export PATH=$PATH:/export/servers/ant-1.10.1/bin

III. Testing and Start-up Services

1. Testing JDK

# java -version

java version "1.8.0_131"

Java(TM) SE Runtime Environment (build 1.8.0_131-b11)

Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

2. Test git

# git version

git version 2.9.4

3. Testing maven

# mvn -v

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)

Maven home: /export/servers/maven-3.5.0

Java version: 1.8.0_101, vendor: Oracle Corporation

Java home: /export/servers/jdk1.8.0_131/jre

Default locale: en_US, platform encoding: UTF-8

OS name: "linux", version: "2.6.32-642.el6.x86_64", arch: "amd64", family: "unix"

Testing Tomcat and Jenkins

# cd /export/servers/tomcat-9.0.0.M21/bin

# /bin/sh startup.sh

# tailf ../ logs/catalina.out

###You can check the log to see if there is an Error

5. Add startup Tomcat

# echo "/bin/sh /export/servers/tomcat-9.0.0.M21/bin/startup.sh" >> /etc/rc.d/rc.local

IV. Web login test

1. Check Jenkins 'initial password first

# cat /root/.jenkins/secret.key

10d886523c3e33c549c0db32b035f887476097229529f22c4d36327387fc0900

#####Copy this password, which will be used the first time you open a Web page

2. Login to Jenkins

Open the browser----> Enter http://www.example.com in the address bar 192.168.1.100:8080

At this point, Jenkins deployment has been completed, if you have any questions can send an email to: DBA_Master@163.com

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report