准备:
先建目录:
[[email protected] f2c-zimg]# mkdir /tools/ //所有依赖包都放到tools下
[[email protected] f2c-zimg]# mkdir /work //zimg放到work下
安装gcc和gcc-c++
yum -y install gcc gcc-c++
1.安装Openssl (这个很关键,必须先安装)
tar zxvf openssl-1.0.1e.tar.gz
./config shared --prefix=/usr --openssldir=/usr/ssl
make && make install
这步可以直接
[[email protected] tools]# yum -y install openssl
2. 安装 libevent (http://libevent.org/)
tar zxvf libevent-2.0.17-stable.tar.gz
./configure --prefix=/usr
make && make install
3.安装Cmake
cd cmake-2.8.10.2
./bootstrap --prefix=/usr
make && make install
4.安装Libevhtp
tar xzvf libevhtp-1.2.6.tar.gz
cd libevhtp-1.2.6/
cmake -DCMAKE_PREFIX_PATH=/usr -DCMAKE_INSTALL_PREFIX=/usr -DLIBEVENT_OPENSSL_LIBRARY=/usr/lib/openssl
make && make install
5.安装ImageMagick
#安装图片库
yum -y install libjpeg libjpeg-devel libpng libpng-devel
tar xzvf ImageMagick-6.8.7-2.tar.gz
cd ImageMagick-6.8.7-2
./configure --with-perl
make && make install
如果make install报错的话:
yum install perl-ExtUtils-Embed -y
6.安装 libmemcached
tar zxvf libmemcached-0.42.tar.gz
cd libmemcached-0.42
./configure --with-jp2=yes --with-png=yes --with-jpeg=yes LDFLAGS=‘-L/usr/lib‘ --with-memcached
make && make install
7. 安装memcached
[[email protected] tools]# tar zxf memcached-1.4.15.tar.gz
[[email protected] tools]# cd memcached-1.4.15
[[email protected] memcached-1.4.15]# ./configure
[[email protected] memcached-1.4.15]# make && make install
8. 配置库文件
vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/lib64
/usr/local/lib
[[email protected] ~]# ldconfig
9.上传其他依赖库文件
libevent_openssl-2.0.so.5.1.9
libjpeg.so.9
libmemcached.so.2.0.0
libtbnet.so.0.0.0
libtbsys.so.0.0.0
libtfsclient_c.so.0.0.0
都上传到目录/usr/lib64下
[[email protected] ~]# ldconfig
10.上传zimg包并解压
tar jxf f2c-zimg.tar.bz2
cd f2c-zimg
vim start_memcached.sh
#!/bin/bash
/usr/local/bin/memcached -d -u root -m 512 -l 127.0.0.1 -p 11211 -c 1024 -P /var/run/memcached.pid
[[email protected] f2c-zimg]# ./zimg -h
Usage: ./zimg -p port -t thread_num -M memcached_ip -m memcached_port -l[og] -c[ache] -b backlog_num -k max_keepalives -q img_quality -F tfs_url -h[elp]
vim start.sh
ulimit -c unlimited
cd /work/f2c-zimg/
pn1=`ps -ef | grep zimg | grep -v grep | grep -v start | grep -v log | wc -l`
if [ $pn1 -eq 0 ]; then
nohup /work/f2c-zimg/zimg -l -F 10.0.16.104:18101 -M 127.0.0.1 -m 11211 -c >> /work/f2c-zimg/log/nohup.log &
echo "start zimg"
else
echo "zimg is running $pn1"
fi
sh start_memcached.sh
sh start.sh
注意:-F 是TFS服务器,安装TFS服务器请查看http://meitangyanyan.blog.51cto.com/8768306/1683294
11.关闭防火墙
service iptables stop
setenforce 0
12.访问验证: