搭建jenkins的环境

来源:互联网 发布:stc单片机下载不了 编辑:程序博客网 时间:2024/04/28 16:49

一,安装Tomcat

操作系统:debian8

打开/etc/apt/sources.list文件,在此文件中加入下面的源:
#for sun-java packages in unstable
deb http://ftp.debian.org/debian/ unstable non-free
deb-src http://ftp.debian.org/debian/ unstable non-free

保存并退出,然后用下面的命令更新一下源:

aptitude update

下载JDK
aptitude install sun-java6-jdk
开始安装tomcat
aptitude install tomcat8 tomcat8-admin

二,配置tomcat

1,首先停用tomcat服务:
/etc/init.d/tomcat5.5 stop
2,编辑文件/var/lib/tomcat5.5/conf/tomcat-users.xml
加入

<role rolename="manager"/>  <role rolename="admin"/>  <user username="admin" password="tomcat" roles="admin"/>  <user username="manager" password="manager" roles="manager" /> 

3,进入manager界面之后,显示的是403 Access Denied
解决办法:
在conf/tomcat-users.xml文件中看到这么一段话:
NOTE: By default, no user is included in the “manager-gui” role required
to operate the “/manager/html” web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
也就是说,为了考虑安全,tomcat默认还是没有manager-gui的管理权限的,如果想要使用manager
的话,需要自行加入管理权限(角色)。
需要加一个这样的权限(角色)

然后再加到需要的用户名中去

这样OK了。

三,部署jenkins

1,下载
jenkins是一个java web项目,可以去官网下载war包,放在tomcat的webapps下就能运行。(/var/lib/tomcat8/webapps)
http://mirrors.jenkins-ci.org/war-stable/
访问localhost:8080/jenkins进入
2,进入之后报错
报错代码显示:

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.

解决方法:

cd /usr/share/tomcat8sudo mkdir .jenkinssudo chown tomcat8:nogroup .jenkins
0 0
原创粉丝点击