Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
app-notes:cumulocity-agent-in-lxc-container [2017/02/08 10:26]
shasha
app-notes:cumulocity-agent-in-lxc-container [2017/02/10 12:03] (current)
shasha [Build the agent]
Line 4: Line 4:
  
 [[http://​wiki.netmodule.com/​app-notes/​virtualisation?​s[]=lxc|LXC Virtualization]] [[http://​wiki.netmodule.com/​app-notes/​virtualisation?​s[]=lxc|LXC Virtualization]]
 +====Generate a new SSH public key====
 +We need for the agent SSH. We create the key in the lxc container.
 +<code bash>
 +ssh-keygen
 +#The new key
 +cat /​root/​.ssh/​id_rsa.pub
 +#cp the key and go to the router and copy the key in this file
 +vi /​etc/​dropbear/​authorized_keys
 +</​code>​
 ====Build the agent==== ====Build the agent====
 Now we need to make some installation. Now we need to make some installation.
Line 19: Line 28:
 cd m2m-cumulocity-sdk-c-d627781f3afa cd m2m-cumulocity-sdk-c-d627781f3afa
 </​code>​ </​code>​
-Create an init.mk file, and define specific macros CPPFLAGS, CXXFLAGS and LDFLAGS, LDLIBS and CXX for cross-compiling.+Create an init.mk file, and define specific macros CPPFLAGS, CXXFLAGS and LDFLAGS, LDLIBS and CXX for compiling.
 <code bash> <code bash>
 CXX:​=/​usr/​bin/​g++ CXX:​=/​usr/​bin/​g++
Line 31: Line 40:
 cp Makefile.template Makefile cp Makefile.template Makefile
 </​code>​ </​code>​
-Add the Cumulocity agent to the SDK:+Add the Cumulocity agent to the SDK:{{:​app-notes:​netmodulecumulocityagentlxc.tar.gz|}}
 <code bash> <code bash>
-tar xvf netmoduleCumulocityAgent.tar +tar -xvzf netmodulecumulocityagentlxc.tar.gz 
-cd netmoduleCumulocityAgent+cd netmoduleCumulocityAgentLXC
 </​code>​ </​code>​
-Move the content of **src** ​and **include** folders ​to the **src** and **include** folders of the SDK.+Move the content of **src** ​folder ​to the **src** folders of the SDK.
 <code bash> <code bash>
 cp src/* sdk_folder/​src/​ cp src/* sdk_folder/​src/​
-cp include/​* ​sdk_folder/include/+#Copy also the srtemplate.txt 
 +cp srtemplate.txt ​sdk_folder/src/
 </​code>​ </​code>​
 Edit the configfile (c8yAgent.conf) and move it. Edit the configfile (c8yAgent.conf) and move it.
 <code bash> <code bash>
 cp c8yAgent.conf /etc/ cp c8yAgent.conf /etc/
 +</​code>​
 +Now we can build the agent.
 +<code bash>
 +make
 +
 +#If you want, you can delete all and rebuild again:
 +make clean
 +make
 +</​code>​
 +Now go to the **src** folder.
 +<code bash>
 +make
 +chmod 775 -R main
 +</​code>​
 +<code bash>
 +./main
 </​code>​ </​code>​