源码安装:
演示环境:centos6.6
1.需要自带gcc,系统自带的,没有的话,需要先安装。
2.需要pcre,这个前面安装Nginx已经安装了。
3.需要libedit-dev,安装命令: yum install libedit-dev*
4.去https://www.varnish-cache.rog/下载,然后进行解压安装
(1)先解压安装包源码,然后进入到这个包里面
(2)安装命令如下:
第一步:因为安装varnish需要pcre,因此先设置一下路径:
export PKG_CONFIG_PATH=/usr/local/pcre/lib/pkgconfig
第二步:进入configure安装目录:
./configure --prefix=/usr/java/varnish
在这一步的时候由于我安装的是varnish-5.1.1.tar.gz
这个需要安装高版本的pythod,但是安装这个的时候需要先安装:
CentOS 6.6自带的是Python 2.6.6,而编译llvm需要Python 2.7以上。
checking for python... /usr/bin/python checking for python >= 2.7... not found configure: error: found python 2.6.6 (/usr/bin/python); required >= 2.7
yum中最新的也是Python 2.6.6,只能下载Python 2.7.9的源代码自己编译安装。
操作步骤如下:
1)安装devtoolset
yum groupinstall "Development tools"
2)安装编译Python需要的包包
yum install zlib-devel yum install bzip2-devel yum install openssl-devel yum install ncurses-devel yum install sqlite-devel
3)下载并解压Python 2.7.9的源代码
cd /opt wget --no-check-certificate https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz tar xf Python-2.7.9.tar.xz cd Python-2.7.9
4)编译与安装Python 2.7.9
./configure --prefix=/usr/local make && make altinstall
5)将python命令指向Python 2.7.9
ln -s /usr/local/bin/python2.7 /usr/local/bin/python
6)检查Python版本
sh sh-4.1# python -V Python 2.7.9
然后在进入./configure --prefix=/usr/java/varnish
make
make install