gpt4 book ai didi

linux - tinyproxy:如何在 Ubuntu 上手动安装最新版本 1.11.0?

转载 作者:行者123 更新时间:2023-12-04 18:58:44 26 4
gpt4 key购买 nike

关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。












我们不允许在 Stack Overflow 上提出有关专业服务器或网络相关基础设施管理的问题。您可以编辑问题,使其成为 on-topic对于堆栈溢出。


3个月前关闭。







Improve this question




我想在 Ubuntu 上安装最新的 tinyproxy 版本 1.11.0。我怎样才能做到这一点?
不幸的是 sudo apt update; sudo apt install tinyproxy -y;不适合我,只给我 2018 年最新的稳定版本 1.10.0。
所以我尝试在 GitHub 上下载并解压缩最新版本
https://github.com/tinyproxy/tinyproxy/releases
但我还不能让它正常安装。
到目前为止我尝试过的:

sudo apt update;
... [loading the unzipped tinyproxy 1.11.0 folder via own GitHub repo]
cd OwnGitHubRepo/tinyproxy-1.11.0
sudo apt-get install build-essential -y
sudo apt install autoconf -y
autoconf
./configure
make
sudo make install
安装似乎一直以 tinyproxy -v 的方式运行。返回: tinyproxy 1.11.0但是我现在无法运行我通常会执行的以下命令:
sudo /etc/init.d/tinyproxy restart;
因为有 /etc/ 内没有 tinyproxy 文件夹尚未上市。 :/

(另外 sudo lsof -i:8888 还没有显示任何列表服务器)

文件:
http://tinyproxy.github.io/

在 AWS EC2 Ubuntu Server 20.04 LTS (HVM)、SSD 卷类型下试过

最佳答案

  • 确保使用最新的软件包更新系统
  • ubuntu@ip-172-30-2-209:~$ sudo su -
    root@ip-172-30-2-209:~#
    root@ip-172-30-2-209:~# apt-get update
    root@ip-172-30-2-209:~# apt-get dist-upgrade
    如果有新内核可用,您可以重新启动服务器
    root@ip-172-30-2-209:~# reboot
  • 安装构建工具:
  • root@ip-172-30-2-209:~# apt-get install build-essential
    root@ip-172-30-2-209:~# apt-get install autoconf
  • 下载源代码并构建软件
  • root@ip-172-30-2-209:~# wget https://github.com/tinyproxy/tinyproxy/releases/download/1.11.0/tinyproxy-1.11.0.tar.bz2
    root@ip-172-30-2-209:~# tar -jxvf tinyproxy-1.11.0.tar.bz2
    root@ip-172-30-2-209:~# cd tinyproxy-1.11.0/
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# ./configure
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# make
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# 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/bin/mkdir -p '/usr/local/share/doc/tinyproxy'
    /usr/bin/install -c -m 644 AUTHORS NEWS README README.md '/usr/local/share/doc/tinyproxy'
  • 配置软件

  • 符号链接(symbolic link)配置文件夹
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# ln -s /usr/local/etc/tinyproxy /etc/
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# ls -la /etc/ | grep tinyproxy
    lrwxrwxrwx 1 root root 24 Apr 3 09:53 tinyproxy -> /usr/local/etc/tinyproxy
    检查nobody用户组
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# cat /etc/passwd | grep nobody
    nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# cat /etc/group | grep 65534
    nogroup:x:65534:
    由于nobody 被分配到nogroup 组,因此将tinyproxy 配置中的Group 元素从nobody 组更改为nogroup
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# sed -i s/'Group nobody'/'Group nogroup'/g /etc/tinyproxy/tinyproxy.conf
    根据您的期望配置其余的 tinyproxy(这是最小设置)
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# cat /etc/tinyproxy/tinyproxy.conf | grep -v "^#\|^$"
    User nobody
    Group nogroup
    Port 8888
    Timeout 600
    DefaultErrorFile "/usr/local/share/tinyproxy/default.html"
    StatFile "/usr/local/share/tinyproxy/stats.html"
    LogLevel Info
    MaxClients 100
    Allow 127.0.0.1
    Allow ::1
    ViaProxyName "tinyproxy"
    测试连接
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# tinyproxy -d -c /etc/tinyproxy/tinyproxy.conf
    NOTICE Apr 03 09:56:13.294 [8179]: Initializing tinyproxy ...
    NOTICE Apr 03 09:56:13.294 [8179]: Reloading config file
    INFO Apr 03 09:56:13.294 [8179]: Setting "Via" header to 'tinyproxy'
    NOTICE Apr 03 09:56:13.294 [8179]: Reloading config file finished
    INFO Apr 03 09:56:13.294 [8179]: listen_sock called with addr = '(NULL)'
    INFO Apr 03 09:56:13.294 [8179]: trying to listen on host[0.0.0.0], family[2], socktype[1], proto[6]
    INFO Apr 03 09:56:13.294 [8179]: listening on fd [3]
    INFO Apr 03 09:56:13.294 [8179]: trying to listen on host[::], family[10], socktype[1], proto[6]
    INFO Apr 03 09:56:13.294 [8179]: listening on fd [4]
    INFO Apr 03 09:56:13.294 [8179]: Now running as group "nogroup".
    INFO Apr 03 09:56:13.294 [8179]: Now running as user "nobody".
    INFO Apr 03 09:56:13.294 [8179]: Setting the various signals.
    INFO Apr 03 09:56:13.294 [8179]: Starting main loop. Accepting connections.

    CTRL+C
  • 创建一个服务来运行 tinyproxy
  • root@ip-172-30-2-209:~/tinyproxy-1.11.0# nano /lib/systemd/system/tinyproxy.service
    [Unit]
    Description=tinyproxy service
    After=network.target
    StartLimitIntervalSec=0

    [Service]
    Type=simple
    Restart=always
    RestartSec=1
    User=nobody
    Group=nogroup
    ExecStart=/usr/local/bin/tinyproxy -d -c /etc/tinyproxy/tinyproxy.conf

    [Install]
    WantedBy=multi-user.target
  • 启动服务并检查是否一切正常
  • root@ip-172-30-2-209:~/tinyproxy-1.11.0# systemctl enable tinyproxy.service
    Created symlink /etc/systemd/system/multi-user.target.wants/tinyproxy.service → /lib/systemd/system/tinyproxy.service.
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# systemctl status tinyproxy.service
    ● tinyproxy.service - tinyproxy service
    Loaded: loaded (/lib/systemd/system/tinyproxy.service; enabled; vendor preset: enabled)
    Active: active (running) since Sun 2022-04-03 10:00:20 UTC; 5s ago
    Main PID: 8236 (tinyproxy)
    Tasks: 1 (limit: 1145)
    Memory: 1.0M
    CGroup: /system.slice/tinyproxy.service
    └─8236 /usr/local/bin/tinyproxy -d -c /etc/tinyproxy/tinyproxy.conf

    Apr 03 10:00:20 ip-172-30-2-209 tinyproxy[8236]: INFO Apr 03 10:00:20.980 [8236]: Setting "Via" header to 'tinyproxy'
    Apr 03 10:00:20 ip-172-30-2-209 tinyproxy[8236]: NOTICE Apr 03 10:00:20.980 [8236]: Reloading config file finished
    Apr 03 10:00:20 ip-172-30-2-209 tinyproxy[8236]: INFO Apr 03 10:00:20.980 [8236]: listen_sock called with addr = '(NULL)'
    Apr 03 10:00:20 ip-172-30-2-209 tinyproxy[8236]: INFO Apr 03 10:00:20.980 [8236]: trying to listen on host[0.0.0.0], family[2], socktype[1], proto[6]
    Apr 03 10:00:20 ip-172-30-2-209 tinyproxy[8236]: INFO Apr 03 10:00:20.980 [8236]: listening on fd [3]
    Apr 03 10:00:20 ip-172-30-2-209 tinyproxy[8236]: INFO Apr 03 10:00:20.980 [8236]: trying to listen on host[::], family[10], socktype[1], proto[6]
    Apr 03 10:00:20 ip-172-30-2-209 tinyproxy[8236]: INFO Apr 03 10:00:20.980 [8236]: listening on fd [4]
    Apr 03 10:00:20 ip-172-30-2-209 tinyproxy[8236]: INFO Apr 03 10:00:20.980 [8236]: Not running as root, so not changing UID/GID.
    Apr 03 10:00:20 ip-172-30-2-209 tinyproxy[8236]: INFO Apr 03 10:00:20.980 [8236]: Setting the various signals.
    Apr 03 10:00:20 ip-172-30-2-209 tinyproxy[8236]: INFO Apr 03 10:00:20.980 [8236]: Starting main loop. Accepting connections.
    安装 net-tools 检查监听端口
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# apt-get install net-tools
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# netstat -napt | grep LISTEN | grep tinyproxy
    tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN 8236/tinyproxy
    tcp6 0 0 :::8888 :::* LISTEN 8236/tinyproxy
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# lsof -i:8888
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    tinyproxy 8236 nobody 3u IPv4 34119 0t0 TCP *:8888 (LISTEN)
    tinyproxy 8236 nobody 4u IPv6 34120 0t0 TCP *:8888 (LISTEN)
  • 其他

  • a) 日志和 Pid 文件
    准备 pid 和 log 目录
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# mkdir /var/run/tinyproxy/
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# mkdir /var/log/tinyproxy/
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# chown -R nobody:nogroup /var/run/tinyproxy/
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# chown -R nobody:nogroup /var/log/tinyproxy/
    在 tinyproxy 配置中添加 pid 和 log 参数
    root@ip-172-30-2-209:~/tinyproxy-1.11.0#
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# cat /etc/tinyproxy/tinyproxy.conf | grep ^LogFile
    LogFile "/var/log/tinyproxy/tinyproxy.log"
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# cat /etc/tinyproxy/tinyproxy.conf | grep ^PidFile
    PidFile "/var/run/tinyproxy/tinyproxy.pid"
    重启服务
    root@ip-172-30-2-209:~/tinyproxy-1.11.0# systemctl restart tinyproxy.service
    b) 过程限制
    root@ip-172-30-2-209:~# ps aux | grep tinyproxy
    nobody 64427 9.8 0.5 789836 10232 ? Ssl 12:11 0:00 /usr/local/bin/tinyproxy -d -c /etc/tinyproxy/tinyproxy.conf
    root 65436 0.0 0.0 7696 644 pts/0 S+ 12:11 0:00 grep --color=auto tinyproxy
    root@ip-172-30-2-209:~# cat /proc/64427/limits | grep "Max processes\|Max open files"
    Max processes 7151 7151 processes
    Max open files 1024 524288 files
    要提高这些,请编辑/lib/systemd/system/tinyproxy.service 文件并在 [Service] 部分添加以下行
    [Service]
    ...
    LimitNOFILE=700000
    LimitNPROC=700000
    ...
    然后重新加载systemd并重启服务
    root@ip-172-30-2-209:~# systemctl daemon-reload
    root@ip-172-30-2-209:~# systemctl restart tinyproxy.service
    检查结果
    root@ip-172-30-2-209:~# ps axu | grep tinyproxy
    nobody 68439 0.6 0.1 533092 3068 ? Ssl 12:13 0:00 /usr/local/bin/tinyproxy -d -c /etc/tinyproxy/tinyproxy.conf
    root 68490 0.0 0.0 7696 656 pts/0 S+ 12:13 0:00 grep --color=auto tinyproxy
    root@ip-172-30-2-209:~# cat /proc/68439/limits | grep "Max processes\|Max open files"
    Max processes 700000 700000 processes
    Max open files 700000 700000 files

    关于linux - tinyproxy:如何在 Ubuntu 上手动安装最新版本 1.11.0?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71717463/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com