自动化测试全套流程(一)-搭建Jenkins环境

前提

  既然要做自动化测试,那我们就做得彻底一些,将整套系统部署在Linux服务器上,在搭建Jenkins环境之前,我已经通过VirtualBox安装了一个CentOS的服务器,搭建Jenkins是基于这个服务器环境之上的,CentOS下载地址为:http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1804.iso,CentOS安装后的版本信息如下:

[root@localhost ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

CentOS安装wget用于下载Jenkens安装包。

[root@localhost ~]# yum -y install wget

安装成功后下载Jenkins,Jenkins安装包下载地址:https://pkg.jenkins.io/redhat/jenkins-2.131-1.1.noarch.rpm

[root@localhost ~]# wget https://pkg.jenkins.io/redhat/jenkins-2.131-1.1.noarch.rpm

 安装Jenkins

[root@localhost webber]# rpm -ivh jenkins-2.131-1.1.noarch.rpm

  Jenkins的默认JENKINS_PORT是8080,为了避免与tomcat冲突,将其修改为8088

[root@localhost conf]# vi /etc/sysconfig/jenkins
## Type:        integer(0:65535)
## Default:     8080
## ServiceRestart: jenkins
#
# Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_PORT="8088"

给Jenkins配置JDK

[root@localhost conf]# vi /etc/rc.d/init.d/jenkins
candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/bin/java
/home/jdk1.8.0_171/bin/java
"

重新加载配置并重启Jenkins服务

[root@localhost conf]# systemctl daemon-reload
[root@localhost conf]# systemctl restart jenkins.service

在浏览器中输入Jenkins服务器的地址就可以成功访问Jenkins了

posted @ 2018-07-13 23:06  成都张哥  阅读(699)  评论(0编辑  收藏  举报