ubuntu安裝gcc
1、首先備份Ubuntu源列表:sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
2、開啟更新源列表:sudo gedit /etc/apt/sources.list
3、修改源列表。
中國科技大學的源一般使用起來比較快,直接選擇中科大的源。
刪除source.list檔案中的源,將下面的直接複製過去:
# USTC (University of Science and Technology of Thina)
# xenial is ubuntu 16.04 version
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
4、更新源。 sudo apt-get update
5、安裝:
sudo apt-get install build-essential