centos zeromq安装备忘
安装基础编译的
yum install libtool gcc-c++ glib*
下载安装libsodium,因为它是zeromq的依赖库
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.3.tar.gz
安装即可
下面是必要步骤,不然会报libsodium找不到的
配置环境变量
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)
wget http://download.zeromq.org/zeromq-4.1.3.tar.gz
安装即可
然后使用
npm install zmq
它还会报错
> node-gyp rebuild
make: Entering directory `/home/deploy/mqpush/node_modules/zmq/build'
CXX(target) Release/obj.target/zmq/binding.o
../binding.cc:28:17: fatal error: zmq.h: No such file or directory
#include <zmq.h>
^
compilation terminated.
make: *** [Release/obj.target/zmq/binding.o] Error 1
执行
sudo yum install zeromq-devel && npm install zmq
即可
可用ip地址 ifconfig -a | grep 'inet ' | awk ‘{print $2}’ | sed ‘s/addr://’