This is an old revision of the document!


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:

LXC Virtualization

Generate a new SSH public key

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 cross-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:

tar xvf netmoduleCumulocityAgent.tar
cd netmoduleCumulocityAgent

Move the content of src folder to the src folders of the SDK.

cp src/* sdk_folder/src/
cp include/* sdk_folder/include/
#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
./main