# 手把手教你自建VPS科学上网 **Published by:** [qunzhong.eth](https://paragraph.com/@qunzhong/) **Published on:** 2022-09-12 **URL:** https://paragraph.com/@qunzhong/vps ## Content 一、支持的操作系统 (CentOS 7+、Ubuntu 16+、Debian 8+) 二、准备工作 因为非root用户执行命令都要在前面加上sudo,为了方便可以用以下命令切换为root用户: 1.修改root账户密码:sudo passwd root 2.切换root账户:su root 三、具体操作步骤开启防火墙 iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -F apt-get purge netfilter-persistent(CentOS 将apt-get替换为yum install) reboot 重启服务器申请SSL证书# Debian/Ubuntu 命令apt update -y apt install -y curl apt install -y socat #CentOS 命令yum update -y yum install -y curl yum install -y socatcurl https://get.acme.sh | sh ~/.acme.sh/acme.sh --register-account -m email (email填自己具体的邮箱地址,真实邮箱成功率上升)~/.acme.sh/acme.sh --issue -d 域名 --standalone (该域名需要给自己的服务器IP做解析,推荐使用阿里云做解析)~/.acme.sh/acme.sh --installcert -d 域名 --key-file /root/private.key --fullchain-file /root/cert.crt更换你的解析域名,此步完成后会在VPS root目录下 看到证书公钥/root/cert.crt及验证文件/root/private.key 公钥:/root/cert.crt 私钥:/root/private.key安装X-ui面板 bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)安装BBR加速 wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh安装V2ray,下载链接 https://github.com/2dust/v2rayN/releases 四、参考文献 ## Publication Information - [qunzhong.eth](https://paragraph.com/@qunzhong/): Publication homepage - [All Posts](https://paragraph.com/@qunzhong/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@qunzhong): Subscribe to updates