Skip to content

APT

配置

设置代理

shell
vim /etc/apt/apt.conf.d/95proxies
shell
Acquire::http::Proxy "http://172.25.25.4:13333";

仅使用 IPv4

shell
vim /etc/apt/apt.conf
shell
Acquire::ForceIPv4 "true";

Debian 切换源

shell
cp /etc/apt/sources.list /etc/apt/sources.list.$(date +"%Y%m%d%H%M%S")

cat /etc/apt/sources.list
sed -i "s#deb.debian.org#mirrors.aliyun.com#" /etc/apt/sources.list
sed -i "s#security.debian.org#mirrors.aliyun.com#" /etc/apt/sources.list
cat /etc/apt/sources.list
apt update
shell
cp /etc/apt/sources.list /etc/apt/sources.list.$(date +"%Y%m%d%H%M%S")

cat /etc/apt/sources.list
sed -i "s#deb.debian.org#mirrors.tencent.com#" /etc/apt/sources.list
sed -i "s#security.debian.org#mirrors.tencent.com#" /etc/apt/sources.list
cat /etc/apt/sources.list
apt update
shell
cp /etc/apt/sources.list /etc/apt/sources.list.$(date +"%Y%m%d%H%M%S")

cat /etc/apt/sources.list
sed -i "s#deb.debian.org#mirrors.huaweicloud.com#" /etc/apt/sources.list
sed -i "s#security.debian.org#mirrors.huaweicloud.com#" /etc/apt/sources.list
cat /etc/apt/sources.list
apt update

Ubuntu 切换源

shell
cp /etc/apt/sources.list /etc/apt/sources.list.$(date +"%Y%m%d%H%M%S")

cat /etc/apt/sources.list
sed -i "s#archive.ubuntu.com#mirrors.aliyun.com#" /etc/apt/sources.list
sed -i "s#security.ubuntu.com#mirrors.aliyun.com#" /etc/apt/sources.list
cat /etc/apt/sources.list
apt update
shell
cp /etc/apt/sources.list /etc/apt/sources.list.$(date +"%Y%m%d%H%M%S")

cat /etc/apt/sources.list
sed -i "s#archive.ubuntu.com#mirrors.tencent.com#" /etc/apt/sources.list
sed -i "s#security.ubuntu.com#mirrors.tencent.com#" /etc/apt/sources.list
cat /etc/apt/sources.list
apt update
shell
cp /etc/apt/sources.list /etc/apt/sources.list.$(date +"%Y%m%d%H%M%S")

cat /etc/apt/sources.list
sed -i "s#archive.ubuntu.com#mirrors.huaweicloud.com#" /etc/apt/sources.list
sed -i "s#security.ubuntu.com#mirrors.huaweicloud.com#" /etc/apt/sources.list
cat /etc/apt/sources.list
apt update

关闭自动更新

shell
vim /etc/apt/apt.conf.d/50unattended-upgrades

Unattended-Upgrade::Allowed-Origins {
  
  # 注释掉不想更新的软件
  
}

sudo systemctl restart unattended-upgrades
shell
sudo systemctl stop unattended-upgrades
shell
sudo systemctl disable unattended-upgrades

允许 Root 用户远程连接

/etc/ssh/sshd_config 文件中,将 PermitRootLogin 参数的值改为 yes,然后重启 SSH 服务。

shell
vim /etc/ssh/sshd_config
shell
PermitRootLogin yes
shell
sudo systemctl restart ssh