======The Cumulocity agent in LXC Container ====== ====Create a new LXC Container==== First you have to create e new container. To do this please follow this: [[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. 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 ====Build the agent==== Now we need to make some installation. #g++ apt-get install g++ #curl and libcurl apt-get install libcurl3-dev & apt-get install curl #make for Makefile apt-get install make Download the Cumulocity C/C++ SDK: wget https://bitbucket.org/m2m/cumulocity-sdk-c/get/d627781f3afa.zip unzip d627781f3afa.zip cd m2m-cumulocity-sdk-c-d627781f3afa Create an init.mk file, and define specific macros CPPFLAGS, CXXFLAGS and LDFLAGS, LDLIBS and CXX for compiling. CXX:=/usr/bin/g++ CPPFLAGS:=-I/usr/include CXXFLAGS:=-Wall -pedantic -Wextra LDFLAGS:=-L/usr/lib LDLIBS:=-lcurl If you have defined init.mk now you have to create the makefile. cp Makefile.template Makefile Add the Cumulocity agent to the SDK:{{:app-notes:netmodulecumulocityagentlxc.tar.gz|}} tar -xvzf netmodulecumulocityagentlxc.tar.gz cd netmoduleCumulocityAgentLXC Move the content of **src** folder to the **src** folders of the SDK. cp src/* sdk_folder/src/ #Copy also the srtemplate.txt cp srtemplate.txt sdk_folder/src/ Edit the configfile (c8yAgent.conf) and move it. cp c8yAgent.conf /etc/ Now we can build the agent. make #If you want, you can delete all and rebuild again: make clean make Now go to the **src** folder. make chmod 775 -R main ./main