Jenkins是什么?
Jenkins是一个开源软件项目百,是基于Java开发的一种持续集成(CI)工具,用于监控持续重复的工作,旨在提供一个开放易用的软件平台,使软件的持续集成变成可能.
Jenkins用Java语言编写,可在Tomcat等流行的servlet容器中运行,也可以独立运行。通常与版本管理工具SVN、Git、Maven、Ant、Gradle搭配使用
Jenkins功能包括
1、持续的软件版本发布/测试项目。
2、监控外部调用执行的工作。
3、部署测试环境
4、跑定时任务(结合自动化测试工具使用)
部署jenkins
部署jenkins首要要有tomcat,tomcat又必须有Java环境,所以先安装java环境和tomcat
[root@localhost ~]# yum -y install java-17-openjdk*
[root@localhost ~]# wget https://get.jenkins.io/war-stable/2.303.2/jenkins.war //下载Jenkins的war包
[root@localhost ~]# wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.54/bin/apache-tomcat-9.0.54.tar.gz //下载tomcat包
[root@localhost ~]# ls
anaconda-ks.cfg apache-tomcat-9.0.54.tar.gz jenkins.war
[root@localhost ~]# tar xf apache-tomcat-9.0.54.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
apache-tomcat-9.0.54 bin etc games include lib lib64 libexec sbin share src
[root@localhost local]# mv apache-tomcat-9.0.54/ jenkins
[root@localhost local]# ls
bin etc games include jenkins lib lib64 libexec sbin share src
[root@localhost local]# cd jenkins/
[root@localhost jenkins]# ls
bin conf lib logs README.md RUNNING.txt webapps
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE RELEASE-NOTES temp work
[root@localhost jenkins]# systemctl disable --now firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost jenkins]# vim /etc/selinux/config
[root@localhost jenkins]# setenforce 0
[root@localhost jenkins]# ./bin/startup.sh //启动
Using CATALINA_BASE: /usr/local/jenkins
Using CATALINA_HOME: /usr/local/jenkins
Using CATALINA_TMPDIR: /usr/local/jenkins/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/jenkins/bin/bootstrap.jar:/usr/local/jenkins/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@localhost jenkins]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 1 [::ffff:127.0.0.1]:8005 *:*
LISTEN 0 100 *:8080 *:*
[root@localhost jenkins]# cd webapps/
[root@localhost webapps]# ls
docs examples host-manager manager ROOT
[root@localhost webapps]# rm -rf docs/ examples/ host-manager/ manager/ //因为这些包没用可以删除
[root@localhost webapps]# ls
ROOT
[root@localhost webapps]# cp ~/jenkins.war . //我们可以把Jenkins看作开发人员开发打包好的包
[root@localhost webapps]# ls
jenkins.war ROOT
访问出现以下界面
//查看密码而后登录
[root@localhost webapps]# cat /root/.jenkins/secrets/initialAdminPassword
7d9e3cf886c3406d947d98be1490eeaf