一键智能更换源
Debian
安装速度(apt-get)
很大程度上取决于源的速度。
以下是适用于Debian 7
和Debain 8
的源,
该源可以自动定向至对于你速度最快的官方源地址,提高你的安装速度。
此shell已经帮你去除默认的CD ROM
项,避免apt-get update
时出错。
脚本地址:
bash -c "$(wget --no-check-certificate -qO- 'https://moeclub.org/attachment/LinuxShell/src.sh')"
附上完整源码:
#!/bin/bash [ ! –f /etc/os–release ] && echo “Not Found Version! “ && exit 1; [ –f /etc/os–release ] && DEB_VER=“$(awk -F'[= “]‘ ‘/VERSION_ID/{print $3}‘ /etc/os-release)” [ -z $DEB_VER ] && echo “Error, Found Version! ” && exit 1; sed -i ‘/debian wheezy main/‘d /etc/apt/sources.list sed -i ‘/debian wheezy–backports main/‘d /etc/apt/sources.list sed -i ‘/debian wheezy–updates main/‘d /etc/apt/sources.list sed -i ‘/debian jessie main/‘d /etc/apt/sources.list sed -i ‘/debian jessie–backports main/‘d /etc/apt/sources.list sed -i ‘/debian jessie–updates main/‘d /etc/apt/sources.list echo “deb http://httpredir.debian.org/debian wheezy main” >>/etc/apt/sources.list echo “deb-src http://httpredir.debian.org/debian wheezy main” >>/etc/apt/sources.list [ “$DEB_VER” == ‘7‘ ] && echo “deb http://httpredir.debian.org/debian wheezy-backports main” >> /etc/apt/sources.list [ “$DEB_VER” == ‘7‘ ] && echo “deb-src http://httpredir.debian.org/debian wheezy-backports main” >> /etc/apt/sources.list [ “$DEB_VER” == ‘7‘ ] && echo “deb http://httpredir.debian.org/debian wheezy-updates main” >> /etc/apt/sources.list [ “$DEB_VER” == ‘7‘ ] && echo “deb-src http://httpredir.debian.org/debian wheezy-updates main” >> /etc/apt/sources.list echo “deb http://httpredir.debian.org/debian jessie main” >>/etc/apt/sources.list echo “deb-src http://httpredir.debian.org/debian jessie main” >>/etc/apt/sources.list [ “$DEB_VER” == ‘8‘ ] && echo “deb http://httpredir.debian.org/debian jessie-backports main” >> /etc/apt/sources.list [ “$DEB_VER” == ‘8‘ ] && echo “deb-src http://httpredir.debian.org/debian jessie-backports main” >> /etc/apt/sources.list [ “$DEB_VER” == ‘8‘ ] && echo “deb http://httpredir.debian.org/debian jessie-updates main” >> /etc/apt/sources.list [ “$DEB_VER” == ‘8‘ ] && echo “deb-src http://httpredir.debian.org/debian jessie-updates main” >> /etc/apt/sources.list sed -i ‘/deb cdrom/‘d /etc/apt/sources.list sed -i ‘/^$/‘d /etc/apt/sources.list [ “$DEB_VER” == ‘7‘ ] && { [ -f /etc/apt/preferences ] && mv -f /etc/apt/preferences /etc/apt/preferences.bak cat >/etc/apt/preferences</etc/apt/preferences<
禁用IPV6
如果,发现更新源没有速度,< 我想到了两种可能提供参考: 1.可能是DNS问题,[非国内的的机器]尝试更换为 8.8.8.8。 2.可能是主机提供商IPv6支持不完善,禁用掉或者选择不支持IPv6的源即可。 禁用IPv6操作如下:
echo 'net.ipv6.conf.all.disable_ipv6 = 1' >>/etc/sysctl.conf echo 'net.ipv6.conf.default.disable_ipv6 = 1' >>/etc/sysctl.conf sysctl -p
文章评论