首页 小组 文章 搜索 用户
全部 linux Nginx Apache PHP DNS windows 其它 同步与备份 js 数据库 前端 unix

编译安装Apache Traffic Server并指定用户运行

天边的云
发表于 2020-08-28 08:37:59

测试环境为centos7.x,ip地址为192.168.0.5最新版本,Traffic Server安装于/usr/local/traffic目录。

安装支持组件环境

yum -y install epel*
yum update -y
yum install tcl-devel libxml2-devel openssl-devel pcre-devel gcc gcc-c++ git opensl openssl-devel curl curl-devel autoconf automake libtool curses pcre libcap hwloc pkgconfig flex lua autoconf automake openssl-devel boost-devel

接下来升级gcc,需要先编译新版的gcc,https://www.osyum.com/article/show/422/

复制Traffic Server,并创建wwats用户

git clone https://git-wip-us.apache.org/repos/asf/trafficserver.git
cd trafficserver
groupadd -r wwats
useradd -g wwats -r -M -s /sbin/nologin wwats

编译安装

autoreconf -if
如果是ssd硬盘加上--enable-interim-cache
./configure --prefix=/usr/local/traffic --with-user=wwats --with-group=wwats --enable-experimental-plugins --enable-spdy --enable-cppapi --enable-experimental-plugins --enable-example-plugins --enable-test-tools --disable-tests
make&&make install
启动trafficserver
/usr/local/traffic/bin/trafficserver start
停止trafficserver
/usr/local/traffic/bin/trafficserver stop
查看rafficserver状态
/usr/local/traffic/bin/trafficserver status
查看 trafficserver有无运行在wwats权限下
ps -ef|grep trafficserver
显示
wwats      8474      1  0 20:37 pts/0    00:00:00 /usr/local/traffic/bin/traffic_manager --bind_stdout /usr/local/traffic/var/log/trafficserver/traffic.out --bind_stderr /usr/local/traffic/var/log/trafficserver/traffic.out
wwats      8481   8474  2 20:37 pts/0    00:00:01 /usr/local/traffic/bin/traffic_server --bind_stdout /usr/local/traffic/var/log/trafficserver/traffic.out --bind_stderr /usr/local/traffic/var/log/trafficserver/traffic.out -M --httpport 8080:fd=10,8080:fd=11:ipv6
root       8554  76682  0 20:38 pts/0    00:00:00 grep --color=auto trafficserver
成功!
开启防火墙,并测试
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload
在浏览器里输入192.168.0.5:8080,出现,Not Found on Accelerator即成功,需要进一步的配置,才可以真正的使用起来。这里只讲解安装方法。
把trafficserver加入系统开机启动
vi /lib/systemd/system/traffic.service
加入以下内容
[Unit]
Description=Apache Traffic Server
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/usr/local/traffic/bin/trafficserver start
ExecReload=/usr/local/traffic/bin/trafficserver restart
ExecStop=/usr/local/traffic/bin/trafficserver stop
[Install]
WantedBy=multi-user.target
保存退出
创建软连
ln -s /lib/systemd/system/traffic.service /etc/systemd/system/multi-user.target.wants/traffic
载入启动
systemctl daemon-reload
启动traffic
systemctl start traffic
重启traffic
systemctl restart traffic
停止traffic
systemctl stop traffic
加入系统启动
systemctl enable traffic



274 0

评论