安装evpp依赖库和工具
evpp官方快速教程
https://github.com/Qihoo360/evpp/blob/master/docs/quick_start.md
evpp依赖库:
- libevent
- glog
- gtest (optional)
- boost (optional)
- gflags (optional)
- thrift (optional)
- libthrift (optional)
编译依赖工具:
- gcc (GCC) 4.8+
- GNU Make
- git
- CMake
创建新用户
- 创建用户名:alex
adduser alex
# 修改密码
passwd alex
# 输入新密码
123456
# 重新输入新密码
123456
- sudo授权
切换root权限
第一步:修改sudoers配置文件为可读写权限
chmod -v u+w /etc/sudoers
第二步:打开配置文件
vim /etc/sudoers
第三步:添加alex用户到配置文件
## Allow root to run any commands anywher
root ALL=(ALL) ALL
alex ALL=(ALL) ALL
第四步:去掉sudoers写权限
chmod -v u-w /etc/sudoers
第五步:切换回alex用户
su alex
更新yum源
sudo yum update
查看各种库版本
查看gcc版本
gcc --version
# gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
...
查看make版本
make --version
# GNU Make 3.82
...
查看cmake版本
cmake --version
# cmake version 3.3.2
...
查看git版本
git --version
# git version 1.8.3.1
安装cmake 3+
安装预编译环境
yum -y install gcc gcc-c++ kernel-devel
下载cmake安装包
cd /home/alex/document
wget https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz
卸载原cmake环境
yum remove cmake -y
解压cmake二进制包
tar -zxvf cmake-3.10.2.tar.gz
编译安装
./bootstrap --prefix=安装目录(默认为/usr/local)
gmake
sudo gmake install
新建软连接
ln -s /usr/local/bin/cmake /usr/bin/
查看版本
cmake --version
# cmake version 3.10.2
...
安装libevent
下载 libevent-2.1.8-stable.tar.gz
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
解压 libevent-2.1.8-stable.tar.gz
tar zxvf libevent-2.1.8-stable.tar.gz
编译安装
./configure
make
make verify # (optional)
sudo make install
安装libevent-devel
sudo yum -y install libevent-devel
配置ld.so.conf.d
cd /etc/ld.so.conf.d/
sudo vim libevent.conf
# 添加
/usr/local/lib
安装glog
下载
git clone https://github.com/google/glog
配置
sudo apt-get install autoconf automake libtool
编译&安装
进入源码根目录(glog文件夹)
./autogen.sh
./configure
make -j 24
sudo make install
安装gflags
下载
git clone https://github.com/gflags/gflags
编译&安装
进入源码目录(即gflags文件夹)
cmake .
make -j 24
sudo make install
安装gtest
下载
git clone https://github.com/abseil/googletest.git
编译&安装
进入源码目录(即gflags文件夹)
mkdir build && cd build
cmake ..
make
sudo make install
安装boost
下载
wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz
解压
tar zxvf boost_1_67_0.tar.gz
配置
yum -y install gcc-c++ python-devel bzip2-devel zlib-devel
编译&安装
cd boost_1_67_0
sudo ./bootstrap.sh
sudo ./b2 install
安装boost.build
cd tools/build
sudo ./bootstrap.sh
sudo ./b2 install
更新ldconfig
sudo ldconfig
安装 thrift
下载
wget http://mirrors.tuna.tsinghua.edu.cn/apache/thrift/0.11.0/thrift-0.11.0.tar.gz
编译&安装
tar zxvf thrift-0.11.0.tar.gz
cd thrift-0.11.0
./configure --with-boost=/usr/local --without-java --without-php
sudo make
sudo make install
安装evpp
下载
git clone https://github.com/Qihoo360/evpp
cd evpp
git submodule update --init --recursive
编译&安装
mkdir -p build && cd build
sudo cmake -DCMAKE_BUILD_TYPE=Debug ..
sudo make -j
sudo make test
sudo make install