一、必要操作
如有必要,开机第一步是DD命令重装系统,DD成debian11 64位原版系统
1、用passwd命令修改密码
2、打开sshd_config文件,位于/etc/ssh/sshd_config /etc/ssh/下,把SSH端口有默认的22改成四位数
Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
3、换源(debian11)
纯命令方式换国外源(整体复制、整体粘贴,不要变成一行)
cat > /etc/apt/sources.list << EOF deb http://mirrors.xtom.com/debian/ bullseye main contrib non-free deb-src http://mirrors.xtom.com/debian/ bullseye main contrib non-free deb http://mirrors.xtom.com/debian/ bullseye-updates main contrib non-free deb-src http://mirrors.xtom.com/debian/ bullseye-updates main contrib non-free deb http://mirrors.xtom.com/debian/ bullseye-backports main contrib non-free deb-src http://mirrors.xtom.com/debian/ bullseye-backports main contrib non-free deb http://mirrors.xtom.com/debian-security/ bullseye-security main contrib non-free deb-src http://mirrors.xtom.com/debian-security/ bullseye-security main contrib non-free EOF
apt update # 更新源列表
纯命令方式换官方源(整体复制、整体粘贴,不要变成一行)
cat > /etc/apt/sources.list << EOF deb http://deb.debian.org/debian/ bullseye main contrib non-free deb-src http://deb.debian.org/debian/ bullseye main contrib non-free deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free deb-src http://deb.debian.org/debian/ bullseye-updates main contrib non-free deb http://deb.debian.org/debian/ bullseye-backports main contrib non-free deb-src http://deb.debian.org/debian/ bullseye-backports main contrib non-free deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free deb-src http://deb.debian.org/debian-security/ bullseye-security main contrib non-free EOF
apt update # 更新源列表
纯命令方式换国内中科大源(整体复制、整体粘贴,不要变成一行)
cat > /etc/apt/sources.list << EOF deb https://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free deb https://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free deb https://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free deb https://mirrors.ustc.edu.cn/debian-security/ bullseye-security main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian-security/ bullseye-security main contrib non-free EOF
apt update # 更新源列表
4、换源(debian12)
纯命令方式换国外源(整体复制、整体粘贴,不要变成一行)
cat > /etc/apt/sources.list << EOF deb http://mirrors.xtom.com/debian/ bookworm main contrib non-free non-free-firmware deb-src http://mirrors.xtom.com/debian/ bookworm main contrib non-free non-free-firmware deb http://mirrors.xtom.com/debian/ bookworm-updates main contrib non-free non-free-firmware deb-src http://mirrors.xtom.com/debian/ bookworm-updates main contrib non-free non-free-firmware deb http://mirrors.xtom.com/debian/ bookworm-backports main contrib non-free non-free-firmware deb-src http://mirrors.xtom.com/debian/ bookworm-backports main contrib non-free non-free-firmware deb http://mirrors.xtom.com/debian-security/ bookworm-security main contrib non-free non-free-firmware deb-src http://mirrors.xtom.com/debian-security/ bookworm-security main contrib non-free non-free-firmware EOF
纯命令方式换国内源(整体复制、整体粘贴,不要变成一行)
cat > /etc/apt/sources.list << EOF deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware EOF
apt update # 更新源列表
5、更新系统及安装wget、cul等常用软件
apt -y install sudo wget curl neofetch btop fuse mtr socat vim zip unzip binutils xz-utils tmux && timedatectl set-timezone "Asia/Shanghai" && sudo apt install -y vnstat && sudo systemctl enable vnstat && update-rc.d vnstat enable && sudo systemctl start vnstat python3-pip python3 #除基本插件外另安装vnsta流量监控工具
apt update -y && apt upgrade -y && reboot #更新系统并重启
三、可选操作
1、安装BBR加速(就是爱生活脚本)
wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
debian11自带BBR内核,选4就可以启动BBR加速内核。
2、设置虚拟内存
wget https://www.moerats.com/usr/shell/swap.sh && bash swap.sh #设置虚拟内存,建议为物理内存的两倍
如果VPS是1G内存,就写2000,如果是2G内存,就写4000,实际上是把硬盘空间拿来当内存。
3、安装gost隧道
wget --no-check-certificate -O gost.sh https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/gost.sh && chmod +x gost.sh && ./gost.sh
再次运行本脚本只需要输入
./gost.sh
4、安装X-UI面板(FranzKafkaYu版)
bash <(curl -Ls https://raw.githubusercontent.com/FranzKafkaYu/x-ui/master/install.sh)
5、安装casaos(docker母系统)
wget -qO- https://get.casaos.io | bash
6、永久关闭ipv6地址
echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee /etc/sysctl.d/99-disable-ipv6.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.d/99-disable-ipv6.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.d/99-disable-ipv6.conf
sudo sysctl --system
等于1表示关闭,可以全部复制逐行执行
如果把1改成0,表示打开
用ip addr来检测打开、关闭是否成功
如果反复打开、关闭出现失效,需要删除相应的conf文件
sudo rm /etc/sysctl.d/99-disable-ipv6.conf
sudo rm /etc/sysctl.d/99-enable-ipv6.conf