解压文件 (opt/下解压):tar -zxvf apache-tomcat-*.tar.gz
重命名:mv apache-tomcat-* /opt
为启动的脚本文件添加环境变量(tomcat7/bin/startup.sh):
JAVA_HOME=/usr/java/jdk-8u121
JRE_HOME=/usr/java/jdk-8u121/jre\
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
TOMCAT_HOME=/opt/tomcat7
export JAVA_HOME=/usr/java/jdk-8u121
export JAVA_BIN=/usr/java/jdk-8u121/bin
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
可以运行 sh startup.sh 命令,检查tomcat是否能够正常启动!成功的话,页面上打开
localhost:8080 可以看到tomcat欢迎页
在tomcat webapps目录下新建ROOT文件夹,我们将把安装到这个目录下面: 解压jenkins.war : /usr/java/jdk1.8.****/bin/jar -xvf jenkins.war
配置环境变量 vi /etc/profile ---> export JENKINS_HOME=/opt/tomcat7/webapps/jenkins
至此,基本环境搭建完毕,运行nohup sh startup.sh > nohup.out & 启动tomcat, 打开ocalhost:8080即可看到jenkins初始化页面
执行者数量:<numExecutors>0</numExecutors>
启用安全:<useSecurity>true</useSecurity>(如果一旦权限配置有问题 请修改这个地方为false 保证能够登录进入系统 重新配置)
用户权限设置:
<authorizationStrategy >
Credentials 权限:
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.Create:hzzhushanshan</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.Delete:hzzhushanshan</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.ManageDomains:hzzhushanshan</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.Update:hzzhushanshan</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.View:hzzhushanshan</permission>
Agent权限:
<permission>hudson.model.Computer.Build:hzzhushanshan</permission>
<permission>hudson.model.Computer.Configure:hzzhushanshan</permission>
<permission>hudson.model.Computer.Connect:hzzhushanshan</permission>
<permission>hudson.model.Computer.Create:hzzhushanshan</permission>
<permission>hudson.model.Computer.Delete:hzzhushanshan</permission>
<permission>hudson.model.Computer.Disconnect:hzzhushanshan</permission>
Overall权限:
<permission>hudson.model.Hudson.Administer:hzzhushanshan</permission>
<permission>hudson.model.Hudson.Read:hzzhushanshan</permission>
Job权限:
<permission>hudson.model.Item.Build:hzzhushanshan</permission>
<permission>hudson.model.Item.Cancel:hzzhushanshan</permission>
<permission>hudson.model.Item.Configure:hzzhushanshan</permission>
<permission>hudson.model.Item.Create:hzzhushanshan</permission>
<permission>hudson.model.Item.Delete:hzheqian</permission>
<permission>hudson.model.Item.Discover:hzzhushanshan</permission>
<permission>hudson.model.Item.Move:hzzhushanshan</permission>
<permission>hudson.model.Item.Read:hzzhushanshan</permission>
<permission>hudson.model.Item.Workspace:hzzhushanshan</permission>
Run权限:
<permission>hudson.model.Run.Delete:hzzhushanshan</permission>
<permission>hudson.model.Run.Replay:hzzhushanshan</permission>
<permission>hudson.model.Run.Update:hzzhushanshan</permission>
View权限:
<permission>hudson.model.View.Configure:hzzhushanshan</permission>
<permission>hudson.model.View.Create:hzzhushanshan</permission>
<permission>hudson.model.View.Delete:hzzhushanshan</permission>
<permission>hudson.model.View.Read:hzzhushanshan</permission>
SCM权限:
<permission>hudson.scm.SCM.Tag:hzzhushanshan</permission>
</authorizationStrategy>
访问控制 --> 安全域-->OpenID SSO --> provier URL【一不小心配置了一个不可用的url 可以修改这边 将这边删除 重新页面上尝试】:
<securityRealm plugin="openid@1.8"><endpoint>https://login.netease.com/openid</endpoint</securityRealm>
此外,这个文件中还有jdk、view的详细配置,大家可以自行去查阅配置文件理解<com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
<scope>GLOBAL</scope> //是否全局可用
<id>用户id</id>
<description></description>
<username>hzzhushanshan</username>
<password>加密后的password</password>
</com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
<jenkins.model.JenkinsLocationConfiguration
<adminAddress>ci_klqa@163.com</adminAddress>
<jenkinsUrl>http://ci.kaolatest.netease.com/</jenkinsUrl></jenkins.model.JenkinsLocationConfiguration>
本文来自网易实践者社区,经作者朱珊珊授权发布。