ubuntu下搭建车场环境(代码使用jekins构建)
1、安装jdk,jre
sudo apt-get update # 更新软件包管理器,如果已经执行过,则可以不用再执行
sudo apt-get install default-jdk # 安装默认的jdk
sudo apt-get install default-jre # 安装默认的jre
2、安装tomcat
这里采用绿色安装,从dev.tongtongtingche.com.cn 中拷贝一个
scp -r root@dev.tongtongtingche.com.cn:/optb/tomcat-ParkServerV3 /opt/
3、在test.tongtongtingche.com.cn 的/opt/save 下创建文件 public_parkv3.sh,内容如下:
#!/bin/bash #defined TOMCAT_HOME="/optb/tomcat-ParkServerV3" TOMCAT_PORT=8090 PROJECT="$1" #param validate if [ $# -lt 1 ]; then echo "you must use like this : ./publish.sh <projectname> [tomcat port] [tomcat home dir]" exit fi if [ "$2" != "" ]; then TOMCAT_PORT=$2 fi if [ "$3" != "" ]; then TOMCAT_HOME="$3" fi #shutdown tomcat echo "tomcat shutdown" #check tomcat process tomcat_pid=`/usr/bin/lsof -n -P -t -i :$TOMCAT_PORT` echo "current :" $tomcat_pid while [ -n "$tomcat_pid" ] do sleep 5 tomcat_pid=`/usr/bin/lsof -n -P -t -i :$TOMCAT_PORT` echo "scan tomcat pid :" $tomcat_pid kill -9 $tomcat_pid echo "kill -9 tomcat pid" done #publish project echo "scan no tomcat pid,$PROJECT publishing" rm -rf "$TOMCAT_HOME"/webapps/$PROJECT/WEB-INF/lib cp -r /opt/save/$PROJECT/WEB-INF/lib "$TOMCAT_HOME"/webapps/$PROJECT/WEB-INF/lib rm -rf "$TOMCAT_HOME"/webapps/$PROJECT/view/home rm -rf "$TOMCAT_HOME"/webapps/$PROJECT/view/library rm -rf "$TOMCAT_HOME"/webapps/$PROJECT/view/skin cp -r /opt/save/$PROJECT/view/home "$TOMCAT_HOME"/webapps/$PROJECT/view/home mkdir -p "$TOMCAT_HOME"/webapps/$PROJECT/view/library
根据实际情况修改相关路径
4、jekins增加ssh server
系统管理--系统设置,增加一个ssh server
5、jekins增加一个软件项目,配置见jekins