環境
- ubuntu 16.04 LTS
- aws
- java 1.8.0をインストール済み
om2mをインストール
まずはmavenをインストール
bash
$ sudo apt upgrade
$ sudo apt install maven
# バージョンを確認
$ mvn -version
# 以下が表示される
Warning: JAVA_HOME environment variable is not set.
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_181, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.4.0-1069-aws", arch: "amd64", family: "unix"
# どうやらJAVA_HOMEの環境変数が設定できてないらしい
# 以下を設定 Java home: ***の部分のパスを{}に挿入
export JAVA_HOME={***}
# また確認
$ mvn -version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_181, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.4.0-1069-aws", arch: "amd64", family: "unix"
om2mのビルド
Clone
bash
sudo git clone https://git.eclipse.org/r/om2m/org.eclipse.om2m
ディレクトリを確認
bash
$ ls
Mobius org.eclipse.om2m
jdkのインストール
jdkをインストールしないでビルドしようとするとエラーが出るためインストール
bash
$ sudo apt install default-jdk
om2mのビルド
bash
$ cd org.eclipse.om2m
$ sudo mvn clean install
# 最後に以下のように表示されれば成功
[INFO] Reactor Summary:
[INFO]
[INFO] org.eclipse.om2m :: parent ......................... SUCCESS [ 10.408 s]
[INFO] org.eclipse.om2m :: commons ........................ SUCCESS [ 17.989 s]
[INFO] org.eclipse.om2m :: logging fragment ............... SUCCESS [ 0.081 s]
[INFO] org.eclipse.om2m :: binding service ................ SUCCESS [ 0.212 s]
[INFO] org.eclipse.om2m :: core service ................... SUCCESS [ 0.232 s]
[INFO] org.eclipse.om2m :: binding http ................... SUCCESS [ 0.406 s]
[INFO] org.eclipse.om2m :: binding coap ................... SUCCESS [ 0.323 s]
[INFO] org.eclipse.om2m :: data mapping service ........... SUCCESS [ 0.196 s]
[INFO] org.eclipse.om2m.binding.mqtt ...................... SUCCESS [ 0.347 s]
[INFO] org.eclipse.om2m :: datamapper jaxb ................ SUCCESS [ 0.714 s]
[INFO] org.eclipse.om2m :: webapp resourcesbrowser xml .... SUCCESS [ 0.286 s]
[INFO] org.eclipse.om2m :: webapp resourcesbrowser json ... SUCCESS [ 0.302 s]
[INFO] org.eclipse.om2m :: persistence service ............ SUCCESS [ 0.220 s]
[INFO] org.eclipse.om2m :: persistence eclipselink ........ SUCCESS [ 0.909 s]
[INFO] org.eclipse.om2m :: persistence mongodb ............ SUCCESS [ 0.586 s]
[INFO] org.eclipse.om2m :: flexcontainer service .......... SUCCESS [ 0.195 s]
[INFO] org.eclipse.om2m :: interworking service ........... SUCCESS [ 0.200 s]
[INFO] org.eclipse.om2m :: core ........................... SUCCESS [ 0.846 s]
[INFO] org.eclipse.om2m :: ipe sample ..................... SUCCESS [ 0.381 s]
[INFO] org.eclipse.om2m.das.testsuite ..................... SUCCESS [ 0.351 s]
[INFO] org.eclipse.om2m :: flexcontainer test suite ....... SUCCESS [ 0.396 s]
[INFO] org.eclipse.om2m.sdt ............................... SUCCESS [ 0.008 s]
[INFO] org.eclipse.om2m.sdt.api ........................... SUCCESS [ 0.355 s]
[INFO] org.eclipse.om2m.sdt.home .......................... SUCCESS [ 0.462 s]
[INFO] org.eclipse.om2m.sdt.home.tester ................... SUCCESS [ 0.249 s]
[INFO] org.eclipse.om2m.sdt.home.driver ................... SUCCESS [ 0.224 s]
[INFO] org.eclipse.om2m.sdt.home.enocean .................. SUCCESS [ 0.301 s]
[INFO] org.eclipse.om2m.sdt.home.cloud .................... SUCCESS [ 0.282 s]
[INFO] org.eclipse.om2m.sdt.home.lifx ..................... SUCCESS [ 0.381 s]
[INFO] org.eclipse.om2m.sdt.home.netatmo .................. SUCCESS [ 19.309 s]
[INFO] org.eclipse.om2m.sdt.home.smartercoffee ............ SUCCESS [ 1.383 s]
[INFO] org.eclipse.om2m.sdt.home.mocked.devices ........... SUCCESS [ 0.380 s]
[INFO] org.eclipse.om2m.sdt.home.utils .................... SUCCESS [ 0.265 s]
[INFO] org.eclipse.om2m.sdt.home.applications ............. SUCCESS [ 0.008 s]
[INFO] org.eclipse.om2m.sdt.home.monitoring ............... SUCCESS [ 0.460 s]
[INFO] org.eclipse.om2m :: IPE SDT ........................ SUCCESS [ 0.310 s]
[INFO] org.eclipse.om2m :: SDT IPE sample ................. SUCCESS [ 0.313 s]
[INFO] org.eclipse.om2m :: IPE SDT Test Suite ............. SUCCESS [ 0.327 s]
[INFO] org.eclipse.om2m :: sdt comparator xml ............. SUCCESS [ 0.362 s]
[INFO] org.eclipse.om2m :: asn product .................... SUCCESS [ 7.414 s]
[INFO] org.eclipse.om2m :: dal ............................ SUCCESS [ 0.030 s]
[INFO] org.eclipse.om2m :: dal driver sample .............. SUCCESS [ 0.335 s]
[INFO] org.eclipse.om2m :: ipe dal ........................ SUCCESS [ 0.248 s]
[INFO] org.eclipse.om2m :: in product ..................... SUCCESS [ 4.147 s]
[INFO] org.eclipse.om2m :: mn product ..................... SUCCESS [ 6.544 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:17 min
[INFO] Finished at: 2018-10-26T10:19:36+00:00
[INFO] Final Memory: 168M/239M
[INFO] ------------------------------------------------------------------------
上記のように表示されればビルド成功.
表示されなければ失敗しているので頑張って.
#IN-CSEの起動
以下のディレクトリに移動
bash
$ cd ~/org.eclipse.om2m/org.eclipse.om2m.site.in-cse/target/products/in-cse/linux/gtk/x86_64
ディレクトリの中身の確認
以下のように表示されるはず
bash
$ ls
Californium.properties artifacts.xml configuration database eclipse.ini log.out log4j.configuration p2 plugins start.bat start.sh
以下のコマンドでパーミッションを実行可能にする
bash
$ sudo chmod u+x start.sh
以下のコマンド入力でIN-CSEが起動する
bash
$ sudo ./start.sh
ちなみに
bash
$ ~/org.eclipse.om2m/org.eclipse.om2m.site.in-cse/target/products/in-cse/linux/gtk/x86_64/configuration
# 上記のディレクトリに移動して
$ ls
config.ini org.eclipse.osgi
# config.iniを編集することで外部からのアクセスを有効にすることができる
$ sudo nano config.ini
config.ini
#This configuration file was written by: org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser
#Fri Oct 26 10:19:28 UTC 2018
log4j.configuration=file\:./log4j.configuration
org.eclipse.equinox.http.jetty.http.port=8080
org.eclipse.om2m.dbReset=false
org.eclipse.om2m.cseBaseContext=/
org.eclipse.om2m.globalContext=
osgi.bundles=reference\:file\:javax.servlet_3.1.0.v201410161800.jar@4,reference\:file\:javax.xml_1.3.4.v201005080400.jar@4,reference\:file\:org.apache.commons.codec_1.6.0.v201305230611.jar@4,reference\:file\:org.apache.commons.logging_1.1.1.v201$
org.eclipse.om2m.cseBaseProtocol.default=http
org.eclipse.om2m.cseBaseName=in-name
org.eclipse.om2m.cseBaseAddress=127.0.0.1 # ここを編集
eclipse.p2.profile=DefaultProfile
org.eclipse.om2m.dbUrl=jdbc\:h2\:./database/indb;MULTI_THREADED\=1
osgi.framework.extensions=
org.eclipse.om2m.webInterfaceContext=/webpage
osgi.bundles.defaultStartLevel=4
org.eclipse.om2m.dbUser=om2m
osgi.framework=file\:plugins/org.eclipse.osgi_3.10.2.v20150203-1939.jar
org.eclipse.om2m.subscriptions.nbOfFailedNotificationsBeforeDeletion=3
org.eclipse.om2m.guestRequestingEntity=guest\:guest
org.eclipse.om2m.cseBaseId=in-cse
org.eclipse.om2m.dbDriver=org.h2.Driver
equinox.use.ds=true
org.eclipse.om2m.adminRequestingEntity=admin\:admin
org.eclipse.om2m.cseType=IN-CSE
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
eclipse.p2.data.area=@config.dir/../p2
org.eclipse.om2m.dbUrl_mongodb=127.0.0.1
org.eclipse.om2m.resource.idseparator=-
org.eclipse.om2m.coap.port=5683
org.eclipse.om2m.dbPassword=om2m
org.eclipse.om2m.m2mSpId=om2m.org
#参考資料