前言
CentOS7下安装libevent网络库
步骤
①创建一个文件夹libevent(方便后期维护管理)
mkdir ~/libevent
②官网下载源码包
可以在本机下载然后文件传输,也可以直接在linux下载(推荐直接linux下载,方便快捷)
libevent官网:https://libevent.org/
wget 下载链接
③解压源码包
tar -zxvf *.tar.gz(源码包)
解压完毕后,进入到源码包文件夹目录下
查看README.md文件,
在源码包文件夹下
./configure 过程中如遇到如下错误(解决:yum install -y openssl openssl-devel)
error: openssl is a must but can not be found. You should add the directory containing `openssl.pc' to the `PKG_CONFIG_PATH' environment variable, or set `CFLAGS' and `LDFLAGS' directly for openssl, or use `--disable-openssl' to disable support for openssl encryption
make 编译
make install 安装
至此libevent安装完成,可自行在./sample中进行样例实验