-
Notifications
You must be signed in to change notification settings - Fork 87
Mobius_v2.0.0_EN_Windows
Installation Guide for Mobius_v2.0.0 with Windows (English)
Mobius server platform deploys MySQL DBMS as a database so MySQL is required to be installed as a basic and then MQTT server and Mobius server have to install one by one. Note that it is unnecessary to install MQTT server if MQTT protocol and MQTT related functions are not supported.
Mobius server platform stores the data uploaded from devices into MySQL database. MySQL is an open source RDBMS and the installation procedures are introduced as follows:
Different versions of MySQL are provided for downloading at below link:
http://dev.mysql.com/downloads/mysql.
There is a MySQL community server version for free downloading. Users could also select to download MySQL Enterprise Edition or MySQL Cluster CGE version which need to buy licenses before starting use. User can choose to install a light MSI installer which installs all required MySQL packages online or a standalone version that contains all required packages. If users prefer to install using zip archive, you can download and install as shown as Figure.
Here we demonstrate downloading the free version MySQL community server and you can find it from the top ‘Downloads’ menu tab and we select to install a Windows 64bit version MySQL through MySQL installer as shown as Figure.
The MySQL can be easily installed following the procedures as depicted as Figure.
① Read and accept the license agreement, then
② Choose a Setup type: A list of setup types “Developer Default, Server only, Client only, Full or Custom” are available to install. Here we recommend to select “Custom” and then select only two packages “MySQL Server” and “MySQL Workbench” to install.
③Install automatically the selected packages and after successful installation, then
④Configure the MySQL runtime environment shown as Figure.
i. Configure the machine type to either ‘Development Machine’, ‘Server Machine’, or ‘Dedicated Machine’. Here we select option ‘Development Machine’ to configure.
ii. Set ‘root’ account passwords and optionally create users with different privileges to access to the MySQL.
iii. Configure MySQL server as a Window Service and finally apply the user configurations to MySQL server.
iv. Input the root password and check the connection status to the configured MySQL as shown as Figure.
Run MySQL workbench and create a MySQL connection and then connect to MySQL server with root password as shown as Figure.
MySQL workbench provides both a graphical user interface (GUI) and command line to manage the database, data tables, import and output existing database as well as execution of queries. If users are familiar with MySQL commands, you can choose command line to input commands to control MySQL database. Here we demonstrate how to configure MySQL database through workbench GUI.
Until this step, we have installed MySQL successfully and then we have to configure the MySQL in terms of creation of a database for Mobius. In OCEAN alliance website download page, a MySQL database file can be downloaded to use. How to download and import that file will be explained later.
Step 1: Create a Mobiusdb Schema
After the MySQL is connected properly, right click the mouse at the workbench GUI as depicted as Figure and create a schema using popped tab. Name the new schema as mobiusdb and apply the schema creation. Then you can see the new created mobiusdb schema at the SCHEMA column at the left down side of GUI, select the mobiusdb schema and right click to select Set as Default Schema to set the current schema as default.
Step 2: Import Mobiusdb database
All we need regarding for configuring Mobius database are bundled into a sql script file (mobiusdb.sql). Users can download freely the .sql scipt file from OCEAN alliance website Mobius page. As depicted as Figure, import the downloaded .sql script file through Data Import popped window. In Import from Disk tab, select option Import from Self-Contained File and browse to the downloaded .sql script and select the default schema to be imported to as created mobiusdb schema. Finally click the Start Import to apply the change. After the .sql file is imported, refresh the mobiusdb schema and you can see the mobiusdb schema is updated with empty tables are updated.
Mobius enables IoT devices to communicate with MQTT server through MQTT protocol. To this end, a MQTT broker needs to be installed. We prefer to use open source MQTT broker Mosquitto server. Note: MQTT protocol can optionally be supported, if users will not implement MQTT functionalities, step “installation of MQTT server” can be ignored. The Mosquitto server can be freely downloaded from Mosquitto Downloads page as shown as Figure. You can see the source and binary versions of Mosquitto with latest and older versions in the download page. Here we prefer to download an older version as highlighted in Figure. If users prefer to use latest functionalities of Mosquitto broker, latest version is recommended.
We download a Mosquitto from http://mosquitto.org/files/ as shown as Figure 21 and install it just following set up wizard as shown as Figure.
After installed Mosquitto broker, we can test whether the Mosquitto broker works properly or not as following:
Step -1: Subscription test
⑤ Open a Windows Command Prompt (window-A), go to Mosquitto installation directory (default installation directory is C:\Program Files (x86)\mosquitto) and input command as below
mosquitto_sub.exe -h localhost -t /mytopic/1
Step -2: Notification test
⑥Open a new Windows Command Prompt (window-B), go to Mosquitto installation directory (default installation directory is C:\Program Files (x86)\mosquitto) and input command as below
mosquitto_pub.exe -h localhost -t /mytopic/1 -m "Hello MQTT test"
Step -3: Check whether there is ‘Hello MQTT test’ received in window-B as shown as Figure.
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. In contrast to multi-thread based servers, node.js operating on a single thread using non-blocking I/O calls allows it to support tens of thousands of concurrent connections. With node.js, users don’t need worry about the dead-locking of processes because almost no function in node.js directly performs I/O so there is no locks problem at all and therefore, scalable systems can be reasonably developed through node.js.
Node.js was originally written by developer Ryan Dahl in 2009 and distributed as an open source and currently a diverse of modules developed from contributors are included covering file system I/O, networking, binary data (buffers), cryptography and data streams etc.
For more details about Node.js, please visit Node.js homepage as show as Figure.
A number of versions (binary/source) support for different platforms are provided in NodeJs Downloads page as shown as Figure. Users can download a preferred version from here and install it following set up wizard.
After installation of Node.js, check the system environment variables table (here taking Windows system as an example) to ensure that the installation path of node.js (default is C:\Program File\nodejs) is already added automatically in PATH environment variable and if there is no node.js path, update the PATH with node.js path as shown as Figure.
To test whether Node.js is installed properly, open a Windows Command Prompt window and under the user directory, run node command to enable node.js mode. In the node.js mode, input console.log("hello node.js"); if receives response hello node.js then it indicates the Node.JS are installed and works properly.
Mobius server platform is distributed with the source code package in OCEAN alliance website (http://www.iotocean.org) or the Mobius GitHub (https://github.com/IoTKETI/Mobius ).
User can download the zipped package and configure the Mobius server in terms of communication port and CSE name etc. following this Mobius user guide.
After downloading, unzip the package and you will see the included folders and files as Figure. The roles of files are introduced in Table.
The unzipped node.js files can be directly executed without any additional compiling operation. But there are several node.js modules are not yet installed. To installed the required additional node.js modules, open a Windows command prompt window and go to the directory where the unzipped package and run npm install command as shown as Figure Run npm install command to install additional node.js modules. <.br>
After running the npm install command, all additional required node.js modules will be generated and stores in node_modules folder as shown as Figure Installation of additional node.js modules You can see there is a node_modules folder in the unzipped mobius source folder as shown as Figure.
Until this step, we have installed all required software and modules to run Mobius server. Users can run node mobius.js in the command line to activate the Mobius server. The installation of Mobius server is almost done and only a few configurations are left.
A configuration file conf.json is included in the unzipped folder of Mobius package. User can customize the communication port csebaseport for CSEBase which is the root of all resources to be created in hierarchical structure in Mobius server, and the MySQL database connection password dbpass as shown as Figure. These configurations are required to guarantee the Mobius server is accessible from the CSEBase port and the Mobius server can access to the MySQL database with the configured password. In addition, there are configuration data included in mobius.js module file as shown as Figure.
Until this step, we have done all installation and configurations for the Mobius server platform.
Now users can run node mobius.js command to run Mobius server and it runs as shown as Figure.
Refer to the oneM2MBrowser manual from OCEAN webpage.
http://iotocean.org/archives/module/onem2mbrower
The Mobius server accepts valid HTTP request in terms of POST, GET, PUT and DELETE request following oneM2M service primitives. In this session, we provide several examples to test against the installed Mobius server platform using Postman Rest Client (hereafter short for Postman). Postman is a Google Chrome extension which you can use to easily test Web API methods. It can also be used against 3rd party APIs. We use Postman to test Mobius APIs.
Users can install Postman through Google Chrome web browser. Go to the Chrome Settings option and it brings you to the Chrome Extension (plugins) page where there is a ‘Get more extensions’ option through which more extensions can be downloaded as shown as Figure.
Postman provides an user interface to specify request headers and request body (if any). To simplify the test of Mobius API, we provide a collection of Postman script written for testing Mobius API. The Postman script is represented as a json file can be downloaded from OCEAN or GitHub. After download the Postman script, open the Postman and import the script as shown as Figure.
① In ‘Collections’ view, a group of Postman scripts are listed
② Click ‘Import’ button and
③ browse the downloaded script from the saved directory then the Postman script can be automatically added into the collections list.
If the Postman script is imported successfully, a new collection will be displayed at the top of collections list shown as Figure. The script is designed to test Mobius-YT API in terms of oneM2M CREATE, RETRIEVE, UPDATE, and DELETE operations for oneM2M primitives represented in XML and JSON serializations.
To access to the Mobius-YT server, the access configurations in terms of host and port, as well as the CSEBase name for the Mobius-YT server, need to be configured in Postman environment. To this end, go to the setting and select the ‘Manage Environments’ option in the option list then it pops a window where lists all existing configured environments as shown as Figure. User can edit existing or add a new environment by clicking ‘Add’ at the right bottom and in the popped window input Mobius server access configurations in terms of host and CSEBase name as shown as Figure.
① Name the new environment, e.g. Mobius_config
② {{mp_url}}: specify the host and port number of Mobius server
③ {{cb}}: specify CSEBase name of Mobius server
④ Apply the changes
Besides, there is another way to get the Postman environment, i.e. import directly an environment (POSTMAN Environment Script) that can be downloaded from OCEAN or GitHub.
After downloading the Postman environment script, import into Postman following steps as shown as Figure.
① Click ‘Import’ and then pops up a window to choose files
② Browse the downloaded Postman environment script from the saved directory
③ After imported successfully, you can see a new environment is added in the Manage Environments list
To demonstrate how to use Postman to test Mobius API in case users don’t know how to use Postman. If you are familiar with Postman, just skip this.
Here we demonstrate CSEBase RETRIEVE request which try to retrieve the CSEBase information from Mobius server. Mapping to REST request,
① To use HTTP GET method
② Specify the Mobius server access URL
③ Specify HTTP Headers (at least mandatory headers)
④ Send request to Mobius server
⑤ Check the response status code: 200 OK indicates request was accepted and response is returned successfully
⑥ Check the returned CSEBase information
Users can test other scripts to deep understand the Mobius server API and we recommend to refer to Mobius REST Reference API User Guide to use and extend Mobius to apply with user-customized services.
- Jaeho Kim, Team Manager ([email protected])
- Il Yeup Ahn, R&D Manager ([email protected])
- Jae-Hyun Lim ([email protected])
- Chanhyung Lee ([email protected])