多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > 互聯網 > How to setup CI development environment in Linux

How to setup CI development environment in Linux

來源:程序員人生   發布時間:2014-12-10 08:08:06 閱讀次數:3119次

In the past 2 days, I setup a CI development environment in Linux:

Git + Jenkins + Maven(Nexus)  + Tomcat

I write the steps down to keep memo.

Pre-installed software:

1. Java: I use JDK1.8.0_25

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads⑵133151.html

jdk⑻u25-linux-i586.rpm

Install the jdk, and add the environment variable:

vi /etc/profile

JAVA_HOME=/usr/java/jdk1.8.0_25
export JRE_HOME=/usr/java/jdk1.8.0_25
export JRE_BIN=/usr/java/jdk1.8.0_25/bin
export CLASSPATH=$JRE_HOME/lib:$CLASSPATH
export PATH=$JRE_HOME/bin:$PATH

source /etc/profile

Verify: in the terminal, run: java -version and could see the version

2. Maven:

http://maven.apache.org/download.cgi

apache-maven⑶.2.3-bin.tar.gz

extract the tar file and move it to /usr/local:

tar -xvf apache-maven⑶.2.3-bin.tar.gz

mv apache-maven⑶.2.3 /usr/local/apache-maven⑶.2.3

add environment variable:

vi /etc/profile

MAVEN_HOME=/usr/local/apache-maven⑶.2.3
export MAVEN_HOME
export PATH=${PATH}:${MAVEN_HOME}/bin

source /etc/profile

Verify: in the terminal, run: mvn -v and could see the version

3. Git

IMPORTANT: In redhat 6, and you use yum install git you could only install 1.7.1 version, but that version is out date, and has some problem for authentication, so if you install the git 1.7.1, you need to uninstall it, using rpm -e git

and maybe ask you uninstall the perl-git something, anyway, you need to rpm -e git per-get to remove them all.

Finally, I find a document about how to install latest version of git:

http://tecadmin.net/install-git⑴⑼-on-centos-rhel/

Step 1: Install Required Packages

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

Step 2: Download and Compile Git Source

# cd /usr/src # wget https://www.kernel.org/pub/software/scm/git/git⑴.9.4.tar.gz # tar xzf git⑴.9.4.tar.gz

Step 3. Check Git Version

One completion of above steps, you have successfully install Git in your system. Let use following command to check git version

# git --version

git version 1.9.4

4. Jenkins:

http://pkg.jenkins-ci.org/redhat-stable/

jenkins⑴.580.1⑴.1.noarch.rpm

install the rpm, and then startup jenkins by:

service jenkins start

and visit:

http://localhost:8080

you should see the jenkins UI.

chmod -R 777 /var/lib/jenkins

5. Tomcat:

http://tomcat.apache.org/download⑺0.cgi

apache-tomcat⑺.0.57.tar.gz

extract the tar file and move it to /usr/local:

tar -xvf apache-tomcat⑺.0.57.tar.gz

mv  apache-tomcat⑺.0.57 /usr/local/apache-tomcat⑺.0.57

Make sure you have the permission to change the folder, otherwise, change the permission to 777

chmod -R 777 /usr/local/apache-tomcat⑺.0.57

modify /usr/local/apache-tomcat⑺.0.57/conf/tomcat-users.xml:

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcat" password="tomcat" roles="manager-gui,
 manager-script"/>

modify /usr/local/apache-tomcat⑺.0.57/conf/server.xml

change the port to 8888.

 <Connector port="8888" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

<Connector executor="tomcatThreadPool"
               port="8888" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

Verify: in /usr/local/apache-tomcat⑺.0.57/bin

[root@oc4327053475 bin]# startup.sh
Using CATALINA_BASE:   /usr/local/apache-tomcat⑺.0.57
Using CATALINA_HOME:   /usr/local/apache-tomcat⑺.0.57
Using CATALINA_TMPDIR: /usr/local/apache-tomcat⑺.0.57/temp
Using JRE_HOME:        /usr/java/jre1.8.0_25
Using CLASSPATH:       /usr/local/apache-tomcat⑺.0.57/bin/bootstrap.jar:/usr/local/apache-tomcat⑺.0.57/bin/tomcat-juli.jar
Tomcat started.

Configuration:

First make sure you have pushed all the code to jazzhub or github, in this case, I use jazzhub.

Step 1:

Add necessary plugins. By default, jenkins 1.580.1⑴.1 has installed all the necessary plugins(Git, marven, deploy to container), if not, you should install them first from "Manage Jenkins" -> "Manage Plugins" menu.

After that, make sure, if you "New Item" , you should see "Build a maven project" option:

Step 2: Config system:

To config some system level options used in Jenkins. From "Manage Jenkins" -> "Config System"

Add the tools location in Global properties -> Tool Locations


In the Git section, fill the "Path to Git executeable" as "/usr/local/git/bin/git" where we installed git.




Create a new project:



In the Jenkins web UI, click "New Item", create a maven project and named "RestDeploy", then config the project:

1.Git section: input the git repository URL: https://hub.jazz.net/git/wangpbj/RestDeploy with the username/password.

IMPORTANT: Here I have a problem with git 1.7.1, and reported Unable to find remote helper for 'https' , it proved that, the git version matter, after I changed to git 1.9.4, the problem disappeared. It will automatically connect to the repository, and will report error if has problem.

In the "Build Triggers" section, I select Poll SCM every 15 mins.


In the "Build" section, set "Root POM" as "RestDeploy/pom.xml", "Goals and options" as "clean install", click "advanced" menu, to check "Use private Maven repository", in the "Settings file" select "Settings file in filesystem", and fill the file path "settings.xml".

INPORTANT: By default, my settings file locates in /root/.m2/settings.xml, but it reports can not find the file, so I have to copy the settings.xml file to  /var/lib/jenkins/jobs/RestDeploy/workspace  it seems Jenkins search the folder as root folder. Jenkins will use “/var/lib/jenkins/.m2/” as its own maven repository.

Because I want to use mirror to Maven central site, I setup a nexus server locally, it could be much quick, and could hold our own plugins/libs(such as db2 jdbc driver) to shared within teams. the content of the settings.xml:

<?xml version="1.0" encoding="UTF⑻"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings⑴.0.0.xsd">
  <pluginGroups></pluginGroups>
  <proxies></proxies>
   <servers>     
    <server>  
        <id>nexus-snapshots</id>  
        <username>admin</username>  
        <password>admin123</password>  
    </server>

    <server>  
        <id>tomcat</id>  
        <username>tomcat</username>  
        <password>tomcat</password>  
    </server>  
  </servers>     
  <mirrors>     
    <mirror>  
        <id>nexus</id>  
        <name>internal nexus repository</name>  
        <url>
http://9.123.149.131:8081/nexus/content/groups/public/</url>  
        <mirrorOf>central</mirrorOf>  
    </mirror>       
  </mirrors>
  <profiles></profiles>
</settings>


In the post-build actions section, select "Deploy war/ear to a container" , context path: /RestDeploy, select "Tomcat 7.x" as container, and set "tomcat"/"tomcat" as username and password. Tomcat url: http://localhost:8888


Everytime restart the Linux, need to do the following steps:

1.Startup nexus:

cd /root/nexus⑵.10.0-02/bin

export RUN_AS_USER=root

./nexus start

2. Startup tomcat:

cd /usr/local/apache-tomcat⑺.0.57/bin

startup.sh

3. Open port 8888 for tomcat and 4000 for nomachine for remote control:

cd /sbin

iptables -I INPUT -p tcp --dport 8888 -j ACCEPT

iptables -I OUTPUT -p tcp --sport 8888 -j ACCEPT

4. Startup jenkins:

service jenkins start

5. Startup ssh:

service sshd start

Test:

Everytime you push code to jazzhub: https://hub.jazz.net/git/wangpbj/RestDeploy

After 15 mins(I set the 1 min/poll before, but server is only an out of date desktop machine, it is fully occupied and very slow...), the staging server will show the latest version show:

http://9.123.149.131:8888/RestDeploy


TODOs if I have time:

1. Write a shell script to execute the startup process.

2. Auto push to Bluemix.

3. Add test framework.

4. Add code inspect framework.



生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 狠狠插网站 | 久久精品蜜芽亚洲国产a | 午夜dj视频免费完整高清视频 | 国产成人精品日本亚洲18图 | 视频www| 免费国产成人α片 | 欧美日韩国产综合在线 | 一级毛片一级毛片一级毛片aa | h视频免费网站 | 欧美成人v视频免费看 | 亚洲不卡在线播放 | videos欧美| 依人九九 | 免费播放成人生活片 | 中文字幕精品在线视频 | 尤物在线 | 国产免费一区二区三区最新 | 毛片福利| 国产成人精品日本亚洲网站 | 日本不卡一区二区三区在线观看 | 久久精品一区二区三区中文字幕 | 久久www免费人成精品 | 毛片网站大全 | 免费观看欧美一级毛片 | 亚洲色图日韩 | 99热这里有精品 | 一区二三区国产 | 日本免费人做人一区在线观看 | 最近中文在线中文 | 国语高清精品一区二区三区 | 亚洲视频2 | 欧美人善交 | 人成精品 | 日本一区二区三区不卡在线看 | h网在线 | 欧美一级爱爱视频 | 欧美色碰碰碰免费观看长视频 | www高清| 亚洲h视频在线观看 | 国产性生活视频 | 娇小老少配xxxxx性视频 |