jenkins部署

1.安装jdk

#老套路
cd /tools
wget http://endless.ws/jdk-8u151-linux-x64.tar.gz
tar xf jdk-8u151-linux-x64.tar.gz
mv jdk-8u151-linux-x64  /usr/local/jdk-8u151
ln -s /usr/local/jdk-8u151 /usr/local/jdk

cat >>~/.bash_profile<

2.安装mvn

    cd /tools
    wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
    tar xf apache-maven-3.5.2-bin.tar.gz
    mv apache-maven-3.5.2 /usr/local/maven-3.5.2
    ln -s  /usr/local/maven-3.5.2 /usr/local/maven

    cat >>~/.bash_profile<

3.jenkins搞起

cd /tools
wget http://central.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.8.v20171121/jetty-distribution-9.4.8.v20171121.tar.gz
wget http://mirrors.jenkins.io/war/latest/jenkins.war
tar xf jetty-distribution-9.4.8.v20171121.tar.gz
mv jetty-distribution-9.4.8.v20171121 /usr/local/jetty-9.4.8
ln -s /usr/local/jetty-9.4.8 /usr/local/jetty
mkdir /data
cd /data

    #这个脚本是创建软连接,用jetty当作容器来启动jenkins的war包
    vim create.sh
DEFAULT_JETTY_DIR="/usr/local/jetty"
BASE_PATH="/data/"

read -p "JETTY 所在位置 [${DEFAULT_JETTY_DIR}]: " JETTY_DIR
read -p "服务名: " SERVER_NAME

if [ -z "$JETTY_DIR" ]; then
  JETTY_DIR=${DEFAULT_JETTY_DIR}
fi

if [ -z "$SERVER_NAME" ]; then
  echo "服务名错误"
  exit 0
fi

SERVER_PATH="/data/$SERVER_NAME"

LINK() {
  ln -s $JETTY_DIR/$1 $SERVER_PATH/$1
}

if [ -d "${SERVER_PATH}" ]; then
rm -rf ${SERVER_PATH}
fi

mkdir $SERVER_PATH $SERVER_PATH/etc $SERVER_PATH/logs $SERVER_PATH/webapps $SERVER_PATH/modules && \
cp -R $JETTY_DIR/etc/* $SERVER_PATH/etc && \
cp $JETTY_DIR/start.ini $SERVER_PATH/ && \
cp -R $JETTY_DIR/modules/* $SERVER_PATH/modules/ && \
LINK bin && \ 
LINK lib && \
LINK resources && \
LINK start.jar && \
LINK license-eplv10-aslv20.html && \
LINK README.TXT && \
LINK VERSION.txt && \
LINK notice.html && \
LINK demo-base && \
LINK webapps/README.TXT

./create.sh
路径:默认
名称输入:jenkins

    cp /tools/jenkins.war  /data/jenkins/webapps/
    cd /data/jenkins/webapps

    cat >>jenkins.xml<
    /jenkins
    /webapps/jenkins.war
    
            
                    
                            Jenkins Realm
                            /etc/realm.properties
                    
            
    
    
    EOF

    /data/jenkins/bin/jetty.sh start

    #web界面通过localhost:8080/jenkins来查看

4.git或者svn这种东西自己选一个

#svn
#yum install subversion -y

#git 系统自带,也是趋势
#web界面简要述说,很简单,管理工具-可选择插件安装 -可配置环境变量及别名等等
#构建jenkins流程自己看,里面都有固定套路,太简单,把握主逻辑。

转载于:https://blog.51cto.com/linux1991/2060693

你可能感兴趣的:(jenkins部署)