CentOS7.3源码安装squid4.12
一、源码安装squid 4.12
1.下载squid-4.12源码包
下载:wget http://www.squid-cache.org/Versions/v4/squid-4.12.tar.gz解压:tar -zxvf squid-4.12.tar.gz -C /usr/local/
2.编译配置
cd /usr/local/squid-4.12/.
/configure --prefix=/usr/local/squid --enable-arp-acl --enable-linux-netfilter --enable-linux-tproxy --enable-async-io=100--enable-err-language="Simplify_Chinese"--enable-poll --enable-gnuregex
配置成功会看到有Makefile 文件
3.编译安装
make && make install
编译安装时间比较长(主要时make 时间毕比较长)
4.其他配置
添加软链接: ln -s /usr/local/squid/sbin/* /usr/local/sbin/添加新用户:useradd -M -s /sbin/nologin squid
配置权限:chown -R squid:squid /usr/local/squid/var/
5.配置squid
vi /usr/local/squid/etc/squid.conf开启缓存目录位置:cache_dir ufs
/usr/local/squid/var/cache/squid 10016256添加运行用户:cache_effective_user squid
添加运行组:cache_effectice_group squid
添加主机名:visible_hostname ip
/域名
修改完后↓
测试配置:squid -k parse初始化:squid
-z
6.启动和关闭squid
启动:squid后台启动:squid
-s检测是否启动成功:netstat
-anpt|grep squid
启动成功会有以下信息:
tcp 0 0 0.0.0.0:3128 0.0.0.0:* LISTEN 15465/(squid-1)
关闭服务:kill -9 15465
二、问题解决:
问题一 (gcc版本问题):configure: error: ***A compiler with support for c++11 language features is required.
gcc 版本太低(yum 命令安装的gcc 版本太低)
1.yum安装依赖包
yum install -y epel-releaseyum install
-y gcc gcc-c++ gcc-gnat libgcc libgcc.i686 glibc-devel bison flex texinfo Development Tools
2.下载gcc源码包
cd /usr/local/srcwget http:
//ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-8.3.0/gcc-8.3.0.tar.xztar -xJvf gcc-8.3.0.tar.xz
3.检查和下载gcc依赖库
cd /usr/local/src/gcc-8.3.0.
/contrib/download_prerequisites
4.创建编译目录和编译安装
cd /usr/local/src/gcc-8.3.0mkdir build
&& cd build..
/configure --prefix=/usr/local/gcc-8.3.0--enable-checking=release --enable-languages=c,c++--disable-multilibmake
&& make install
5.配置环境变量
export PATH=/usr/local/gcc-8.3.0/bin:$PATHsource
/etc/profile
6.检查gcc 版本
gcc -v
问题二:报错:lib64/libstdc++.so.6: version `GLIBCXX_3.4.21" not found (required by ./cf_gen)
1.查找编译gcc时生成的最新动态库:
find / -name "libstdc++.so*"
2.查看当前libstdc++.so.6 软链接指向
ll /usr/lib64/libstdc++*
3.重建软链接
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.backupcp
/usr/local/gcc-8.3.0/lib64/libstdc++.so.6.0.25 /usr/lib64/ln
-s /usr/lib64/libstdc++.so.6.0.25 /usr/lib64/libstdc++.so.6
检查是否成功:ll /usr/lib64/libstdc++.so.6*
参考:https://www.osyum.com/group/topic/397/
本文只供学习参考,转载指明出处:https://www.cnblogs.com/dennyLee2025/p/13360310.html
原文链接:https://www.cnblogs.com/dennyLee2025/archive/2020/07/22/13360310.html
以上是 CentOS7.3源码安装squid4.12 的全部内容, 来源链接: utcz.com/z/518581.html