#jdktar -zxf jdk-8u131-linux-x64.tar.gz -C /usr/local/echo "export JAVA_HOME=/usr/local/jdk1.8.0_131" >> /etc/profile#echo "export PATH=$PATH:$JAVA_HOME/bin" >> /etc/profileln -sf $JAVA_HOME/bin/java /usr/bin/java
#maven安装#### http://maven.apache.org/download.cgiwget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gztar -zxf apache-maven-3.3.9-bin.tar.gz  -C /usr/local/echo "export MAVEN_HOME=/usr/local/apache-maven-3.3.9" >> /etc/profile
#RedHat Linux RPM packages for Jenkins 安装稳定版Jenkins 2.46.3sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.reposudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key#安装yum install jenkins git -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/profileecho "export JENKINS_HOME=/var/lib/jenkins" >> /etc/profileecho "export PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin" >> /etc/profile. /etc/profile#sudo systemctl enable jenkins#sudo systemctl restart jenkins#开机启动chkconfig jenkins onservice jenkins start#查看日志sudo tail -f /var/log/jenkins/jenkins.log#Disable the firewallfirewall-cmd --zone=public --add-port=8080/tcp --permanentfirewall-cmd --zone=public --add-service=http --permanentfirewall-cmd --reloadfirewall-cmd --list-all#查看jenkins初始化密码[root@dev ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
#Global Tool Configuration#JDK别名 jdk1.8.0_131JAVA_HOME /usr/local/jdk1.8.0_131#gitname: git version 1.8.3.1Path to Git executable:	/usr/bin/git
#设置安全性使用矩形安全策略
#配置完毕需要重启服务systemctl restart jenkins

卸载jenkins

#卸载:如果要重装,或者本机不需要 Jenkins,可卸载:sudo systemctl stop jenkinssudo systemctl disable jenkinssudo yum -y remove jenkinssudo rm -rf /var/{lib,log,cache}/jenkins /usr/lib/jenkins /root/.jenkinssudo rm -rf `sudo find /{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/jenkinsJENKINS_PID_FILE="/var/run/jenkins.pid"
#添加密钥关联gitlabmkdir /var/lib/jenkins/.ssh#chown jenkins id_rsa.pub #chown jenkins id_rsa[root@jenkins .ssh]# cat /var/lib/jenkins/.ssh/config # GitLab.com serverHost 139.159.xx.xxRSAAuthentication yesIdentityFile /var/lib/jenkins/.ssh/jenkins.rsasudo chown -R jenkins /var/lib/jenkins/.ssh/git ls-remote -h git@github.com:adolfosrs/jenkins-test.git HEAD

参考:

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 离线文档