这篇文档基本上与前一篇CentOS 6.8上面的相同,因为我所有的开发环境都是在Ubuntu上面的
http://www.jb51.cc/article/p-regomcme-bbs.html
下面我只是简单记录步骤和截图。
1.安装依赖包
由于官网文档没有Ubuntu 16.x的安装指导,下面是我的摸索,总体上ATS 4.x,5.x版本区别不太大
sudo apt-get install autoconf automake libtool g++ make pkg-config libssl-dev tcl-dev libexpat1-dev libpcre3-dev libmodule-install-perl
sudo apt-get install libcap-dev libcap2 hwloc libhwloc-dev libhwloc5 libunwind8 libunwind8-dev
sudo apt-get install bison flex tcl8.6-dev zlib1g-dev
sudo apt-get install libluajit-5.1-dev libncurses5-dev libcurl4-openssl-dev
2.编译安装
这回安装的顶层目录是/opt/ats2,ATS运行的用户和组都是nogroup,同样设置debug模式
./configure --prefix=/opt/ats2 --with-user=ats --with-group=nogroup --enable-debug --enable-example-plugins --enable-experimental-plugins
make -j 4
sudo make install -j 4
安装完成后,会在/opt/ats2/bin下面看到生成了traffic_top
注意,按照官网上的文档,如果要生成traffic_top需要安装下面的两个库,上面已经经过测试验证
sudo apt-get installlibncurses5-dev libcurl4-openssl-dev
3.配置
[records.config] CONFIG proxy.config.http.server_ports STRING 18980 CONFIG proxy.config.http2.enabled INT 0 CONFIG proxy.config.http.insert_response_via_str INT 2 CONFIG proxy.config.log.custom_logs_enabled INT 1 CONFIG proxy.config.log.xml_config_file STRING logs_xml.config CONFIG proxy.config.diags.show_location INT 1 #no ssl and cpu affinity CONFIG proxy.config.ssl.number.threads INT 0 CONFIG proxy.config.exec_thread.affinity INT 0 [remap.config] regex_map http://(.*) http://$1 [logs_xml.config] <LogFormat> <Name = "ats_access_log"/> <Format = "%<cqtd>/%<cqtt> %<cqhm> \"%<cquuc>\" %<pssc> %<ttms> %<cqhl> %<psql> %<crc> \"%<chi>\" %<pqsn> \"%<{Referer}cqh>\" \"%<psct>\" \"%<{User-agent}cqh>\" %<csssc> %<pqsi>"/> </LogFormat> <logobject> <Format = "ats_access_log"/> <Filename = "access"/> <Protocols = "http"/> <RollingEnabled = "3"/> <RollingIntervalSec = "7200"/> <RollingSizeMb = "2048"/> </logobject> [storage.config] var/trafficserver 10G
4.运行并验证
cd /opt/ats2/bin
./trafficserver start
ps auxf | grep traffic
请求一个普通url来检查ats是否允许正常
curl -vx 127.0.0.1:18980 -o /dev/null 'http://news.sohu.com/'
执行traffic_top查看允许情况
./traffic_top
使用traffic_line来查看对应的配置变量
./traffic_line -r proxy.config.diags.show_location