日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

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

How to setup CI development environment in Linux

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

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.



生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 精产国产伦理一二三区 | av在线免费观看网址 | 日本a级在线 | 日韩视频在线免费观看 | 久久久精品免费 | 亚洲a人| 国产精品视频一区二区三区四区五区 | 亚洲一区二区高清 | 国产精品成人一区二区三区夜夜夜 | 久久99精品久久久久久久青青日本 | 综合日韩欧美 | 国产精品一区三区 | 午夜国产一区 | 日本久久91| 玖玖精品在线 | 国产精品免费一区二区三区 | 国产在线免 | 美女福利视频网 | 久久精品亚洲国产 | 日韩1级片 | 福利视频二区 | 666av视频在线观看 | 九九亚洲 | 日韩av手机免费在线观看 | 久久亚洲线观看视频 | 日韩精品视频一区二区三区 | 欧美一区二区三区在线观看视频 | 免费精品 | 又黄又湿的视频 | 希岛あいり中文字幕在线 | 久久久午夜精品 | www久久| 中文字幕电影在线观看 | 久久久精品一区二区 | 亚洲第一大片 | 一区二区三区久久 | 成人国产精品免费观看 | 日韩一区二区视频 | 日日夜夜天天 | 欧美国产中文字幕 | 国产精品大片 |