Jenkisn + Tomcat7 + Ubuntu12.04 server

来源:互联网 发布:成都软件开发培训班 编辑:程序博客网 时间:2024/06/14 07:41

1. sudo apt-get install tomcat7

In this case, here are the paths you might care about:
/var/lib/tomcat6 – These are the Java-y files for Tomcat. If you were to just extract Tomcat’s tar file and run it as a local user, these are the files you’d mostly be looking at.
/usr/share/tomcat6 – These are the more Linux-y files for Tomcat. Tomcat’s binaries, shell scripts, bootstrap files, etc.

2. Install Jenkins
http://mirrors.jenkins-ci.org/war/latest/
copy the war file to /var/lib/tomcat6/webapps

test:
http://localhost:8080/jenkins

error:
Unable to create the home directory ‘/usr/share/tomcat6/.jenkins’. This is most likely a permission problem.

To change the home directory, use JENKINS_HOME environment variable or set the JENKINS_HOME system property. See Container-specific documentation for more details of how to do this.

原因:
Jenkins depends on an environment variable called JENKINS_HOME being set. Most solutions for this offered by the internet suggest setting the CATALINA_OPTS environment variable, and they all generally assume you are running Tomcat as yourself rather than a system user.

Jenkins actually does something handy when JENKINS_HOME is not set: it sets it for you, as .jenkins. Of course, it assumes this directory exists relative to where it executing, which means it’s looking in /usr/share/tomcat6.
解决方法:
cd /usr/share/tomcat7sudo mkdir .jenkinssudo chown tomcat7:nogroup .jenkinssudo service tomcat7 restart

OK!

bug2: gradle: command not found or lint: command not found
描述:lint 与gradle的环境变量都已经设置过了,并且可以通过job 运行后的环境变量中看到,是已经生效了。
但是,输出$ANDROID_HOME/tools 目录,表示不存在该目录, gradle也一样

原因:tomcat7 用户没有访问tools目录的权限。


解决方法:在android sdk 目录上执行如下命令:

sudo chown -R tomcat7 android-sdk-linuxsudo chown -R tomcat7 gradle目录



优化:
1.速度太慢
使用内存充当硬盘,提高启动速度。

sudo mount -t tmpfs tmpfs /media/virram  -o size=200M tmpfs /media/ramdisk tmpfs size=2G,defaults,noatime,mode=1777 0 0

推荐使用:
tmpfs /media/ramdisk tmpfs defaults,noatime,mode=1777 0 0
操作系统会默认使用电脑内存的一半作为虚拟硬盘,如果虚拟内存使用完,操作系统会默认使用交换分区(swap)的区域。