校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁(yè) > 知識(shí)庫(kù) > ubuntu 更換阿里源實(shí)例

ubuntu 更換阿里源實(shí)例

熱門(mén)標(biāo)簽:依蘭縣地圖標(biāo)注app 潮州地圖標(biāo)注 安陽(yáng)百應(yīng)電銷機(jī)器人加盟 百度地圖標(biāo)注開(kāi)鎖電話 琿春市地圖標(biāo)注app 公司400電話辦理價(jià)格 百度中國(guó)地圖標(biāo)注中心 山東企業(yè)電銷機(jī)器人價(jià)格 pageadm實(shí)現(xiàn)地圖標(biāo)注

網(wǎng)上應(yīng)該可以找到很多關(guān)于ubuntu源的設(shè)置方法,但是如果不搞清楚就隨便設(shè)置的話,不僅不能起到應(yīng)有的效果,還會(huì)由于一些問(wèn)題導(dǎo)致apt不可用。

最正確的更換源的方法應(yīng)該如系統(tǒng)提示的:

## a.) add ‘apt_preserve_sources_list: true‘ to /etc/cloud/cloud.cfg
## or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl

這種方法有點(diǎn)沒(méi)弄明白在/etc/apt/sources.list.d應(yīng)該添加的是什么內(nèi)容,如果是源文件的話,最后更改的模板又是什么作用?也沒(méi)有去嘗試,有時(shí)間會(huì)解決一下。

以下提供設(shè)置阿里源的方法,其他源也可以如法炮制:

1. 首先查看自己的ubuntu系統(tǒng)的codename,這一步很重要,直接導(dǎo)致你更新的源是否對(duì)你的系統(tǒng)起效果,查看方法:

    lsb_release -a

    如,我的系統(tǒng)顯示:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty

    顯示了一些ubuntu的版本信息,需要得到的是Codename,比如,我這里是trusty

2. 確認(rèn)阿里源支持:

    登陸以下網(wǎng)頁(yè):http://mirrors.aliyun.com/ubuntu/dists/

    該網(wǎng)頁(yè)顯示了阿里云支持的ubuntu系統(tǒng)下各個(gè)Codename版本,確保自己的Codename在該網(wǎng)頁(yè)中存在(一般都會(huì)有的)

2. 備份系統(tǒng)源:

    cd /etc/apt
    sudo mv sources.list sources.list_bak

3. 添加新的源文件:

    sudo vi sources.list

并添加以下內(nèi)容:注意,每一行的trusty應(yīng)該用第一步查看得到的Codename來(lái)代替

deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

4. 保存并且sudo apt-get update,更新成功

5. 以下提供配置腳本:

 1 Codename=$( (lsb_release -a)|awk ‘{print $2}‘|tail -n 1 )
 2 echo "\
 3 deb http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe
 4 deb http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe
 5 deb http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main multiverse restricted universe
 6 deb http://mirrors.aliyun.com/ubuntu/ $Codename-security main multiverse restricted universe
 7 deb http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe
 8 deb-src http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe
 9 deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe
10 deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main multiverse restricted universe
11 deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-security main multiverse restricted universe
12 deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe ">sources.list
13 apt-get update
sudo運(yùn)行該腳本即可(注意運(yùn)行之前最好備份之前的sources.list)

標(biāo)簽:晉中 公主嶺 常德 林芝 呼和浩特 三明 香港 連云港

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《ubuntu 更換阿里源實(shí)例》,本文關(guān)鍵詞  ubuntu,更換,阿里,源,實(shí)例,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《ubuntu 更換阿里源實(shí)例》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于ubuntu 更換阿里源實(shí)例的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 海盐县| 吴堡县| 贡觉县| 将乐县| 历史| 黑水县| 遂平县| 那曲县| 喀喇| 临澧县| 炎陵县| 明星| 武宁县| 睢宁县| 庆安县| 遵化市| 新闻| 仙居县| 社旗县| 蓝田县| 屏边| 牟定县| 会东县| 连州市| 泽库县| 石棉县| 沙坪坝区| 阜新| 新密市| 枣阳市| 岳西县| 贡嘎县| 佛学| 措勤县| 商都县| 庐江县| 湘潭县| 汕头市| 惠水县| 乳源| 会理县|