其他分享
首页 > 其他分享> > Jenkin使用

Jenkin使用

作者:互联网

CI/CD介绍

image

Jenkins

Jenkins是开源CI&CD系统,用于自动化各种任务,包括构建、测试、部署。

Jenkins部署

方式1:tomcat安装
安装jdk和maven

[root@master k8s-ftp]# tar -xvf jdk-8u45-linux-x64.tar.gz
[root@master k8s-ftp]# mv jdk1.8.0_45/ /usr/local/jdk/
[root@master k8s-ftp]# tar -xvf apache-maven-3.5.0-bin.tar.gz
[root@master k8s-ftp]# mv apache-maven-3.5.0 /usr/local/maven
[root@master k8s-ftp]# vi /etc/profile
JAVA_HOME=/usr/local/jdk
PATH=$JAVA_HOME/bin:$PATH:/usr/local/maven/bin
export JAVA_HOME PATH
[root@master k8s-ftp]# source /etc/profile

验证安装
[root@master bin]# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

安装tomcat

[root@master k8s-ftp]# tar -xvf apache-tomcat-8.5.59.tar.gz
[root@master k8s-ftp]# mv apache-tomcat-8.5.59 /usr/local/tomcat-jenkins

[root@master webapps]# ls
docs  examples  host-manager  manager  ROOT
[root@master webapps]# rm -rf *

安装jenkins

把jenkins包放到webapps,然后启动
[root@master webapps]# ls
jenkins.war
[root@master webapps]# mv jenkins.war ROOT.war
[root@master bin]# ./startup.sh
Using CATALINA_BASE:   /usr/local/tomcat-jenkins
Using CATALINA_HOME:   /usr/local/tomcat-jenkins

登录(admin admin)->跳过插件安装
http://192.168.2.60:8080/
方式2:docker安装

[root@slave-1 ~]# docker run -d --name jenkins -p 8080:8080 -p 50000:50000 -u root  -v /opt/jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock  -v /usr/bin/docker:/usr/bin/docker  -v /usr/local/maven:/usr/local/maven  -v /usr/local/jdk:/usr/local/jdk  -v /etc/localtime:/etc/localtime --restart=always --name jenkins jenkins/jenkins:lts
0ce1a84275c241fab428f378af637c7fc29c9e3a9651c1d311d0b6100522affb

Jenkins基本配置

设置清华源
[root@master updates]# pwd
/root/.jenkins/updates
[root@master updates]# sed -i 's/https:\/\/updates.jenkins.io\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json && sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json

离线插件包下载

Jenkins核心功能

标签:Jenkin,local,master,usr,使用,jenkins,k8s,root
来源: https://www.cnblogs.com/scau-zeng/p/15893040.html