Ubuntu软件源更新脚本

    安装完成Linux之后总少不了要更新软件源, 每次都在命令行里面敲太麻烦了, 于是我写了下面的脚本:

#!/bin/bash

mv /etc/apt/sources.list /etc/apt/sources.list_backup

echo -e "# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted\n

deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties\n

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted\n

deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties\n

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted\n

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties\n

deb http://mirrors.aliyun.com/ubuntu/ xenial universe\n

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe\n

deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse\n

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse\n

deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse\n

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties\n

deb http://archive.canonical.com/ubuntu xenial partner\n

deb-src http://archive.canonical.com/ubuntu xenial partner\n

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted\n

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties\n

deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe\n

deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse\n" >> /etc/apt/sources.list

apt-get update

apt-get upgrade -y

脚本执行功能如下:

    备份原有的软件源列表文件;  将阿里云换为软件源;  进行更新。

只要使用超级用户执行脚本就好~


参考链接:

zhidao.baidu.com/question/541410651.html

www.linuxidc.com/Linux/2014-04/100476.htm

www.07net01.com/2015/07/868853.html 

Ubuntu 16.04 几个国内更新源:www.cnblogs.com/bovenson/p/5752213.html 

你可能感兴趣的:(Ubuntu软件源更新脚本)