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

centos iotivity安装使用

邢寒
2023-12-01

iotivity代码地址

https://github.com/iotivity/iotivity

相关资料

cloud结构:https://wiki.iotivity.org/iotivity_cloud

使用指南:https://wiki.iotivity.org/iotivity_cloud_-_programming_guide。

iotivity基于tcp的coap协议。


一、服务器端安装(微软云centos6.9):

安装git(如果没有的话)sudo yum install git

安装jdk1.8

安装maven3.2.3

安装kafka和zookeeper(由于kafka自带zookeeper,所以不需单独安装zookeeper)。下载地址。https://mirrors.tuna.tsinghua.edu.cn/apache/kafka/0.11.0.0/kafka_2.11-0.11.0.0.tgz。http://kafka.apache.org/quickstart

安装mongodb,参考https://docs.mongodb.com/master/tutorial/install-mongodb-on-red-hat/

mongodb-org-3.4.repo

[mongodb-org-3.4]

name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc

sudo yum install -y mongodb-org


使用git下载iotivity代码。然后根据https://wiki.iotivity.org/iotivity_cloud_-_programming_guide进行编译打包。由于版本的不同,启动各个服务的时候请参考每个模块下的readme。

stack ,resourcedirectory,account,messagequeue,interface分别执行。

mvn install -Dmaven.test.skip=true


启动mongodb(默认端口27017),启动zookeeper(默认端口2181),启动kafka(默认端口9092)。

systemctl start mongod

bin/zookeeper-server-start.sh config/zookeeper.propties 

bin/kafka-server-start.sh config/server.properties 


启动RD,MQ,Account,CI.

java -jar CloudResourceDirectory-0.0.1-SNAPSHOT.jar 5684  127.0.0.1 27017 0

java -jar CloudMessageQueue-0.0.1-SNAPSHOT.jar 5686 127.0.0.1 2181 127.0.0.1 9092 0

java -jar CloudAccount-0.0.1-SNAPSHOT.jar 5685 127.0.0.1 27017 0(cp -rp properties/ target/)

java -jar CloudInterface-0.0.1-SNAPSHOT.jar 5683 127.0.0.1 5684 127.0.0.1 5685 127.0.0.1 5686 8080 9080 0


安装nvm(https://github.com/creationix/nvm#installation)

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

使用nvm安装node,/etc/profile增加源。由于使用taomao源总报校验码不匹配(暂未查出原因),所以还是修改为使用node源


#export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node

export NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist

nvm install 4.2.6


启动dashboard

npm --registry=https://registry.npm.taobao.org --disturl=https://npm.taobao.org/mirrors/node install

npm start

安装(微软云centos7.3):

同centos6.9.centos7.3和6.9服务器端均能鼓正常启动。


二、客户端编译安装(centos6)。

sudo yum update

sudo yum install git lrzsz 


sudo yum install screen 

sudo rpm -Uvh tmux-1.6-3.el6.x86_64.rpm (http://mirror.centos.org/centos/7/os/x86_64/Packages/tmux-1.8-4.el7.x86_64.rpm)

sudo rpm -Uvh byobu-5.73-4.el6.noarch.rpm (http://dl.fedoraproject.org/pub/epel/6/x86_64//byobu-5.73-4.el6.noarch.rpm)


git clone https://github.com/iotivity/iotivity.git


sudo yum install scons


git clone https://github.com/01org/tinycbor.git extlibs/tinycbor/tinycbor


http://219.238.7.70/files/310100000A559F50/www.sqlite.org/2017/sqlite-autoconf-3190300.tar.gz

http://www.sqlite.org/2017/sqlite-tools-linux-x86-3190300.zip


http://rpm.pbone.net/index.php3/stat/4/idpl/33795931/dir/centos_6/com/libcurl-openssl-7.43.0-1.1.x86_64.rpm.html

ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/Scott_Cantor/CentOS_6/x86_64/libcurl-openssl-7.43.0-1.1.x86_64.rpm

http://rpm.pbone.net/index.php3/stat/4/idpl/33795932/dir/centos_6/com/libcurl-openssl-devel-7.43.0-1.1.x86_64.rpm.html

ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/Scott_Cantor/CentOS_6/x86_64/libcurl-openssl-devel-7.43.0-1.1.x86_64.rpm


sudo yum install gcc gcc-c++ kernel-devel doxygen valgrind autoconf automake libtool boost-devel boost-thread boost-program-options openssl-devel uuid-devel libuuid-devel libcap-devel sqlite-devel libidn-devel libcurl-openssl-devel-7.43.0-1.1.x86_64.rpm libcurl-openssl-7.43.0-1.1.x86_64.rpm glib2-devel  libcurl-devel expat-devel


在centos6.9执行scons cloud WITH_TCP=yes RELEASE=yes TARGET_TRANSPORT=IP WITH_CLOUD=yes WITH_MQ=PUB,SUB后总提示:

/usr/bin/scons:163: UserWarning: Module __main__ was already imported from /usr/bin/scons, but /usr/lib/python2.6/site-packages is being added to sys.path
  import pkg_resources
scons: Reading SConscript files ...
Reading linux configuration script
Checking for POSIX Thread Support...no
AttributeError: 'module' object has no attribute 'check_output'

怀疑是跟python2.6有关系,所以切换到了centos7上编译安装。


三、客户端编译安装(centos7)

sudo yum update

sudo yum install lrzsz


sudo yum install git


sudo yum install screen

sudo yum install tmux

sudo rpm -Uvh byobu-5.73-4.el7.noarch.rpm(http://dl.fedoraproject.org/pub/epel/7/x86_64/b/byobu-5.73-4.el7.noarch.rpm)


git clone https://github.com/iotivity/iotivity.git

wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/Ledest:/misc/CentOS_7/noarch/scons-2.3.0-1.el7.1.noarch.rpm

rpm -Uvh  scons-2.3.0-1.el7.1.noarch.rpm 


sudo yum install gcc gcc-c++ kernel-devel doxygen valgrind autoconf automake libtool boost-devel boost-thread boost-program-options openssl-devel uuid-devel libuuid-devel libcap-devel sqlite-devel libidn-devel libcurl-openssl-devel-7.43.0-1.1.x86_64.rpm libcurl-openssl-7.43.0-1.1.x86_64.rpm glib2-devel  libcurl-devel expat-2.1.0-10.el7_3.x86_64.rpm


git clone https://github.com/01org/tinycbor.git extlibs/tinycbor/tinycbor

git clone https://github.com/ARMmbed/mbedtls.git extlibs/mbedtls/mbedtls


http://rpm.pbone.net/index.php3/stat/4/idpl/33795972/dir/centos_7/com/libcurl-openssl-devel-7.43.0-1.1.x86_64.rpm.html

http://rpm.pbone.net/index.php3/stat/4/idpl/33795971/dir/centos_7/com/libcurl-openssl-7.43.0-1.1.x86_64.rpm.html

http://mirror.centos.org/centos/7/updates/x86_64/Packages/expat-2.1.0-10.el7_3.x86_64.rpm


Package uuid was not found in the pkg-config search path.
Perhaps you should add the directory containing `uuid.pc'
to the PKG_CONFIG_PATH environment variable
No package 'uuid' found

yum install uuid-devel

同时制作了一份uuid.pc文件.cp ossp-uuid.pc uuid.pc


*********************************** Error *************************************
* Cannot build hue sample. Please install libcurl.
* Example (Ubuntu):
*   sudo apt-get install libcurl4-openssl-dev
*   sudo ldconfig
* Hint: check with pkg-config --libs libcurl and clear scons cache.
* Skipping hue sample build.
*******************************************************************************

这个错误可以忽略


执行scons WITH_TCP=yes RELEASE=false TARGET_TRANSPORT=IP WITH_CLOUD=yes WITH_MQ=PUB,SUB。去掉cloud 将RELEASE=true修改为false编译成功。编译后的文件保存在iotivity/out/linux/x86_64/debug/cloud/samples/client/目录下.


 类似资料: