Jenkins 是什么?
Jenkins是一款开源 CI&CD 软件,用于自动化各种任务,包括构建、测试和部署软件。
Jenkins 支持各种运行方式,可通过系统包、Docker 或者通过一个独立的 Java 程序。
Jenkins安装
Jenkins中国官网:https://www.jenkins.io/zh/
//从官网下载Jenkins,然后启动tomcat [root@MF tomcat]# cp ~/jenkins.war jenkins/webapps/ [root@MF tomcat]# ls jenkins/webapps/ docs examples host-manager jenkins.war manager ROOT [root@MF tomcat]# /usr/local/tomcat/jenkins/bin/catalina.sh start Using CATALINA_BASE: /usr/local/tomcat/jenkins Using CATALINA_HOME: /usr/local/tomcat/jenkins Using CATALINA_TMPDIR: /usr/local/tomcat/jenkins/temp Using JRE_HOME: /usr Using CLASSPATH: /usr/local/tomcat/jenkins/bin/bootstrap.jar:/usr/local/tomcat/jenkins/bin/tomcat-juli.jar Using CATALINA_OPTS: Tomcat started.
//使用tomcat9版本安装 [root@MF ~]# ls anaconda-ks.cfg dead.letter zabbix-5.2.6 apache-tomcat-10.0.6.tar.gz index.jsp zabbix-5.2.6.tar.gz apache-tomcat-9.0.46.tar.gz jenkins.war backup.tar.gz lamp [root@MF ~]# tar xf apache-tomcat-9.0.46.tar.gz -C /usr/local/tomcat/ [root@MF ~]# cd /usr/local/tomcat/ [root@MF tomcat]# ls apache-tomcat-9.0.46 jenkins website [root@MF tomcat]# cd apache-tomcat-9.0.46/ [root@MF apache-tomcat-9.0.46]# cd webapps/ [root@MF webapps]# cp ~/jenkins.war . [root@MF webapps]# ls docs examples host-manager jenkins.war manager ROOT [root@MF webapps]# ../bin/catalina.sh start Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-9.0.46 Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-9.0.46 Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-9.0.46/temp Using JRE_HOME: /usr Using CLASSPATH: /usr/local/tomcat/apache-tomcat-9.0.46/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-9.0.46/bin/tomcat-juli.jar Using CATALINA_OPTS: Tomcat started.
Jenkins页面操作
进入页面后可以通过复制里面的代码查找密码
[root@MF jenkins]# cat /root/.jenkins/secrets/initialAdminPassword c7c05d2237c14247a37061d6a16df7c3
选择插件来安装
新手入门可以选默认安装,也可以全部不选。
插件安装
将Jenkins插件改为国内源
系统设置
//配置都在.Jenkins里 [root@MF .jenkins]# ls config.xml hudson.model.UpdateCenter.xml hudson.plugins.emailext.ExtendedEmailPublisher.xml hudson.plugins.git.GitTool.xml identity.key.enc jenkins.install.InstallUtil.installingPlugins jenkins.install.InstallUtil.lastExecVersion jenkins.install.UpgradeWizard.state jenkins.model.JenkinsLocationConfiguration.xml jenkins.telemetry.Correlator.xml jobs //任务 logs //日志 nodeMonitors.xml nodes //节点 plugins //插件 queue.xml.bak secret.key secret.key.not-so-secret secrets //秘密 updates //更新 userContent users //用户 workflow-libs
全局工具配置
全局工具一般情况下需要安装
[root@MF ~]# dnf list all|grep maven directory-maven-plugin.noarch 0.3.1-1.module_el8.2.0+460+6583c1d0 AppStream directory-maven-plugin-javadoc.noarch 0.3.1-1.module_el8.2.0+460+6583c1d0 AppStream maven.noarch 1:3.5.4-5.module_el8.0.0+39+6a9b6e22 AppStream maven-lib.noarch 1:3.5.4- 。。。。。。