Wisemapping in Ubuntu 14.04 x64 server

Wisemapping

環境 : Ubuntu 14.04 x64 server

  1. 檢查系統是否已裝了 java development kit,如果是openjdk就先移除掉
java -version
  1. 安裝 Java Development Kit (版本>7)
sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
  1. 下載 wisemapping binary檔案
wget https://bitbucket.org/wisemapping/wisemapping-open-source/downloads/wisemapping-v3.0.4.zip
  1. 安裝 unzip
sudo apt-get install unzip
  1. 解壓縮 wisemapping 檔案
unzip wisemapping-v3.0.4.zip
  1. 切換到 wisemapping 目錄中
cd wisemapping-v3.0.4
  1. 測試執行
java -Dorg.apache.jasper.compiler.disablejsr199=true -jar start.jar
# 看到 INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080 代表正常啟動
# 可用瀏覽器觀看 http://ip:8080/wisemapping
  1. 安裝 mysql server、nginx
sudo apt-get install mysql-server nginx
  1. 編輯 wisemapping mysql 創建db的設定檔
vim config/database/mysql/create-database.sql
# 將password更改為要使用的密碼
SET PASSWORD FOR 'wisemapping'@'localhost' = PASSWORD('password');
  1. 匯入 wisemapping 資料庫
mysql -uroot -p < config/database/mysql/create-database.sql 
mysql -uwisemapping -Dwisemapping -p < config/database/mysql/create-schemas.sql
mysql -uwisemapping -Dwisemapping -p < config/database/mysql/apopulate-schemas.sql
  1. 修改 wisemapping 基本設定檔
vim webapps/wisemapping/WEB-INF/app.properties
# 將HSQL的部分註解
# HSQL Configuration properties
#database.url=jdbc:hsqldb:file:webapps/wisemapping/WEB-INF/database/wisemapping
#database.driver=org.hsqldb.jdbc.JDBCDriver
#database.hibernate.dialect=org.hibernate.dialect.HSQLDialect
#database.username=sa
#database.password=
#database.validation.enabled=false
#database.validation.query=

# 將mysql的設定反註解,並修改密碼
# MySQL 5.X configuration properties
database.url=jdbc:mysql://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8
database.driver=com.mysql.jdbc.Driver
database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
database.username=wisemapping
database.password=password
database.validation.enabled=true
database.validation.query=SELECT 1

# 將Plain SMTP Server的部分註解
#------------------------
# Plain SMTP Server Configuration
#------------------------
#mail.smtp.port=25
#mail.smtp.host=localhost
#mail.username=root
#mail.password=
#mail.smtp.auth=false
#mail.smtp.starttls.enable=false
#mail.smtp.quitwait=false

# 使用google smtp,將其反註解,並填入設定值
#------------------------
# GMAIL SMTP Configuration
#------------------------
mail.smtp.port=587
mail.smtp.host=smtp.gmail.com
mail.username=cowman.chiang@gmail.com
mail.password=password
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.quitwait=false

# 設定e-mail相關設定值
mail.serverSendEmail=cowman.chiang@gmail.com
mail.supportEmail=cowman.chiang@gmail.com
mail.errorReporterEmail=cowman.chiang@gmail.com

# 取消google reptcha功能
google.recaptcha.enabled = false

# 因為會使用到proxy,所以一定要設定site.baseurl
site.baseurl = http://10.201.121.16:8080/wisemapping
  1. 設定nginx proxy
sudo vim /etc/nginx/sites-available/default
# 幹掉全部~加入下面的部分
server {
    listen       80;
    access_log   /var/log/nginx/wisemapping.log;
    error_log    /var/log/nginx/wisemapping.log;
    location / {
        proxy_pass        http://localhost:8080/;
        proxy_set_header  Host $host;
        proxy_buffering   off;
    }
}
  1. 啟動服務
java -Dorg.apache.jasper.compiler.disablejsr199=true -jar start.jar
# 因為設定過proxy,所以可用瀏覽器觀看 http://ip/wisemapping
  1. 管理,因為目前尚未提供web介面的管理,所以僅能使用curl方式從後台管理
sudo apt-get install curl
# 查詢使用者id
 curl "http://localhost:8080/wisemapping/service/admin/users/email/{使用者帳號信箱}.json" --get --basic -u "admin@wisemapping.org:admin"
# 取回json格式的資料
# {"password":null,"tags":[],"email":"cowman.chiang@gmail.com","firstname":"cowman","lastname":"chiang","creationDate":1415635200000,"id":5}
# 刪除使用者,由上面可以得知id為5
curl "http://localhost:8080/wisemapping/service/admin/users/{使用者ID}" --request delete --basic -u "admin@wisemapping.org:admin"
  1. 加入開機啟動
# 先修改start.sh
vim start.sh
# 修改為
#!/bin/sh

set -e
cd /home/tdg/wisemapping-v3.0.4
java -Xmx256m -Dorg.apache.jasper.compiler.disablejsr199=true -jar start.jar
# 修改rc.local
sudo vim /etc/rc.local
# 加入下面
/bin/sh /home/tdg/wisemapping-v3.0.4/start.sh
This entry was posted in MySQL, Ubuntu, Wisemapping. Bookmark the permalink.