ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
第一步:安装JDK环境 [www@guanliji src]$ sudo wget http://soft.51yuki.cn/jdk-8u131-linux-x64.rpm [www@guanliji src]$ rpm -ivh jdk-8u131-linux-x64.rpm error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied) [www@guanliji src]$ sudo rpm -ivh jdk-8u131-linux-x64.rpm Preparing... ########################################### [100%] 1:jdk1.8.0_131 ########################################### [100%] Unpacking JAR files... tools.jar... plugin.jar... javaws.jar... deploy.jar... rt.jar... jsse.jar... charsets.jar... localedata.jar... 配置JDK环境 [www@guanliji ~]$ sudo vim /etc/profile.d/jdk.sh #set java environment JAVA_HOME=/usr/java/jdk1.8.0_131/ CLASSPATH=.:${JAVA_HOME}/lib.tools.jar PATH=$PATH:${JAVA_HOME}/bin [www@guanliji src]$ sudo sh /etc/profile.d/jdk.sh 查看 [www@guanliji ~]$ sudo java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode) 第二步: 配置maven环境 以apache-maven-3.5.2-bin.tar.gz为例 [www@guanliji ~]$ cd /usr/local/src/ [www@guanliji src]$ sudo wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz [www@guanliji src]$ sudo tar xf apache-maven-3.5.2-bin.tar.gz [www@guanliji src]$ sudo vim /etc/profile.d/maven.sh #set maven environment MAVEN_HOME=/usr/local/src/apache-maven-3.5.2 export PATH=${PATH}:${MAVEN_HOME}/bin [www@guanliji src]$ source /etc/profile.d/maven.sh 查看 [www@guanliji ~]$ mvn -v Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T15:58:13+08:00) Maven home: /usr/local/src/apache-maven-3.5.2 Java version: 1.8.0_131, vendor: Oracle Corporation Java home: /usr/java/jdk1.8.0_131/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "2.6.32-696.10.2.el6.x86_64", arch: "amd64", family: "unix" 第三步:安装tomcat环境 [www@guanliji src]$ sudo wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24.tar.gz [www@guanliji src]$ sudo tar xf apache-tomcat-8.5.24.tar.gz -C /usr/local/ [www@guanliji local]$ sudo ln -sv apache-tomcat-8.5.24/ tomcat [www@guanliji local]$ su - root Password: [root@guanliji ~]# chown -R www.www /usr/local/apache-tomcat-8.5.24/ 配置tomcat [www@guanliji ~]$ cd /usr/local/tomcat/conf/ [www@guanliji conf]$ vim server.xml 把端口号更改一下 比如: 8005------->7005 8009--------->7009 8080---------->7082 <Engine name="Catalina" defaultHost="jen.51yuki.cn"> <Host name="jen.51yuki.cn" appBase="webapps" 2) 添加tomcat用户(该用户用于jenkins部署专用) [www@guanliji conf]$ vim tomcat-users.xml <tomcat-users> <role rolename="admin-gui"></role> <role rolename="admin-script"></role> <role rolename="manager-gui"></role> <role rolename="manager-script"></role> <role rolename="manager-jmx"></role> <role rolename="manager-status"></role> <user username="tomcat" password="Tomcat123" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/> </tomcat-users> 3)配置环境变量 [www@guanliji ~]$ sudo vim /etc/profile.d/tomcat.sh #set env tomcat TOMCAT_HOME=/usr/local/tomcat PATH=$PATH:${TOMTCAT_HOME}/bin [www@guanliji ~]$ source /etc/profile.d/tomcat.sh 第四步:配置并启动jenkins 以jenkins 2.89.2为例 [www@guanliji src]$ sudo wget http://mirrors.shuosc.org/jenkins/war-stable/2.89.2/jenkins.war [www@guanliji src]$ cp jenkins.war /usr/local/tomcat/webapps/ 启动tomcat服务 [www@guanliji ~]$ cd /usr/local/tomcat/bin/ [www@guanliji bin]$ ./startup.sh Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Tomcat started. [www@guanliji bin]$ sudo ss -tunlp|grep 7082 tcp LISTEN 0 100 *:7082 *:* users:(("java",17851,48)) 第五步:配置jenkins 1)根据tomcat的IP地址和端口登录 ![](https://box.kancloud.cn/90e03cca3923c227a87c6ba2b72a209c_996x388.png) http://mirrors.jenkins-ci.org/war/2.98/jenkins.war (jenkins镜像) 到此说明jenkins安装成功咯 第三种方法: 持续集成之Jenkins安装部署 安装JDK Jenkins是Java编写的,所以需要先安装JDK,这里采用yum安装,如果对版本有需求,可以直接在Oracle官网下载JDK。 [root@linux-node1 ~]# yum install -y java-1.8.0 安装Jekins [root@linux-node1 ~]# cd /etc/yum.repos.d/ [root@linux-node1 yum.repos.d]# wget http://pkg.jenkins.io/redhat/jenkins.repo [root@linux-node1 ~]# rpm --import http://pkg.jenkins.io/redhat/jenkins.io.key [root@linux-node1 ~]# yum install -y jenkins [root@linux-node1 ~]# systemctl start jenkins 访问Jenkins 在浏览器输入http://192.168.56.11:8080来访问jenkins。