Centos + Maven + Jenkins

时间:2024-09-14 17:04:32

下载 JDK
wget --no-check-certificate --no-cookie --header "Cookie: oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.rpm

安装 JDK

  • rpm -ivh jdk-8u121-linux-x64.rpm
  • vi /etc/profile
    • JAVA_HOME=/usr/java/jdk1.8.0_121
    • JRE_HOME=/usr/java/jdk1.8.0_121/jre
    • CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
    • PATH=$JAVA_HOME/bin:$PATH
    • export PATH JAVA_HOME CLASSPATH
  • 保存后执行 source /etc/profile
  • 命令执行完毕即安装完成,使用java -version 检查是否安装成功

下载 maven

  • wget -c http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
  • 解压:
    • tar -zxvf apache-maven-3.5.0-bin.tar.gz
  • 移至/usr/local下:
    • mv apche-maven-3.5.0 /usr/local
  • vi /etc/profile
    • export MAVEN_HOME=/usr/local/apache-maven-3.5.0
    • export PATH=$PATH:$MAVEN_HOME/bin
  • 保存后执行 source /etc/profile

安装Jenkins

安装步骤如下:

  • sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
  • sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
  • sudo yum install jenkins

使Jenkins能够以服务方式启动

  • sudo service jenkins start/stop/restart
  • sudo chkconfig jenkins on