当前位置: 首页 > 工具软件 > Sakai > 使用案例 >

sakai11 在ubuntu14.04系统下踩坑

田曜瑞
2023-12-01

一路走来, 坑还是蛮多的.

此次安装的sakai11的binary版, 根据官方安装指引, 让我们按照一步一个坑的模式开始填.

  1. 第一步安装java 1.8 官网
    我们选择jave SE的JDK下载, 之后根据自己的环境选择版本, 我选择的是jdk-8u141-linux-x64.tar.gz

    下载完成后, 根据参考文章安装JDK.直到在命令行输入java -version会显示java版本号, 则安装成功.
    我的环境变量配置添加在 ~/.bashrc文件最后:
    ......
    
    export JAVA_HOME=/home/bosheng/work/javafile/jdk1.8.0_141
    export JRE_HOME=${JAVA_HOME}/jre
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
    export PATH=${JAVA_HOME}/bin:$PATH

    (补充1: 此处补充一个ubuntu系统设置环境变量的参考文章, 新手看一下受益匪浅.)
    (补充2: 在安装JDK的参考文章里, 我们已经设置过了当前用户(非全局用户)的java环境变量, 所以跳过sakai安装教程的环境变量配置环节)

  2. 安装tomcat8(必须8.0以上版本,此处我选择8.56版) 
    压缩包下载完成后:
    (1)解压到自己喜欢的目录, 并将加压后的文件夹(类似 ache-tomcat-8.56巴拉巴拉)重命名为tomcat8(方便设置环境变量/路径).
    (2)在tomcat8/conf/server.xml文件里的<Connector port="8080" ....>标签里添加URIEncoding="UTF-8"选项(应该是为了显示中文), 如:
    <Connector port="8080" URIEncoding="UTF-8" ...

    (3)添加环境变量CATALINA_HOME=/your/path/tomcat8
    (4)添加$CATALINA_HOME/bin to PATH
    此时的 ~/.bashrc文件:
    ......
    
    export JAVA_HOME=/home/bosheng/work/javafile/jdk1.8.0_141
    export JRE_HOME=${JAVA_HOME}/jre
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
    # (3)添加的变量
    export CATALINA_HOME=/home/bosheng/work/javafile/tomcat8
    # (4)添加的变量, 用冒号":"把多个PATH变量隔开, 此处有3个PATH变量${JAVA_HOME}/bin和$PATH和${CATALINA_HOME}/bin
    export PATH=${JAVA_HOME}/bin:$PATH:${CATALINA_HOME}/bin
    

    (5)添加JAVA_OPTS, 同样在 ~/.bashrc文件:
    export JAVA_HOME=/home/bosheng/work/javafile/jdk1.8.0_141
    export JRE_HOME=${JAVA_HOME}/jre
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
    export CATALINA_HOME=/home/bosheng/work/javafile/tomcat8
    export PATH=${JAVA_HOME}/bin:$PATH:${CATALINA_HOME}/bin
    # 此为(5)添加的内容
    export JAVA_OPTS="-server -Xmx1028m -XX:MaxMetaspaceSize=512m -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Djava.awt.headless=true -Dcom.sun.management.jmxremote -Dhttp.agent=Sakai -Djava.util.Arrays.useLegacyMergeSort=true"

    (6)在JAVA_OPTS里加入-Dsakai.demo=true , 具体意义不明, 说是填充测试数据用.
    (7)在.../tomcat8/conf/context.xml里的<Context>...</Context>标签范围内加入:
           <JarScanner>
            <!-- This is to speedup startup so that tomcat doesn't scan as much -->
            <JarScanFilter defaultPluggabilityScan="false"
    defaultTldScan="false"
    tldScan="jsf-impl-*.jar,jsf-widgets-*.jar,myfaces-impl-*.jar,pluto-taglib-*.jar,sakai-sections-app-util-*.jar,spring-webmvc-*.jar,standard-*.jar,tomahawk*.jar,tomahawk-*.jar"/>
        </JarScanner>

  3. 将下载好的sakai11-binary直接解压到 .../tomcat8/目录下(有替换则替换, 有覆盖则覆盖).

  4. 配置sakai:
    (1)我选择version 10.0 的官方default.sakai.properties文件来配置.
    (2)在.../tomcat8/下建立sakai文件夹, 在sakai/下建立home文件夹, 并home/下创建名为sakai.properties的文件.
    (3)把default.sakai.properties里的内容复制到sakai.properties并保存.
    (4)在JAVA_OPTS里加入-Dsakai.home=/path/to/desired/sakai/home/

    最终的 ~/.bashrc文件:
    export JAVA_HOME=/home/bosheng/work/javafile/jdk1.8.0_141
    export JRE_HOME=${JAVA_HOME}/jre
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
    export CATALINA_HOME=/home/bosheng/work/javafile/tomcat8
    export PATH=${JAVA_HOME}/bin:$PATH:${CATALINA_HOME}/bin
    # 加入了-Dsakai.demo=true和-Dsakai.home=/your/path/tomcat8/sakai/home/
    export JAVA_OPTS="-server -Xmx1028m -XX:MaxMetaspaceSize=512m -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Djava.awt.headless=true -Dcom.sun.management.jmxremote -Dhttp.agent=Sakai -Djava.util.Arrays.useLegacyMergeSort=true -Dsakai.demo=true -Dsakai.home=/home/bosheng/work/javafile/tomcat8/sakai/home/"

  5. 安装mysql, 参考文章, 安装完成并建立root用户后:
    (1)下载数据库驱动: 我的Mysql版本为5.5.x, 所以下载的是MySQL Connector/J 5.1.13+, 根据官方安装指引选择自己环境适合的驱动, 下载页面.
    (2)将下载好的驱动解压, 并把其中的mysql-connector-java-5.1.43-bin.jar复制到tomcat8/lib/下.
    (3)修改tomcat8/sakai/home/sakai.properties文件(默认配置, 复制粘贴即可):
    Excerpt from sakai.properties
    username@javax.sql.BaseDataSource=sakaiuser
    password@javax.sql.BaseDataSource=sakaipassword
    ## MySQL settings
    vendor@org.sakaiproject.db.api.SqlService=mysql
    driverClassName@javax.sql.BaseDataSource=com.mysql.jdbc.Driver
    hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
    url@javax.sql.BaseDataSource=jdbc:mysql://127.0.0.1:3306/sakaidatabase?useUnicode=true&characterEncoding=UTF-8
    validationQuery@javax.sql.BaseDataSource=select 1 from DUAL
    defaultTransactionIsolationString@javax.sql.BaseDataSource=TRANSACTION_READ_COMMITTED

    (4)创建sakai数据库及用户:
    mysql -u root -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 272
    Server version: 5.1.46 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    This software comes with ABSOLUTELY NO WARRANTY. This is free software,
    and you are welcome to modify and redistribute it under the GPL v2 license
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    mysql> create database sakaidatabase default character set utf8;
    Query OK, 1 row affected (0.00 sec)
    
    mysql> grant all on sakaidatabase.* to sakaiuser@'localhost' identified by 'sakaipassword';
    Query OK, 0 rows affected (0.00 sec
    
    mysql> grant all on sakaidatabase.* to sakaiuser@'127.0.0.1' identified by 'sakaipassword';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> quit

  6. 在tomcat8/bin下,
    启动命令:
    sh startup.sh
    初次运行, 需要等待一段时间大概3-5分钟保险一点. 之后在浏览器输入http://localhost:8080/portal ,方可访问中文内容的sakai11

    关闭命令:
    sh shutdown.sh




 类似资料: