图片服务器zimg的搭建案例

发布日期:2021-06-28 15:28
作者:seo培训叫兽
阅读量:

zimg是图像存储和处理服务器。您可以使用URL参数从zimg获取压缩和缩放的图像。

zimg的并发I / O,分布式存储和时间处理能力非常出色。

您不再需要在图像服务器中使用Nginx。在基准测试中,zimg可以在高并发级别上处理每秒3000+图像下载任务和每秒90000+ HTTP回应请求,性能高于php或其他图像处理服务器。

1. 安装依赖库:

sudo yum install -y wget openssl-devel cmake libevent-devel libjpeg-devel giflib-devel libpng-devel libwebp-devel ImageMagick-devel libmemcached-devel sudo yum install -y glibc-headers gcc-c++sudo yum install -y build-essential nasm

2. 安装openssl

mkdir /usr/local/cd /usr/local/wget http://www.openssl.org/source/openssl-1.0.1i.tar.gztar zxvf openssl-1.0.1i.tar.gzcd openssl-1.0.1i./config shared --prefix=/usr/local --openssldir=/usr/sslmake && make install

3. 安装cmake

mkdir -p /usr/local/cd /usr/local/wget http://www.cmake.org/files/v3.0/cmake-3.0.1.tar.gztar xzvf cmake-3.0.1.tar.gz cd cmake-3.0.1./bootstrap --prefix=/usr/local make && make install

4. 安装libevent

mkdir -p /usr/local/cd /usr/local/wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gztar zxvf libevent-2.0.21-stable.tar.gzcd libevent-2.0.21-stable./configure --prefix=/usr/local make && make install 

目前这个下载地址下载不了,那么我们到网上搜索这个安装包

5. 安装libjpeg-turbo

mkdir -p /usr/local/cd /usr/local/wget https://downloads.sourceforge.net/project/libjpeg-turbo/1.3.1/libjpeg-turbo-1.3.1.tar.gztar zxvf libjpeg-turbo-1.3.1.tar.gzcd libjpeg-turbo-1.3.1./configure --prefix=/usr/local --with-jpeg8make && make install

下面这几个,如果采取源代码构建,不需要安装

1. 安装webp

mkdir /usr/local/cd /usr/local/wget http://downloads.webmproject.org/releases/webp/libwebp-0.4.1.tar.gztar zxvf libwebp-0.4.1.tar.gzcd libwebp-0.4.1./configuremakesudo make install完成

2. 安装jpegsrc

mkdir /usr/local/cd /usr/local/zimg/wget http://www.ijg.org/files/jpegsrc.v8b.tar.gztar -xf jpegsrc.v8b.tar.gzcd jpeg-8b./configure --prefix=/usr/local --enable-shared --enable-staticmake && make install安装完成

3. 安装imageMagic

mkdir /usr/local/cd /usr/local/wget http://www.imagemagick.org/download/ImageMagick.tar.gztar zxvf ImageMagick.tar.gzcd ImageMagick-6.9.1-10./configure --prefix=/usr/local make && make install安装完成

4. 安装libmemcached

wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gztar zxvf libmemcached-1.0.18.tar.gzcd libmemcached-1.0.18./configure -prefix=/usr/local make && make install

5. 构建zimg

cd /usr/local

##此处不要根据下面链接去下载,自己去zimg github地址库区下载release 版;

#git clone https://github.com/buaazp/zimg -b master --depth=1如果项目名称是zimg-master, 那么重命名为 zimgmv zimg-master zimgcd zimg make 

再make之前,先进入到解压目录zimg/deps, 把/zimg/deps中的libjpeg-turboxxx和libwebpxxx删除, 把前面安装使用的对应的的libjpeg-turbo.tar.gz和libwebpXXX.tar.gz包复制后来, 注意是tar包, 即.tar.gz, 之后我们再make ,否则会报错

如果Make之后报错,处理方法如下:

sudo yum install -y wget libhdf5-serial-dev hdf5-tools

11可选的插件

11.1 Memcached

wget http://www.memcached.org/files/memcached-1.4.19.tar.gztar zxvf memcached-1.4.19.tar.gzcd memcached-1.4.19./configure --prefix=/usr/localmakemake install

11.2 beansdb

git clone https://github.com/douban/beansdbcd beansdb./configure --prefix=/usr/localmake

11.3 SSDB

wget --no-check-certificate https://github.com/ideawu/ssdb/archive/master.zipunzip mastercd ssdb-mastermake

11.4 twemproxy

git clone git@github.com:twitter/twemproxy.gitcd twemproxyautoreconf -fvi./configure --enable-debug=logmakesrc/nutcracker -h

12安装成功后启动

cd /usr/local/zimg/bin./zimg conf/zimg.luactrl+z 退出crul http://localhost/4869如果出现html代码 则说明安装启动成功。

相关文章