< 返回上一页
解决站群服务器Linux虚拟机下载过慢问题
发布时间:2025-05-21 15:51:54
# 临时修改ifconfig eth0 mtu 1400# ..修改(Ubuntu/Debian)echo "mtu 1400" >> /etc/network/interfaces.d/eth0.cfg
# 启用BBRecho "net.core.default_qdisc=fq" >> /etc/sysctl.confecho "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.confsysctl -p
# 修改 resolv.confecho "nameserver 223.5.5.5" > /etc/resolv.confecho "nameserver 8.8.8.8" >> /etc/resolv.conf
# 增大TCP窗口echo "net.ipv4.tcp_window_scaling = 1" >> /etc/sysctl.confecho "net.ipv4.tcp_rmem = 4096 87380 6291456" >> /etc/sysctl.confecho "net.ipv4.tcp_wmem = 4096 65536 6291456" >> /etc/sysctl.confsysctl -p
# 停止并禁用防火墙(测试环境)systemctl stop firewalld
systemctl disable firewalld# 或配置允许规则(生产环境)firewall-cmd --add-service=http --permanentfirewall-cmd --reload
# 安装 axelyum install axel -y # CentOSapt-get install axel -y # Ubuntu# 使用 axel 下载axel -n 10 https://example.com/file.iso
# 备份原配置cp /etc/apt/sources.list /etc/apt/sources.list.bak# 使用阿里云源sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.listapt update
# 替换为华为云源mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bakwget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
yum clean all
yum makecache
# 测试与目标服务器的连接速度wget --report-speed=bits --limit-rate=0 https://speed.hetzner.de/100MB.bin# 使用 iperf3 测试本地网络性能# 服务端iperf3 -s# 客户端iperf3 -c server_ip
export http_proxy=http://proxy.example.com:8080export https_proxy=http://proxy.example.com:8080
location ~* \.(js|css|png|jpg|gif|ico|woff|woff2|ttf|svg)$ {
proxy_pass https://cdn.example.com;}
通过以下步骤可系统性解决 Linux 虚拟机下载过慢问题:
网络配置:调整 MTU、启用 BBR、优化 DNS。
系统参数:增大 TCP 窗口、禁用防火墙。
工具与源:使用多线程下载工具、切换国内镜像源。
资源分配:增加虚拟机 CPU / 内存、解除网络带宽限制。
若问题仍未解决,建议联系虚拟机提供商或网络管理员进一步排查物理网络或虚拟化层配置。
(声明:本文来源于网络,仅供参考阅读,涉及侵权请联系我们删除、不代表任何立场以及观点。)

上一篇:关于PHP目前比较常见的五大运行模式
下一篇:机房机柜如何清理与保养