CentOs下面安装jenkins记录

目录

一、安装jenkins

二、进入jenkins

[三、安装和Gitee,Maven , Publish Over SSH等插件](#三、安装和Gitee,Maven , Publish Over SSH等插件)

四、构建一个maven项目



一、安装jenkins

1 wget -O /etc/yum.repos.d/jenkins.repo \ https://pkg.jenkins.io/redhat-stable/jenkins.repo

2 rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

3 yum upgrade

4 yum install jenkins java-11-openjdk.x86_64

5 systemctl start jenkins.service

如启动失败

如上错误是java配置错误,官方安装的本本2.387以上需要jdk11

如有安装其他版本,请卸载,只留下Java11

再关闭防火墙(systemctl stop firewalld)

再次启动:systemctl start jenkins

systemctl status jenkins

说明启动成功

切换源

二、进入jenkins

1 ip:8080

2 cat /var/lib/jenkins/secrets/initialAdminPassword

3 输入密码

4 选择默认插件即可

5 设置管理员

三、安装和Gitee,Maven , Publish Over SSH等插件

更换插件镜像地址,

问题1 启动日志报错:

安装git插件

yum -y install git

问题2:无mvn命令

从官方或者其他途径下载maven

设置maven访问阿里镜像,找到maven的settings.xml文件

vim settings.xml

修改:

<mirror>

<id>nexus-aliyun</id>

<mirrorOf>*</mirrorOf>

<name>Nexus aliyun</name>

<url>http://maven.aliyun.com/nexus/content/groups/public\</url>

</mirror>

添加:<localRepository>/repository/</localRepository>

配置Maven的环境变量

vi /etc/profile

翻到最后一行加上下面的内容,保存退出(注意MAVEN_HOME是实际Maven的路径)

export MAVEN_HOME=/usr/maven/apache-maven-3.5.4

PATH=PATH:MAVEN_HOME/bin

重新加载:source /etc/profile

给运行权限: chmod a+x /usr/maven/apache-maven-3.5.4/bin/mvn

问题3:文件夹不存在

mkdir /repository

chmod 777 /repository

恭喜练成神功第一层

设置maven的setting文件

四、构建一个maven项目

1、设置SSH远程推送文件

2、构建一个Maven任务,并配置项目源

添加执行脚本: clean install -Dmaven.test.skip=true

3、增加构建后操作(Send build artifacts over SSH):前提需要安装此插件Publish Over SSH

参考文章:jenkins编译打包及自动化部署_jenkins打包,发布,部署_guxiaohai_的博客-CSDN博客

相关推荐
轻松Ai享生活19 小时前
5 节课深入学习Linux Cgroups
linux
christine-rr19 小时前
linux常用命令(4)——压缩命令
linux·服务器·redis
三坛海会大神55520 小时前
LVS与Keepalived详解(二)LVS负载均衡实现实操
linux·负载均衡·lvs
東雪蓮☆20 小时前
深入理解 LVS-DR 模式与 Keepalived 高可用集群
linux·运维·服务器·lvs
乌萨奇也要立志学C++20 小时前
【Linux】进程概念(二):进程查看与 fork 初探
linux·运维·服务器
獭.獭.1 天前
Linux -- 信号【上】
linux·运维·服务器
hashiqimiya1 天前
centos配置环境变量jdk
linux·运维·centos
百锦再1 天前
[特殊字符] Python在CentOS系统执行深度指南
开发语言·python·plotly·django·centos·virtualenv·pygame
hashiqimiya1 天前
权限更改centos中系统文件无法创建文件夹,使用命令让普通用户具备操作文件夹
linux
逆小舟1 天前
【Linux】人事档案——用户及组管理
linux·c++