Jenkins部署方式之一

Git编译安装

安装依赖

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

官网下载最新版本GIT: 安装git: 解压并cd到解压目录

tar -xvf git-2.9.5.tar.gz
cd git-2.9.5/
make prefix=/usr/local/git all
make prefix=/usr/local/git install

修改环境变量

vim /etcprofile
PATH=$PATH:$HOME/bin:/usr/local/git/bin
source /etc/profile

JAVA环境

jdk百度云 密码:x8oe

 tar -xvf jdk-8u151-linux-x64.tar.gz -C /usr/local
 cd /usr/local/
 mv jdk1.8.0_151   jdk

修改环境变量

vim /etc/profile
JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
source  /etc/profile

Maven环境

官方下载地址: 下载和解压Maven

tar  -xvf apache-maven-3.6.1-bin.tar.gz -C /usr/local/
mv /usr/local/apache-maven-3.6.1/ /usr/local/maven

修改环境变量:

vim /etc/profile
export MAVEN_HOME=/usr/local/maven
export MAVEN_HOME=$MAVEN_HOME/bin
PATH=$MAVEN_HOME:$PATH:$HOME/bin:/usr/local/git/bin
source  /etc/profile

Ant环境

wget http://mirrors.shu.edu.cn/apache//ant/binaries/apache-ant-1.9.13-bin.tar.gz
tar -xvf apache-ant-1.9.13-bin.tar.gz 
cp apache-ant-1.9.13 /usr/local/ant-1.9.13 -rf
ln -s /usr/local/ant-1.9.13 /usr/local/ant

修改环境变量:

vim /etc/profile
export PATH=$PATH:$ANT_HOME/bin
export ANT_HOME=/usr/local/ant
source /etc/profile

Tomcat

官方下载地址:

tar -xvf apache-tomcat-8.5.41.tar.gz -C /usr/local/
mv /usr/local/apache-tomcat-8.5.41 /usr/local/tomcat

环境变量

vim /etc/profile	
CATALINA_HOME=/usr/local/tomcat								//Tomcat安装目录
export CATALINA_HOME
source /etc/profile

Jenkins.war包

部署jenkins.war到tomcat下:

cp jenkins.war  /usr/local/tomcat/webapps/

启动Tomcat 访问:http://127.0.0.1:8080/jenkins 查看密码:

cat /root/.jenkins/secrets/initialAdminPassword

推荐安装项 添加ssh、maven等相关插件

Ansible plugin
Ant Plugin
Blue Ocean
Build Timeout
Email Extension Plugin
Git Parameter Plug-In
Gitlab Hook Plugin
GitLab Plugin
Maven Invoker plugin
Maven Integration plugin
Publish Over SSH
SSH plugin
SSH Slaves plugin
docker

个人网站:https://www.webpages.show/