Linux修改資源為阿里雲映象

2022-08-31 05:06:09 字數 2286 閱讀 4188

ubuntu系統

將下列文字新增到/etc/apt/sources.list檔案裡

deb raring main restricted universe multiverse

deb raring-security main restricted universe multiverse

deb raring-updates main restricted universe multiverse

deb raring-proposed main restricted universe multiverse

deb raring-backports main restricted universe multiverse

deb-src raring main restricted universe multiverse

deb-src raring-security main restricted universe multiverse

deb-src raring-updates main restricted universe multiverse

deb-src raring-proposed main restricted universe multiverse

deb-src raring-backports main restricted universe multiverse 12

3456

78910

但是執行sudo apt-get update仍然報錯,問題在於dns沒有配置好。

解決方法:

sudo vi /etc/resolv.conf1新增

# dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

# do not edit this file by hand -- your changes will be overwritten

nameserver 127.0.1.1

#這裡用的是阿里雲的dns伺服器

nameserver 223.5.5.5

nameserver 223.6.6.612

3456

之後執行sudo apt-get update就正常了。

centos系統

修改步驟:

mv /etc/yum.repos.d/centos-base.repo /etc/yum.repos.d/centos-base.repo.backup

or

cp /etc/yum.repos.d/centos-base.repo /etc/yum.repos.d/centos-base.repo.bak

centos 5

wget -o /etc/yum.repos.d/centos-base.repo 

或者

curl -o /etc/yum.repos.d/centos-base.repo 

centos 6

wget -o /etc/yum.repos.d/centos-base.repo 

或者

curl -o /etc/yum.repos.d/centos-base.repo 

centos 7

wget -o /etc/yum.repos.d/centos-base.repo 

或者

curl -o /etc/yum.repos.d/centos-base.repo 

centos 8

curl -o /etc/yum.repos.d/centos-base.repo

epel(是由 fedora 社群打造,為 rhel 及衍生發行版如 centos、scientific linux 等提供高質量軟體包的專案。裝上 epel後,可以像在 fedora 上一樣,可以通過 yum install package-name,安裝更多軟體。

wget -p /etc/yum.repos.d/
yum clean all  

yum makecache

redhat 將阿里雲映象設定為映象源

檢視版本的方式 cat etc system release red hat enterprise linux server release 7.3 maipo 上面是我電腦的查詢結果,可以看出我的電腦為7版本 wget o etc yum.repos.d centos base.repo 或 cu...

CentOS 更改 yum 映象源為阿里雲映象源

確認 centos 版本,在終端中輸入 cat proc version會得到一下內容,el7則代表為 centos 7 版本。linux version 3.xx.x x.xx.x.el7.x86 64 mockbuild kbuilder.bsys.centos.org gcc version ...

Centos6 5修改映象為國內的阿里雲源

第一步 備份你的原映象檔案,以免出錯後可以恢復。mv etc yum.repos d centos base.repo etc yum.repos d centos base.repo backup wget o etc yum.repos d centos base.repo com repo c...