https://www.javacodegeeks.com/2015/09/how-to-configure-and-install-zeromq-libsodium-on-centos-6-7.html
Steps to a working ZeroMQ 4+ code on CentOS67 # Login as root or make sure you have sudo access # The following instructions assume you are logged in as "root" # Assumes the following path /root/downloads mkdir download cd download # ZeroMQ 4+ requires libsodium # You also need a C compiler # Pre-requisites yum update # Gets your system upto date with the latest updates yum install libtool gcc-c++ glib* # This installs autoconf, automake, cloog-ppl, cpp, gcc, mpfr, ppl yum groupinstall "development tools" # Let us install and build libsodium wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.3.tar.gz tar -xvf libsodium-1.0.3.tar.gz cd libsodium-1.0.3 ./configure make clean make make install # libsodium libraries are now installed under /usr/local/lib directory # Next we need to tell libzmq and other development code where to find these libraries # Add the following exports defining the following environmental libraries # Edit the root users .bashrc file vim /root/.bashrc # Add the following #----- export sodium_CFLAGS="-I/usr/local/include" export sodium_LIBS="-L/usr/local/lib" export CPATH=/usr/local/include export LIBRARY_PATH=/usr/local/lib export LD_LIBRARY_PATH=/usr/local/lib export LD_RUN_PATH=/usr/local/lib export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig export CFLAGS=$(pkg-config --cflags libsodium) export LDFLAGS=$(pkg-config --libs libsodium) #----- # Reinitialize settings under .bashrc source ~/.bashrc # Add libsodium to ldconfig echo '/usr/local/lib' > tee -a /etc/ld.so.conf.d/libsodium.conf # Download the latest lizmq from the GIT repository cd /root/downloads wget https://github.com/zeromq/libzmq/archive/master.zip unzip master.zip cd libzmq-master # Lets begin building it # Generate the configure script from template ./autogen.sh ./configure make clean make make install # ZeroMQ libraries are installed in /usr/local/lib path # Need to add the libraries to ldconfig so that they can be # statically linked in C code # Since ZMQ is installed in the same path as libsodium, # we do not need to add another path into /etc/ld.so.conf.d/*.conf # we just need to reload the "ldconfig" ldconfig # Let try compiling and testing a sample code mkdir /root/downloads/zmqtest cd /root/downloads/zmqtest # vim helloserver.c # Copy hwserver code from the following url: wget https://github.com/imatix/zguide/raw/master/examples/C/hwserver.c # Copy hwclient code from the following url: wget https://github.com/imatix/zguide/raw/master/examples/C/hwclient.c # Compile hwserver gcc hwserver.c -o hwserver -lzmq gcc hwclient.c -o hwclient -lzmq # Open two SSH terminals to /root/downloads/zmqtest # Run hello-world server in terminal #1 # Run hello-world client in terminal #2 # If it runs, you're all set to go # Please link me from your blog/social places so that others can easily find this article # Also provide me with feedback so that I can ammend this guide for others