Ubuntu 22.04 安装 Tinyproxy 指南

Ubuntu 22.04 安装 Tinyproxy 指南:apt 在线安装(1.11.0)与源码编译安装(1.11.3)双方案、systemd 托管、日志 journald 排障实录、升级降级与卸载清理,全部命令与回显实测。

TinyproxyTinyproxyHTTP 代理Ubuntu 22.04Linux2026/10/22

Ubuntu 22.04 安装 Tinyproxy 指南

目标:在 Ubuntu 22.04 LTS 服务器上从零安装并托管 Tinyproxy 轻量级 HTTP/HTTPS 正向代理,覆盖 apt 官方仓库在线安装(1.11.0)与源码编译安装上游最新稳定版(1.11.3)两套方案、systemd 服务托管、基础配置放行、升级/降级/卸载全流程;全部命令与回显已在 Ubuntu 22.04.5 LTS(x86_64)环境实测通过。

一、环境信息

本文所有命令均在以下环境实测,回显逐行照抄:

  • 操作系统:Ubuntu 22.04.5 LTS(x86_64)
  • 测试节点:代理服务器 10.89.65.10(主机名 proxy1.example.local),客户端测试机 10.89.65.11(主机名 node2.example.local),二者位于同一内网 10.89.65.0/24
  • Tinyproxy 版本:
    • 方案 A(apt):1.11.0-1(Ubuntu 22.04 jammy/universe 仓库)
    • 方案 B(源码):1.11.3(上游最新稳定版,GitHub Releases 2026-03-07 发布,查询日期 2026-10-22)
  • 服务名:tinyproxy.service(apt 方案,包自带);tinyproxy-local.service(源码方案,本文自建)
  • 默认监听:0.0.0.0:8888(TCP,IPv4/IPv6 双栈)
  • 配置文件:/etc/tinyproxy/tinyproxy.conf(apt 方案);/usr/local/etc/tinyproxy/tinyproxy.conf(源码方案)
  • 日志:/var/log/tinyproxy/tinyproxy.log(需目录属主正确,详见 4.4 节排障实录)

二、前置条件

  • 具备 root 权限或可 sudo 的普通账号;
  • 服务器能访问 Ubuntu 官方源 archive.ubuntu.com(方案 A),或能访问 github.com 下载源码包(方案 B);
  • 客户端验证需要 curl 命令(Ubuntu 22.04 默认未预装时执行 apt-get install -y curl 即可);
  • 方案 B 编译需要 gcc/make 工具链,由 build-essential 提供(见 5.1 节)。

三、版本选型说明

先看实测的 apt 源版本策略,再决定用哪个方案安装:

apt-cache policy tinyproxy

实测输出(proxy1 服务器):

tinyproxy:
  Installed: 1.11.0-1
  Candidate: 1.11.0-1
  Version table:
 *** 1.11.0-1 500
        500 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
        100 /var/lib/dpkg/status

版本对照与选型:

安装渠道版本来源与说明适用场景
apt(jammy/universe)1.11.0-1Ubuntu 官方仓库唯一版本,2021-11 打包,systemd 服务开箱即用常规正向代理需求,追求稳定省心
源码编译(GitHub Releases)1.11.3上游最新稳定版,2026-03-07 发布(查询日期 2026-10-22)需要新版本特性或安全修复

关键差异:Ubuntu 22.04 仓库停留在 1.11.0,而上游在 1.11.1 增加了基于 fnmatch 的过滤类型、1.11.2 修复了一个释放后使用(UAF)类安全缺陷(以上说明引自 GitHub Releases 页发布注记,查询日期 2026-10-22)。若仅做内网可信客户端的普通正向代理,1.11.0 足够;若代理暴露面较大或需要新特性,选方案 B 编译 1.11.3。

四、方案 A:apt 官方仓库在线安装(1.11.0)

本方案从 Ubuntu 官方仓库安装 Tinyproxy,一条命令完成安装,systemd 服务由软件包自动创建并注册开机自启,适合绝大多数 Ubuntu 服务器。

4.1 更新索引并安装

apt-get update

实测输出节选(实测首尾):

Get:8 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1325 kB]
Fetched 12.5 MB in 1min 53s (111 kB/s)
Reading package lists... Done
apt-get install -y tinyproxy

实测输出节选(实测首尾):

Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  tinyproxy
Setting up tinyproxy (1.11.0-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/tinyproxy.service → /lib/systemd/system/tinyproxy.service.

注意倒数第二行的 Created symlink ...:软件包安装时已自动创建开机自启链接,无需再手动 systemctl enable。确认包版本:

dpkg -l tinyproxy | tail -1

实测输出:

ii  tinyproxy      1.11.0-1     all          Lightweight, non-caching, optionally anonymizing HTTP proxy

4.2 服务托管确认

Ubuntu 包以 systemd 服务 tinyproxy.service 托管(Type=forking,PID 文件 /run/tinyproxy/tinyproxy.pid),安装即自启。逐项确认服务状态:

systemctl is-enabled tinyproxy

实测输出:

enabled
systemctl is-active tinyproxy

实测输出:

active
systemctl status tinyproxy --no-pager -l | head -8

实测输出:

● tinyproxy.service - Tinyproxy lightweight HTTP Proxy
     Loaded: loaded (/lib/systemd/system/tinyproxy.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2026-10-22 11:12:48 UTC; 1min 14s ago
       Docs: man:tinyproxy(8)
             man:tinyproxy.conf(5)
    Process: 5881 ExecStart=/usr/bin/tinyproxy $FLAGS (code=exited, status=0/SUCCESS)
   Main PID: 5883 (tinyproxy)
      Tasks: 1 (limit: 94371)

4.3 验证代理服务

版本与监听端口验证:

tinyproxy -v

实测输出:

tinyproxy 1.11.0
ss -ltnp | grep 8888

实测输出:

LISTEN 0      1024         0.0.0.0:8888       0.0.0.0:*    users:(("tinyproxy",pid=5883,fd=0))
LISTEN 0      1024            [::]:8888          [::]:*    users:(("tinyproxy",pid=5883,fd=1))

默认配置只放行本机(Allow 127.0.0.1),先用本机 curl 走代理验证连通性:

curl -s -x http://127.0.0.1:8888 -o /dev/null -w "%{http_code}\n" http://example.com

实测输出:

200

再访问 Tinyproxy 内置统计页(请求主机名 tinyproxy.stats 时代理返回内部统计页而非转发):

curl -s -x http://127.0.0.1:8888 http://tinyproxy.stats/ | grep -iE "title|statistics" | head -2

实测输出:

<title>tinyproxy version 1.11.0 run-time statistics</title>
<h1>tinyproxy version 1.11.0 run-time statistics</h1>

4.4 日志位置与「日志进 journald」排障实录

apt 版配置文件里写的是文件日志(LogFile "/var/log/tinyproxy/tinyproxy.log"),但全新安装后直接 tail 该文件会报不存在:

tail -3 /var/log/tinyproxy/tinyproxy.log

实测输出(故障现象):

tail: cannot open '/var/log/tinyproxy/tinyproxy.log' for reading: No such file or directory

此时日志实际由 systemd 捕获进了 journald:

journalctl -u tinyproxy --no-pager -n 3

实测输出(节选):

Oct 22 11:07:42 proxy1.example.local tinyproxy[464]: Connect (file descriptor 5): 10.89.65.11
Oct 22 11:07:42 proxy1.example.local tinyproxy[464]: Unauthorized connection from "10.89.65.11".
Oct 22 11:07:42 proxy1.example.local tinyproxy[464]: Read request entity of 123 bytes

定位原因:tinyproxy 主进程绑定端口后降权为 tinyproxy 用户运行,而日志目录属主是 root:

ls -ld /var/log/tinyproxy

实测输出:

drwxr-xr-x 2 root root 4096 Nov  8  2021 /var/log/tinyproxy

tinyproxy 用户对 root 属主、755 权限的目录没有写权限,无法创建日志文件,于是回落到 stdout 输出、被 systemd 收进 journald。修复:把目录属主交给 tinyproxy 用户并重启服务:

chown -R tinyproxy:tinyproxy /var/log/tinyproxy && systemctl restart tinyproxy

执行后无输出即成功。发一次代理请求再确认日志文件已落盘:

curl -s -x http://127.0.0.1:8888 -o /dev/null -w "%{http_code}\n" http://example.com && tail -2 /var/log/tinyproxy/tinyproxy.log

实测输出:

200
CONNECT   Oct 22 11:08:25.331 [5710]: Established connection to host "example.com" using file descriptor 4.
INFO      Oct 22 11:08:25.677 [5710]: Closed connection between local client (fd:3) and remote client (fd:4)

日志文件正常生成且属主为 tinyproxy:

ls -la /var/log/tinyproxy/

实测输出:

total 16
drwxr-xr-x 2 tinyproxy tinyproxy 4096 Oct 22 11:08 .
drwxr-xr-x 1 root      root      4096 Oct 22 10:55 ..
-rw------- 1 tinyproxy tinyproxy 1774 Oct 22 11:08 tinyproxy.log

至此方案 A 安装完成,代理已在 8888 端口可用。

五、方案 B:源码编译安装最新稳定版(1.11.3)

本方案从 GitHub Releases 下载上游源码编译安装 1.11.3,与前缀 /usr/local 隔离共存,适合需要最新版本特性或安全修复的场景。

5.1 安装编译依赖

apt-get install -y build-essential wget

实测输出节选(实测首尾):

Building dependency tree...
Reading state information...
build-essential is already the newest version (12.9ubuntu3).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

确认编译器可用:

gcc --version | head -1

实测输出:

gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

5.2 下载源码包并做 sha512 校验

mkdir -p /usr/local/src && cd /usr/local/src
wget https://github.com/tinyproxy/tinyproxy/releases/download/1.11.3/tinyproxy-1.11.3.tar.gz

下载完成后校验哈希。官方在 GitHub Releases 的 1.11.3 发布页公布了 sha512sum 值,先算本地值再对照:

sha512sum tinyproxy-1.11.3.tar.gz

实测输出:

e721dbcf1aa6171c30f8acc81ac4ee7705ff64cfa2e48051599ce985205236c6ef4c221376f850ec66c363b15200a892b622d40b3b423bb901d02c8839759600  tinyproxy-1.11.3.tar.gz

与官方发布页公布的 tinyproxy-1.11.3.tar.gz sha512 值一致,包完整可信。

5.3 解压、配置、编译、安装

tar xf tinyproxy-1.11.3.tar.gz && cd tinyproxy-1.11.3
./configure --prefix=/usr/local

实测输出节选(实测尾部):

config.status: creating docs/man8/tinyproxy.txt
config.status: creating m4macros/Makefile
config.status: creating tests/Makefile
config.status: creating tests/scripts/Makefile
config.status: creating scripts/Makefile
config.status: creating config.h
config.status: executing depfiles commands
make -j2

实测输出节选(实测首尾):

make  all-recursive
make[1]: Entering directory '/usr/local/src/tinyproxy-1.11.3'
Making all in src
make[2]: Entering directory '/usr/local/src/tinyproxy-1.11.3/src'
  CC       hostspec.o
  CC       acl.o
  CC       anonymous.o
  CC       buffer.o
......
make[2]: Entering directory '/usr/local/src/tinyproxy-1.11.3'
make[2]: Leaving directory '/usr/local/src/tinyproxy-1.11.3'
make[1]: Leaving directory '/usr/local/src/tinyproxy-1.11.3'
make install

实测输出节选(关键安装动作):

 /usr/bin/mkdir -p '/usr/local/bin'
  /usr/bin/install -c tinyproxy '/usr/local/bin'
 /usr/bin/mkdir -p '/usr/local/share/tinyproxy'
 /usr/bin/install -c -m 644 debug.html default.html stats.html '/usr/local/share/tinyproxy'
 /usr/bin/mkdir -p '/usr/local/etc/tinyproxy'
 /usr/bin/install -c -m 644 tinyproxy.conf '/usr/local/etc/tinyproxy'
 /usr/bin/mkdir -p '/usr/local/share/man/man5'
 /usr/bin/install -c -m 644 tinyproxy.conf.5 '/usr/local/share/man/man5'
 /usr/bin/mkdir -p '/usr/local/share/man/man8'
 /usr/bin/install -c -m 644 tinyproxy.8 '/usr/local/share/man/man8'

安装布局:二进制 /usr/local/bin/tinyproxy、示例配置 /usr/local/etc/tinyproxy/tinyproxy.conf、错误页/统计页模板 /usr/local/share/tinyproxy/、man 手册 /usr/local/share/man/man{5,8}/。

验证编译特性与版本:

/usr/local/bin/tinyproxy -v

实测输出:

tinyproxy 1.11.3
/usr/local/bin/tinyproxy -h

实测输出:

Usage: tinyproxy [options]

Options are:
  -d        Do not daemonize (run in foreground).
  -c FILE   Use an alternate configuration file.
  -h        Display this usage information.
  -v        Display version information.

Features compiled in:
    XTinyproxy header
    Filtering
    Transparent proxy support
    Reverse proxy support
    Upstream proxy support

For support and bug reporting instructions, please visit
<https://tinyproxy.github.io/>.

5.4 Ubuntu 适配:Group nobody 排障实录

先停掉方案 A 的服务腾出 8888 端口,再用源码版默认配置前台试运行:

systemctl stop tinyproxy
/usr/local/bin/tinyproxy -d -c /usr/local/etc/tinyproxy/tinyproxy.conf

实测输出(故障现象,进程随即退出):

/usr/local/bin/tinyproxy: Unable to find group "nobody".

原因:源码自带示例配置写的是 User nobody + Group nobody(上游模板面向通用 Linux),而 Ubuntu 的 nobody 用户所属组叫 nogroup,不存在名为 nobody 的组。修复示例配置:

sed -i "s/^Group nobody/Group nogroup/" /usr/local/etc/tinyproxy/tinyproxy.conf

执行后无输出即成功。

5.5 编写 systemd 服务单元并托管

源码安装不自带 unit 文件,手写一个 tinyproxy-local.service(-d 前台模式配合 Type=simple):

cat > /etc/systemd/system/tinyproxy-local.service <<'EOF'
[Unit]
Description=Tinyproxy 1.11.3 (source build)
After=network.target
Documentation=man:tinyproxy(8) man:tinyproxy.conf(5)

[Service]
Type=simple
ExecStart=/usr/local/bin/tinyproxy -d -c /usr/local/etc/tinyproxy/tinyproxy.conf
KillSignal=SIGTERM
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload && systemctl start tinyproxy-local

执行后无输出即成功。确认服务状态:

systemctl is-active tinyproxy-local

实测输出:

active

5.6 验证源码版服务

ss -ltnp | grep 8888

实测输出:

LISTEN 0      1024         0.0.0.0:8888       0.0.0.0:*    users:(("tinyproxy",pid=5788,fd=3))
LISTEN 0      1024            [::]:8888          [::]:*    users:(("tinyproxy",pid=5788,fd=4))
curl -s -x http://127.0.0.1:8888 -m 15 -o /dev/null -w "%{http_code}\n" http://example.com

实测输出:

200

5.7 与 apt 版共存与切换

两个版本的二进制、配置、服务名完全独立,可以共存,但默认都用 8888 端口,同一时间只能运行一个。若在源码版已占用 8888 时强行启动 apt 版服务,apt 版会启动失败并进入 activating 反复重试,journald 出现 PID 文件告警:

tinyproxy.service: Can't open PID file /run/tinyproxy/tinyproxy.pid (yet?) after start: Operation not permitted

而直接前台运行源码版二进制时,报错更直观:

/usr/local/bin/tinyproxy: Could not create listening sockets.

排障入口见第九章 9.4/9.5 节。切换方法:运行谁就 systemctl start 谁、并 systemctl stop 另一个;长期固定用一个时把另一个 systemctl disable 掉。

六、方案对比与选择建议

维度方案 A:apt 在线安装方案 B:源码编译安装
版本1.11.0-1(仓库固定)1.11.3(上游最新稳定版)
是否需联网需访问 Ubuntu 官方源需访问 github.com + 编译工具链
安装方式一条 apt 命令,自动装依赖configure/make/make install,约 1–2 分钟
systemd 服务包自带 tinyproxy.service,开机自启需自建 unit 文件(5.5 节)
二进制/配置路径/usr/bin/tinyproxy、/etc/tinyproxy//usr/local/bin/tinyproxy、/usr/local/etc/tinyproxy/
升级方式apt 升级跟随仓库(仓库不更新则停在 1.11.0)重新下载新版源码编译覆盖
卸载方式apt purge 一键清理make uninstall + 手动清理(第十章)
优点省心、可自动安全更新、卸载干净版本新、路径隔离可多版本共存
缺点版本落后上游约 5 年,缺 UAF 等修复需维护 unit 文件与升级流程

选择建议:仅做内网可信客户端的普通正向代理、希望交给 apt 自动维护 → 方案 A;代理直接暴露给较多客户端、需要上游安全修复(如 1.11.2 的 UAF 修复)或新特性(如 fnmatch 过滤)→ 方案 B。两方案可共存,通过 systemd 服务名随时切换。

七、配置说明

7.1 apt 方案文件位置

dpkg -L tinyproxy | grep -E "^/etc|^/lib|^/usr/(bin|share/tinyproxy)"

实测输出(节选):

/etc/default/tinyproxy
/etc/init.d/tinyproxy
/etc/logrotate.d/tinyproxy
/etc/tinyproxy/tinyproxy.conf
/lib/systemd/system/tinyproxy.service
/usr/share/tinyproxy/default.html
/usr/share/tinyproxy/stats.html

(另有 /usr/share/doc/tinyproxy/ 文档目录与 /usr/lib/tmpfiles.d/tinyproxy.conf 运行时目录规则。)

关键文件解读:

文件作用
/etc/tinyproxy/tinyproxy.conf主配置文件,全部参数在此调整
/lib/systemd/system/tinyproxy.servicesystemd 服务单元(Type=forking)
/etc/default/tinyproxy服务环境变量(可覆盖 CONFIG/FLAGS 指定备用配置)
/etc/logrotate.d/tinyproxy日志轮转规则
/usr/share/tinyproxy/*.html403/404 等错误页与统计页模板

7.2 最小常用配置:放行内网网段

默认只放行 127.0.0.1 与 ::1,局域网客户端访问会被拒绝(403)。编辑 /etc/tinyproxy/tinyproxy.conf,在 Allow ::1 行后追加一行放行内网网段:

Allow 127.0.0.1
Allow ::1
Allow 10.89.65.0/24

逐项说明:Allow 定义允许使用代理的来源,可重复多行,支持单 IP、CIDR 网段(如 10.89.65.0/24)与完整掩码(如 10.89.65.0/255.255.255.0);只要配置了任意 Allow 行,默认策略即变为「全部拒绝、命中放行」,未命中 Allow 的来源一律 403。

重启服务生效并验证:

systemctl restart tinyproxy && systemctl is-active tinyproxy

实测输出:

active

在客户端测试机(10.89.65.11)上走代理访问外网:

curl -s -m 10 -x http://10.89.65.10:8888 -o /dev/null -w "%{http_code}\n" http://example.com

实测输出:

200

更多参数(Port/Listen/Timeout/MaxClients/Upstream/BasicAuth 等)的逐项实测说明见《Tinyproxy 配置参数详解》。

八、升级、降级与多版本管理

8.1 apt 方案升级

apt-get install --only-upgrade tinyproxy

实测输出(当前仓库无更新版本时):

tinyproxy is already the newest version (1.11.0-1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

8.2 锁定与解锁版本(apt-mark)

当 5.7 节决定长期用源码版时,可锁定 apt 版避免自动升级干扰:

apt-mark hold tinyproxy && apt-mark showhold

实测输出:

tinyproxy set on hold.
tinyproxy

恢复跟随仓库升级:

apt-mark unhold tinyproxy

实测输出:

Canceled hold on tinyproxy.

8.3 安装指定版本(降级)

apt 支持显式指定版本号安装/回退,格式 apt-get install -y tinyproxy=<版本>:

apt-get install -y tinyproxy=1.11.0-1

实测输出(已是该版本时):

tinyproxy is already the newest version (1.11.0-1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

可用版本清单用 apt-cache policy tinyproxy 查看(见第三章回显)。

8.4 源码方案升级

上游发新版后按 5.2–5.3 节流程下载新版源码,同一 --prefix=/usr/local 重新编译安装即可覆盖二进制与模板,然后 systemctl restart tinyproxy-local;旧源码目录 /usr/local/src/tinyproxy-<旧版本>/ 可保留做回滚,或直接删除。多版本并存时靠不同 --prefix(如 /opt/tinyproxy-1.11.3)隔离,unit 文件中 ExecStart 指向对应前缀的二进制即可。

九、常见问题(FAQ)

9.1 客户端访问代理返回 403 Access denied

现象:远程客户端走代理报 403,响应页标题 403 Access denied。实测 403 响应正文节选:

<h1>Access denied</h1>

<p>The administrator of this proxy has not configured it to service requests from your host.</p>

定位:看代理端日志,来源 IP 不在 Allow 名单:

CONNECT   Oct 22 11:07:42 proxy1.example.local tinyproxy[464]: Connect (file descriptor 5): 10.89.65.11
CONNECT   Oct 22 11:07:42 proxy1.example.local tinyproxy[464]: Unauthorized connection from "10.89.65.11".

解决:按 7.2 节在配置中追加对应来源的 Allow 行(支持网段)并 systemctl restart tinyproxy。

9.2 配了 LogFile 但日志文件不存在、日志进了 journald

现象、根因与修复全过程见 4.4 节排障实录。一句话结论:/var/log/tinyproxy 目录属主不是 tinyproxy 用户时,降权后的进程无权创建日志文件,输出回落到 stdout 被 systemd 收进 journald;chown -R tinyproxy:tinyproxy /var/log/tinyproxy 并重启服务即恢复文件日志。

9.3 源码版启动报 Unable to find group "nobody"

现象:见 5.4 节,/usr/local/bin/tinyproxy: Unable to find group "nobody".

解决:Ubuntu 的 nobody 用户所属组是 nogroup,把 /usr/local/etc/tinyproxy/tinyproxy.conf 中的 Group nobody 改为 Group nogroup(或直接注释该行,保持与 User 同组)。

9.4 报 Could not create listening sockets.

现象:前台运行报 /usr/local/bin/tinyproxy: Could not create listening sockets.

定位:监听端口(默认 8888)已被占用,或 Port 低于 1024 却以非 root 启动。用 ss -ltnp | grep 8888 找出占用进程:

LISTEN 0      1024         0.0.0.0:8888       0.0.0.0:*    users:(("tinyproxy",pid=5883,fd=0))

解决:停掉占用者或改配置里的 Port 后重启。

9.5 systemd 卡在 activating,日志有 Can't open PID file

现象:systemctl is-active tinyproxy 显示 activating,journald 报:

tinyproxy.service: Can't open PID file /run/tinyproxy/tinyproxy.pid (yet?) after start: Operation not permitted

原因:这是「启动即退出」的连锁表现——apt 版 unit 是 Type=forking + PIDFile,若守护进程起来就因端口冲突等原因退出,PID 文件永远不出现,systemd 反复等 PID 超时重试。解决:先解决根因(见 9.4 端口占用),再 systemctl restart tinyproxy 即回到 active。

十、卸载与清理

10.1 卸载 apt 方案

先停用并注销服务,再连配置一起清除:

systemctl disable --now tinyproxy

实测输出节选:

Synchronizing state of tinyproxy.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable tinyproxy
apt-get purge -y tinyproxy

实测输出节选:

(Reading database ... 7458 files and directories currently installed.)
Removing tinyproxy (1.11.0-1) ...
Purging configuration files for tinyproxy (1.11.0-1) ...

确认已卸净:

dpkg -l tinyproxy | tail -1

实测输出:

dpkg-query: no packages found matching tinyproxy

残留的日志目录可一并删除:rm -rf /var/log/tinyproxy。

10.2 卸载源码方案

回到源码目录用 make uninstall 反安装:

cd /usr/local/src/tinyproxy-1.11.3 && make uninstall

实测输出节选(关键删除动作):

 ( cd '/usr/local/bin' && rm -f tinyproxy )
 ( cd '/usr/local/share/tinyproxy' && rm -f debug.html default.html stats.html )
 ( cd '/usr/local/etc/tinyproxy' && rm -f tinyproxy.conf )

确认二进制与配置已移除:

ls /usr/local/bin/tinyproxy

实测输出:

ls: cannot access '/usr/local/bin/tinyproxy': No such file or directory

最后停用并删除自建 unit 与源码目录:

systemctl disable --now tinyproxy-local
rm -f /etc/systemd/system/tinyproxy-local.service && systemctl daemon-reload
rm -rf /usr/local/src/tinyproxy-1.11.3 /usr/local/src/tinyproxy-1.11.3.tar.gz

验证 unit 已不存在(systemctl list-unit-files | grep tinyproxy 应只剩 apt 版或为空):

tinyproxy.service                      enabled         enabled

十一、参考链接