码迷,mamicode.com
首页 > 其他好文 > 详细

Jenkins~简单部署及使用

时间:2017-12-01 17:14:08      阅读:297      评论:0      收藏:0      [点我收藏+]

标签:rac   版本号   www.   pac   下界   main   maven2   epo   acl   

在此注意:新版的jenkins.war包需要JDK1.8版本的支持,否则安装失败!

源码包下载地址

 
一、Linux系统
[root@localhost ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@localhost ~]# uname -r
2.6.32-431.el6.x86_64

 


 
二、安装配置系统默认JAVA环境(Jenkins可配置多个java版本,供不同项目构建时的需求)
 
    此处使用java版本为 -- jdk-8u151-linux-x64.tar.gz    
[root@localhost soft]# tar xf jdk-8u151-linux-x64.tar.gz -C /usr/local/
[root@localhost soft]# mv /usr/local/jdk1.8.0_151/ /usr/local/java
[root@localhost soft]# echo -e "\nexport JAVA_HOME=/usr/local/java\nexport CLASSPATH=.:/usr/local/java/lib/tools.jre:/usr/local/java/lib/dt.jar\nexport JRE_HOME=/usr/local/java/jre\nexport PATH=$PATH:/usr/local/java/bin" >> /etc/profile    #添加全局变量
[root@localhost soft]# source /etc/profile
[root@localhost soft]# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

 


 
三、Maven的安装部署
 
    maven使用的版本 -- apache-maven-3.5.0-bin.tar.gz
技术分享图片
[root@localhost soft]# tar xf apache-maven-3.5.0-bin.tar.gz -C /usr/local/             #解压maven源码包
[root@localhost soft]# mv /usr/local/apache-maven-3.5.0/ /usr/local/maven                #更改项目安装的目录名称
[root@localhost soft]# echo -e "export MAVEN_HOME=/usr/local/maven\nPATH=$PATH:/usr/local/maven/bin">>/etc/profile     #添加全局变量
[root@localhost soft]# source /etc/profile              #声明全局变量
[root@localhost soft]# mvn -v                   #查看maven版本号
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /usr/local/maven
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /usr/local/java/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
View Code

 

 
maven配置文件<profiles>中添加
技术分享图片
55   <localRepository>/data/maven/repository</localRepository>       #第55行开启本地存储目录的路径。仓库下载方指定额位置 
    <profile>
        <id>dev</id>
        <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>1.7</jdk>
        </activation>
        <properties>
            <maven.compiler.source>1.7</maven.compiler.source>
            <maven.compiler.target>1.7</maven.compiler.target>
            <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
        </properties>
        <repositories>
            <!--公共仓库-->
            <repository>
            <id>public-nexus</id>
            <url>http://192.168.*.**:8081/repository/maven-public/</url>;
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>true</enabled>
            </snapshots>
            </repository>
            <!--第三方仓库-->
            <repository>
                <id>aliyun</id>
                    <name>Maven aliyun Repository</name>
                    <url>http://maven.aliyun.com/nexus/content/groups/public</url>;
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
            </repository>
            <repository>
                <id>lds</id>
                    <name>Maven lds Repository</name>
                    <url>https://code.lds.org/nexus/content/groups/main-repo/</url>;
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
            </repository>
            <repository>
                <id>uk</id>
                    <name>Maven uk Repository</name>
                    <url>http://uk.maven.org/maven2/</url>;
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
            </repository>
            <repository>
                <id>offical</id>
                    <name>Maven Official Repository</name>
                    <url>http://repo2.maven.org/maven2</url>;
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
            </repository>
            <repository>
                    <id>spring-milestones</id>
                    <name>Spring Milestones</name>
                    <url>http://repo.spring.io/libs-milestone-local</url>;
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
            </repository>
            <repository>
                    <id>spring-releases</id>
                    <name>Spring Releases</name>
                    <url>http://repo.spring.io/libs-release-local</url>;
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
            </repository>
        </repositories>
      </profile>
View Code

 


 
四、Tomcat的安装部署
 
    tomcat使用的版本 -- apache-tomcat-8.5.23.tar.gz(也可以使用7版本)
[root@localhost soft]# tar xf apache-tomcat-8.5.23.tar.gz -C /usr/local/
[root@localhost soft]# mv /usr/local/apache-tomcat-8.5.23/ /usr/local/tomcat
[root@localhost soft]# echo -e "export TOMCAT_HOME=/usr/local/tomcat\nPATH=$PATH:/usr/local/tomcat/bin" >>/etc/profile  #可以定义为TOMCAT_HOME也可以 CATALINA_PATH
[root@localhost soft]# source /etc/profile

 


 
五、上传jenkins.war包并启动tomcat
 
    现在使用的jenkins包为当时最新的前两个版本;将jenkins.war包上传到tomcat家目录中的webapps中
[root@localhost webapps]# pwd
/usr/local/tomcat/webapps
[root@localhost webapps]# ls
docs  examples  host-manager  jenkins.war  manager  ROOT
[root@localhost webapps]# cd ../bin/
[root@localhost 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/local/java/jre
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@localhost bin]# ps -ef |grep tomcat
root      4575     1 99 14:51 pts/1    00:00:11 /usr/local/java/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start
[root@localhost bin]# cd ../webapps/
[root@localhost webapps]# ls
docs  examples  host-manager  jenkins  jenkins.war  manager  ROOT

 


 
六、通过浏览器访问
 
    访问的地址:http://192.168.9.32:8080/jenkins《IP地址为搭建jenkins服务器的地址,8080此处为tomcat的默认端口,tomcat中端口更改后,此处需要更改》
 技术分享图片

 

 
 
[root@localhost ~]# cat /root/.jenkins/secrets/initialAdminPassword
d7b45acbdb214475aa2ef15e36557904
 
    输入密码点击continue进入以下界面
技术分享图片

 


 
 
技术分享图片

 

 
 
**当出来如下界面,说明一切顺利**
技术分享图片

 

 
 
 
 
 
 
 
 
 

Jenkins~简单部署及使用

标签:rac   版本号   www.   pac   下界   main   maven2   epo   acl   

原文地址:http://www.cnblogs.com/haorong/p/7943326.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!