jenkins安装

jenkins安装,第1张

jenkins安装 Jenkins

简介

​ Jenkins的前身是Huds,是一个可扩展的持续集成引擎。Jenkins是一个[开源软件]项目,是基于[Java]开发的一种[持续集成]的流程化的工具,用于监控持续重复的工作,旨在提供一个开放易用的软件平台,使软件项目可以进行持续集成

Jenkins的特点:

  • 开源的java语言开发持续集成工具,支持CI,CD;

  • 易于安装部署配置:可通过yum安装,或下载war包以及通过docker容器等快速实现安装部署,可方便web界面配置管理;

  • 消息通知及测试报告:集成RSS/E-mail通过RSS发布构建结果或当构建完成时通过e-mail通知,生成JUnit/TestNG测试报告;

  • 分布式构建:支持Jenkins能够让多台计算机一起构建/测试;

  • 文件识别:Jenkins能够跟踪哪次构建生成哪些jar,哪次构建使用哪个版本的jar等;

  • 丰富的插件支持:支持扩展插件,你可以开发适合自己团队使用的工具,如git,svn,maven,docker等。

安装tomcat

部署jenkins首要要有tomcat,tomcat又必须有Java环境,所以先安装java环境和tomcat

[root@localhost ~]# yum -y install java-17-openjdk*  wget vim 

下载tomcat,解压并创建软连接

wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.54/bin/apache-tomcat-9.0.54.tar.gz

[root@localhost ~]# ls /usr/src/soft/
apache-tomcat-9.0.54.tar.gz
[root@localhost ~]# tar xf /usr/src/soft/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]# ln -sv apache-tomcat-9.0.54 tomcat
'tomcat' -> 'apache-tomcat-9.0.54'

[root@localhost local]# ls
apache-tomcat-9.0.54  bin  etc  games  include  lib  lib64  libexec  sbin  share  src  tomcat

关闭防火墙和selinux

[root@localhost local]# 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 local]# setenforce 0

启动tomcat

[root@localhost local]# /usr/local/tomcat/bin/catalina.sh start
Using CATALINA_base:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.
[root@localhost local]# 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

访问

jenkins的部署

下载Jenkins (官网 jenkins.io)


右键复制链接下载

wget http://mirrors.jenkins.io/war-stable/2.303.2/jenkins.war

停掉tomcat

[root@localhost local]# /usr/local/tomcat/bin/shutdown.sh 
Using CATALINA_base:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
[root@localhost local]# 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

将下载的Jenkins包移到/usr/local/tomcat/webapps/下

[root@localhost soft]# ls
apache-tomcat-9.0.54.tar.gz  jenkins.war
[root@localhost soft]# mv jenkins.war /usr/local/tomcat/webapps/

[root@localhost soft]# ls /usr/local/tomcat/webapps/
ROOT  docs  examples  host-manager  jenkins.war  manager

启动tomcat

[root@localhost soft]# /usr/local/tomcat/bin/startup.sh 
Using CATALINA_base:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.
                            
[root@localhost soft]# 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 soft]# ls /usr/local/tomcat/webapps/
ROOT  docs  examples  host-manager  jenkins(自动解压了)  jenkins.war  manager

查看配置文件

[root@localhost ~]# ls -a 
.  ..  .bash_logout  .bash_profile  .bashrc  .cache  .config  .cshrc  .groovy  .java  .jenkins  .tcshrc  .viminfo  anaconda-ks.cfg

[root@localhost ~]# cd .jenkins/
[root@localhost .jenkins]# ls
config.xml          jenkins.install.UpgradeWizard.state      nodes                  userContent         hudson.model.UpdateCenter.xml         jenkins.model.JenkinsLocationConfiguration.xml  plugins   users
hudson.plugins.emailext.ExtendedEmailPublisher.xml  jenkins.telemetry.Correlator.xml                secret.key                workflow-libs
hudson.plugins.git.GitTool.xml           jobs           secret.key.not-so-secret
identity.key.enc                logs                    secrets
jenkins.install.InstallUtil.lastExecVersion         nodeMonitors.xml               updates

# nodes(多节点时使用)  
# plugins (插件所在目录)
# jobs(浏览器上面创建的任务都会存放在这里)
# secrets(密码秘钥所在目录)
# logs(存放jenkins相关的日志)     jenkins存放数据不依靠数据库,所以在移植时只需要拷贝整个程序主目录即可。

访问

复制web界面的路径,找到密码,复制到web界面,继续

[root@localhost ~]# cat /root/.jenkins/secrets/initialAdminPassword
c87997c56e3344f48ce1caa01497be85










欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4657467.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-06
下一篇 2022-11-06

发表评论

登录后才能评论

评论列表(0条)

保存