CAS 5.0.0的安装及配置

详细记录CAS 5.0.0的安装及配置过程,请注意:本文都是在root用户权限下执行,在生产环境不建议使用root权限。
环境:CentOS 6.8 x86_64

1.JDK及maven的安装
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以上,否则可能报
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]

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.文件下载
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配置文件版本之间不能通用
cd etc
cp -rf cas /etc/
cd ..

5.对CAS进行打包
./gradlew clean build

6.部署cas.was
cp cas/build/libs/cas.war /usr/local/tomcat/webapps/

7.启动tomcat
/usr/local/tomcat/bin/catalina.sh start

并查看tomcat的报错信息
tail -f /usr/local/tomcat/logs/catalina.out

8.查看下效果

CAS 5.0.0的安装及配置

CAS默认登录账号密码
caSUSEr
Mellon

CAS 5.0.0的安装及配置

9.根据CAS建议,打开tomcat的SSL

mkdir /etc/cas/key
cd /etc/cas/key
keytool -genkey -alias cas --keyalg RSA -keystore cas.keystore -validity 3650

CAS 5.0.0的安装及配置

keytool -export -file cas.crt -alias cas -keystore cas.keystore

CAS 5.0.0的安装及配置

keytool -importcert -alias cas -file cas.crt -keystore "${JAVA_HOME}/jre/lib/security/cacerts" -storepass changeit

CAS 5.0.0的安装及配置

配置tomcat打开SSL
cp /usr/local/tomcat/conf/server.xml /usr/local/tomcat/conf/server.xml.ori
vim /usr/local/tomcat/conf/server.xml

增加,注意大小写
    <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>

看截图

CAS 5.0.0的安装及配置

现在重新启动tomcat试试
/usr/local/tomcat/bin/catalina.sh stop
/usr/local/tomcat/bin/catalina.sh start

启动的时候关注下日志文件,看是否报错

CAS 5.0.0的安装及配置

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/d41cbf332d2d621d13a4b391cb450f0e.html