请注意:本文都是在root用户权限下执行,在生产环境不建议使用root权限.
环境:CentOS 6.8 x86_64
1.JDK及maven的安装
1
2
3
4
5
6
7
8
9
10
11
12
|
tar
zxf jdk-8u101-linux-x64.
tar
.gz
mv
jdk1.8.0_101
/usr/local
#4.1.10及以下版本使用
#tar zxf apache-maven-3.3.9-bin.tar.gz
#mv apache-maven-3.3.9 /usr/local
cat
<< EOF >>
/etc/profile
export
JAVA_HOME=
/usr/local/jdk1
.8.0_101
export
CLASSPATH=.:$JAVA_HOME
/lib/dt
.jar:$JAVA_HOME
/lib/tools
.jar
#export PATH=$JAVA_HOME/bin:$PATH:/usr/local/apache-maven-3.3.9/bin
export
PATH=$JAVA_HOME
/bin
:$PATH
EOF
source
/etc/profile
|
2.tomcat准备
tomcat必须要8.0以上,否则可能报
1
2
3
|
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.valves.rewrite.RewriteValve
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892) ~[catalina.jar:7.0.73]
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) ~[catalina.jar:7.0.73]
|
1
2
3
4
|
echo
"127.0.0.1 $HOSTNAME"
>>
/etc/hosts
tar
zxf apache-tomcat-8.5.8.
tar
.gz
mv
apache-tomcat-8.5.8
/usr/local
ln
-s
/usr/local/apache-tomcat-8
.5.8
/usr/local/tomcat
|
3.文件下载
1
2
3
4
5
6
7
8
|
wget https:
//github
.com
/apereo/cas-gradle-overlay-template/archive/master
.zip
unzip master.zip
cd
cas-gradle-overlay-template-master
修改gradle下载路径,否则可能报错
vim gradle
/wrapper/gradle-wrapper
.properties
#distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
distributionUrl=https\:
//downloads
.gradle.org
/distributions/gradle-3
.1-bin.zip
否则可能下载报错
|
4.复制CAS配置文件,注意CAS配置文件版本之间不能通用
1
2
3
|
cd
etc
cp
-rf cas
/etc/
cd
..
|
5.对CAS进行打包
1
|
.
/gradlew
clean build
|
6.部署cas.was
1
|
cp
cas
/build/libs/cas
.war
/usr/local/tomcat/webapps/
|
7.启动tomcat
1
|
/usr/local/tomcat/bin/catalina
.sh start
|
并查看tomcat的报错信息
1
|
tail
-f
/usr/local/tomcat/logs/catalina
.out
|
8.查看下效果
CAS默认登录账号密码
casuser
Mellon
9.根据CAS建议,打开tomcat的SSL
1
2
3
|
mkdir
/etc/cas/key
cd
/etc/cas/key
keytool -genkey -
alias
cas --keyalg RSA -keystore cas.keystore -validity 3650
|
1
|
keytool -
export
-
file
cas.crt -
alias
cas -keystore cas.keystore
|
1
|
keytool -importcert -
alias
cas -
file
cas.crt -keystore
"${JAVA_HOME}/jre/lib/security/cacerts"
-storepass changeit
|
配置tomcat打开SSL
1
2
|
cp
/usr/local/tomcat/conf/server
.xml
/usr/local/tomcat/conf/server
.xml.ori
vim
/usr/local/tomcat/conf/server
.xml
|
增加,注意大小写
1
2
3
4
5
6
|
<Connector port=
"8443"
protocol=
"org.apache.coyote.http11.Http11NioProtocol"
maxThreads=
"150"
SSLEnabled=
"true"
scheme=
"https"
secure=
"true"
clientAuth=
"false"
sslProtocol=
"TLS"
keystoreFile=
"/etc/cas/key/cas.keystore"
keystorePass=
"123456"
>
<
/Connector
>
|
看截图
1
2
|
/usr/local/tomcat/bin/catalina
.sh stop
/usr/local/tomcat/bin/catalina
.sh start
|
启动的时候关注下日志文件,看是否报错
本文转自 rong341233 51CTO博客,原文链接:http://blog.51cto.com/fengwan/1876088