LKL 使用前置需求
LKL 要求 ldd 的版本至少在 2.14 ,目前我测试下来,如果不想折腾建议直接安装 CentOS7 , Debian8 和 Ubuntu16
安装包只使用 64bit 的系统。
默认的端口转发只转发了 9000-9999 的端口,如果你不想费心修改,请把 ssr 等应用的端口设在这个范围

wget --no-check-certificate https://github.com/91yun/uml/raw/master/lkl/install.sh && bash install.sh

ping 10.0.0.2
如果 10.0.0.2 能 ping 通说明成功, ping 不通说明失败

如果修改转发端口
修改 /root/lkl/run.sh ,查找 9000-9999 ,改成你想要的端口段
修改 /root/lkl/haproxy.cfg 查找 9000-9999 ,改成你想要的端口段
重启 vps

转自 91yun

/etc/apt/sources.list

清华的源

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main multiverse restricted universe

阿里的源

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

官方的源

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted multiverse universe

manyuser是一个shadowsocks多用户后端(项目地址
首先更新相关

[php]apt-get update
apt-get install -y --force-yes build-essential autoconf libtool libssl-dev curl[/php]

安装PIP,python-m2crypto cymysql

[php]apt-get install python-pip git python-m2crypto
pip install cymysql[/php]

安装manyuser

[php]
git clone -b manyuser https://github.com/mengskysama/shadowsocks.git[/php]

进入ss目录

[php]cd /root/shadowsocks/shadowsocks[/php]

编辑Config.py的数据库文件:
QQ截图20160320235253
最好用别的服务器上的mysql服务器,注意开远程访问

最后运行

[php]python server.py[/php]

优化

内核参数优化

首先,将 Linux 内核升级到 3.5 或以上。

第一步,增加系统文件描述符的最大限数

编辑文件 limits.conf

[php]vi /etc/security/limits.conf[/php]

增加以下两行

[php]* soft nofile 51200
* hard nofile 51200[/php]

启动shadowsocks服务器之前,设置以下参数 ulimit -n 51200

第二步,调整内核参数
修改配置文件 /etc/sysctl.conf

[php]fs.file-max = 51200

net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.netdev_max_backlog = 250000
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 = 8192
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[/php]
修改后执行 sysctl -p 使配置生效

锐速

锐速是一款非常不错的TCP底层加速软件,可以非常方便快速地完成服务器网络的优化,配合 ShadowSocks 效果奇佳。

然后确定自己的内核是否在锐速的支持列表里,如果不在,请先更换内核,如果不确定,请使用 手动安装。

安装完锐速之后

我们还要修改锐速的3个参数

[php]vi /serverspeeder/etc/config[/php]

[php]rsc="1" #RSC网卡驱动模式
advinacc="1" #流量方向加速
maxmode="1" #最大传输模式
digitalocean vps的网卡支持rsc和gso高级算法,所以可以开启rsc="1",gso="1"。[/php]

重新启动锐速

[php]service serverSpeeder restart[/php]

net-speeder

net-speeder 原理非常简单粗暴,就是发包翻倍,这会占用大量的国际出口带宽,本质是损人利己,不建议使用。

(1) Ubuntu/Debian 下安装依赖包

[php]apt-get install libnet1
apt-get install libpcap0.8
apt-get install libnet1-dev
apt-get install libpcap0.8-dev[/php]
(2) Centos 下安装依赖包
需要配置 epel 第三方源。下载 epel :http://dl.fedoraproject.org/pub/epel/ 。例如,Centos 7 x64:

[php]wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -ivh epel-release-7-5.noarch.rpm
yum repolist[/php]

然后安装依赖包:

[php]yum install libnet libpcap libnet-devel libpcap-devel[/php]

(3) 下载官方的 tar.gz 压缩包。解压安装运行:

[php]wget http://net-speeder.googlecode.com/files/net_speeder-v0.1.tar.gz
tar zxvf net_speeder-v0.1.tar.gz
cd net_speeder
chmod 777 *
sh build.sh -DCOOKED[/php]

首先你需要知道你的网卡设备名,可以使用 ifconfig 查看。假设是eth0,那么运行方法是:

[php]./net_speeder eth0 "ip"[/php]

关闭 net-speeder

[php]killall net_speeder[/php]

hybla加速

查看我这个文章
传送门

装完军哥的LNMP发现无法发送邮件,先检测下25 port是否被封,发现没有,SMTP能正常发送,但是非常不喜欢SMTP发送,喜欢直接用mail()发
重装sendmail
yum -y install sendmail
修改PHP.ini中sendmail_path
vi php.ini
搜索sendmail_path
去除;并且在在后面填上/usr/sbin/sendmail -t –i
[php]sendmail_path = /usr/sbin/sendmail -t –i[/php]