Dragon
主机之家测评主机之家测评  2019-08-22 00:28 主机之家测评 隐藏边栏 |   抢沙发  124 
文章评分 0 次,平均分 0.0

此文章选用 Virmach 最便宜的 5 刀/年的 VPS 来测试,VPS 测评请看以下文章:

此教程以 Debian 为例:
第一步,重装非商家由民间提供的纯净系统

先在 Virmach 控制面板,重装 Debian 7/8,如果是则不用装,为下面重装民间纯净系统做准备。
下载脚本

 

1
wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && chmod a+x InstallNET.sh

锐速,重装为 Debian 7 32 位

bash InstallNET.sh -d 7 -v 32 -a

BBR,重装为 Debian 8 64 位

bash InstallNET.sh -d 8 -v 64 -a

登陆 SSH 默认密码为:Vicer

说明下,这个装完的系统,会自动添加物理内存两倍的 swap 虚拟内存,128×2=256
256 虚拟内存,足够的了。小内存 VPS,还是有必要用 swap!

第二步,内核参数优化

1.增加系统文件描述符的最大限数

编辑文件 limits.conf
vi /etc/security/limits.conf
最后新增两行添加命令:

 

1
2
* soft nofile 51200
* hard nofile 51200

如发现 limits.conf 文件内容已经有,请修改为上。

编辑文件 profile
最后新增一行,添加命令。
vi /etc/profile

ulimit -SHn 51200

修改后重启,检查是否生效命令:ulimit -n

2.调整内核参数
修改配置文件 sysctl.conf
vi /etc/sysctl.conf
最后新增一行添加命令:

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
fs.file-max = 51200
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.rmem_default = 65536
net.core.wmem_default = 65536
net.core.netdev_max_backlog = 4096
net.core.somaxconn = 4096
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.ipv4.tcp_mtu_probing = 1
net.ipv4.tcp_congestion_control = hybla
vm.min_free_kbytes = 5120
vm.overcommit_memory = 1
vm.panic_on_oom = 1
vm.swappiness = 80
vm.vfs_cache_pressure = 200

第三步,安装 BBR 或者锐速

1.暴力 BBR
参考:https://github.com/tcp-nanqinlang/wiki/wiki/general
安装:

 

1
2
wget https://github.com/tcp-nanqinlang/general/releases/download/3.4.2.1/tcp_nanqinlang-fool-1.3.0.sh
bash tcp_nanqinlang-fool-1.3.0.sh

2.锐速
安装:

 

1
wget --no-check-certificate -O appex.sh https://raw.githubusercontent.com/0oVicero0/serverSpeeder_Install/master/appex.sh && chmod x appex.sh && bash appex.sh install

锐速优化参数:
编辑文件:vi /appex/etc/config

 

1
2
3
4
initialCwndWan="65"
shaperEnable="0"
SmBurstMS="20"
shortRttMS="90"

数值修改为上的即可。
重启锐速       /appex/bin/serverSpeeder.sh restart

锐速用户,一定选择,否则会爆。
Debian 或 Ubuntu 下一键安装 libev 版
Virmach 128M  BBR/锐速,二选一 优化方案。

再精简的话,那就是要卸载 apt-get remove rsyslog
同时,一定要修改 SSH 端口。

对于小内存的 VPS,我强烈建议装 32 位的系统。

本文为原创文章,版权归所有,欢迎分享本文,转载请保留出处!

发表评论

扫一扫二维码分享