更新源
apt update && apt upgrade -y
安装常用软件
apt install net-tools vim wget git screen curl xz-utils unzip sudo zip -y
ssh与宝塔出现乱码
ubuntu与debian适用
sudo echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale
开启宝塔ipv6
echo True > /www/server/panel/data/ipv6.pl
bt restart
服务器时间
sudo dpkg-reconfigure tzdata
免密登录,公钥换成自己的
mkdir /root/.ssh;echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN+I1HhcBcgv/6WGPTmnsUuV3cun1mUOAmwBdJnk7JwL xingchen " >>/root/.ssh/authorized_keys
caddy安装
echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
apt install caddy
开启ubuntu与debian bbr加速
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
测试IPv4优先还是IPv6优先
curl ip.p3terx.com
测试25端口是否开放 telnet smtp.aol.com 25
非大陆Docker安装
wget -qO- get.docker.com | bash
非大陆Docker-compose安装 sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Debian,Ubuntu 开启 BBR
#修改系统变量 echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf #保存生效 sysctl -p #查看内核是否已开启BBR lsmod | grep bbr #显示如下,即成功 tcp_bbr 20480 2
Screen
#新建i窗口 screen -S i #查看所有窗口 screen -ls #接入i窗口 screen -r i #关闭i窗口 screen -X -S i quit #结束已死进程 screen -wipe
DNS64
执行以下命令更改 /etc/resolv.conf ,三选一:
echo -e "nameserver 2001:67c:2b0::4\nnameserver 2001:67c:2b0::6" > /etc/resolv.conf
echo -e "nameserver 2001:67c:27e4:15::6411\nnameserver 2001:67c:27e4::64" > /etc/resolv.conf
echo -e "nameserver 2a03:7900:2:0:31:3:104:161" > /etc/resolv.conf
可以执行以下测试:
curl https://www.baidu.com