centos7.x安装jenkins

前端之家收集整理的这篇文章主要介绍了centos7.x安装jenkins前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
#jdk
tar-zxfjdk-8u131-linux-x64.tar.gz-C/usr/local/
echo"exportJAVA_HOME=/usr/local/jdk1.8.0_131">>/etc/profile
#echo"exportPATH=$PATH:$JAVA_HOME/bin">>/etc/profile
ln-sf$JAVA_HOME/bin/java/usr/bin/java
#maven安装
####http://maven.apache.org/download.cgi
wgethttp://mirrors.hust.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
tar-zxfapache-maven-3.3.9-bin.tar.gz-C/usr/local/
echo"exportMAVEN_HOME=/usr/local/apache-maven-3.3.9">>/etc/profile
#RedHatLinuxRPMpackagesforJenkins安装稳定版Jenkins2.46.3
sudowget-O/etc/yum.repos.d/jenkins.repohttps://pkg.jenkins.io/redhat-stable/jenkins.repo
sudorpm--importhttps://pkg.jenkins.io/redhat-stable/jenkins.io.key
#安装
yuminstalljenkinsgit-y

#更改默认端口8080改为8000
#vim/etc/sysconfig/jenkins
sed-i's#JENKINS_PORT=\"8080\"#JENKINS_PORT=\"8000\"#'/etc/sysconfig/jenkins

#/usr/lib/jenkins/安装目录
#/var/lib/jenkins/工作目录

#添加JENKINS_HOME
#vim/etc/profile
echo"exportJENKINS_HOME=/var/lib/jenkins">>/etc/profile
echo"exportPATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin">>/etc/profile

./etc/profile

#sudosystemctlenablejenkins
#sudosystemctlrestartjenkins
#开机启动
chkconfigjenkinson
servicejenkinsstart
#查看日志
sudotail-f/var/log/jenkins/jenkins.log

#Disablethefirewall
firewall-cmd--zone=public--add-port=8080/tcp--permanent
firewall-cmd--zone=public--add-service=http--permanent
firewall-cmd--reload
firewall-cmd--list-all

#查看jenkins初始化密码
[root@dev~]#cat/var/lib/jenkins/secrets/initialAdminPassword
#GlobalToolConfiguration
#JDK
别名jdk1.8.0_131
JAVA_HOME/usr/local/jdk1.8.0_131

#git
name:gitversion1.8.3.1
PathtoGitexecutable:	/usr/bin/git
#设置安全性
使用矩形安全策略
#配置完毕需要重启服务
systemctlrestartjenkins




卸载jenkins

#卸载:如果要重装,或者本机不需要Jenkins,可卸载:
sudosystemctlstopjenkins
sudosystemctldisablejenkins
sudoyum-yremovejenkins
sudorm-rf/var/{lib,log,cache}/jenkins/usr/lib/jenkins/root/.jenkins
sudorm-rf`sudofind/{etc,var,run}-name"jenkins*"`

实用插件

iOS专用:Xcode integration

Android专用:Gradle plugin

Gitlab插件:GitLab Plugin 和 Gitlab Hook Plugin

Git插件: Git plugin

GitBuckit插件: GitBuckit plugin

签名证书管理插件: Credentials Plugin 和Keychains and Provisioning Profiles Management

FTP插件: Publish over FTP

脚本插件: Post-Build Script Plug-in

修改Build名称/描述(二维码): build-name-setter / description setter plugin

获取仓库提交的commit log: Git Changelog Plugin

自定义全局变量: Environment Injector Plugin

自定义邮件插件: Email Extension Plugin

获取当前登录用户信息: build-user-vars-plugin

显示代码测试覆盖率报表: Cobertura Plugin

来展示生成的单元测试报表,支持一切单测框架,如junit、nosetests等: Junit Plugin

其它: GIT plugin / SSH Credentials Plugin

插件:Publish Over SSH ssh连接其他Linux机器

添加时间戳:Timestamper

输出样式: AnsiColor

自动配置语言: Locale plugin

前端nodejs: NodeJS Plugin

查看job配置历史:Job Configuration History Plugin

清理工作空间:Workspace Cleanup Plugin


#Jenkins安装目录和程序路径
#/etc/init.d/jenkins
#/etc/sysconfig/jenkins
JENKINS_WAR="/usr/lib/jenkins/jenkins.war"
JENKINS_CONFIG=/etc/sysconfig/jenkins
JENKINS_PID_FILE="/var/run/jenkins.pid"
#添加密钥关联gitlab
mkdir/var/lib/jenkins/.ssh
#chownjenkinsid_rsa.pub
#chownjenkinsid_rsa
[root@jenkins.ssh]#cat/var/lib/jenkins/.ssh/config
#GitLab.comserver
Host139.159.xx.xx
RSAAuthenticationyes
IdentityFile/var/lib/jenkins/.ssh/jenkins.rsa
sudochown-Rjenkins/var/lib/jenkins/.ssh/
gitls-remote-hgit@github.com:adolfosrs/jenkins-test.gitHEAD

参考:

https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions

https://pkg.jenkins.io/redhat-stable/ rpm包下载地址

https://wiki.jenkins-ci.org/display/JENKINS/Offline+Jenkins+Installation 离线文档

原文链接:https://www.f2er.com/centos/376934.html

猜你在找的CentOS相关文章