如何编辑/恢复’sources.list’文件
如何恢复已崩溃的sources.list
,我无法进行任何软件更新。 当我点击更新图标时,我没有得到任何回复。 我尝试编辑sources.list
文件,“vi”编辑器不起作用。 我试图在“软件更新程序”上输入以下行:
deb http://deb.torproject.org/torproject.org trusty main deb-src http://deb.torproject.org/torproject.org trusty main
如果你能帮助我,我将不胜感激; 我不擅长使用终端。
14.04上的默认sources.list
文件:
# deb http://be.archive.ubuntu.com:80/ubuntu/ trusty main restricted # deb http://be.archive.ubuntu.com:80/ubuntu/ trusty-updates main restricted # deb http://security.ubuntu.com/ubuntu trusty-security main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://be.archive.ubuntu.com:80/ubuntu/ trusty main restricted deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://be.archive.ubuntu.com:80/ubuntu/ trusty-updates main restricted deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty-updates main restricted ## NB software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://be.archive.ubuntu.com:80/ubuntu/ trusty universe deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty universe deb http://be.archive.ubuntu.com:80/ubuntu/ trusty-updates universe deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty-updates universe ## NB software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://be.archive.ubuntu.com:80/ubuntu/ trusty multiverse deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty multiverse deb http://be.archive.ubuntu.com:80/ubuntu/ trusty-updates multiverse deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty-updates multiverse ## NB software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://be.archive.ubuntu.com:80/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://be.archive.ubuntu.com:80/ubuntu/ trusty-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu trusty-security main restricted deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted deb http://security.ubuntu.com/ubuntu trusty-security universe deb-src http://security.ubuntu.com/ubuntu trusty-security universe deb http://security.ubuntu.com/ubuntu trusty-security multiverse deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu trusty partner # deb-src http://archive.canonical.com/ubuntu trusty partner ## Uncomment the following two lines to add software from Ubuntu's ## 'extras' repository. ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. # deb http://extras.ubuntu.com/ubuntu trusty main # deb-src http://extras.ubuntu.com/ubuntu trusty main
该文件的位置是: /etc/apt/source.list
您可以通过发出sudo vi /etc/apt/source.list
或sudo nano /etc/apt/source.list
可能更容易)来编辑它。
如果要添加提到的那些存储库,则应将这些行添加到文件的底部:
# Tor Project Repositories deb http://deb.torproject.org/torproject.org trusty main deb-src http://deb.torproject.org/torproject.org trusty main
注意:
默认情况下,您可以在/etc/apt
dir中找到名为sources.list.save
的此文件的备份
所以你可以用它来恢复你丢失的那个。
sudo cp /etc/apt/sources.list.save /etc/apt/sources.list
否则,如果您没有此文件,可以访问此链接: http : //repogen.simplylinux.ch/输入您的信息,您将获得自定义sources.list
文件对于默认的存储库集,您需要启用这些存储库。
- 所有的Ubuntu Branches存储库。
- 安全 – 重要的安全更新。
- 安全源存储库
- 更新 – 推荐的更新
- 更新源存储库
只需删除文件sources.list
sudo rm /etc/apt/sources.list
或者如果你不相信我,请备份。
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
之后
- 通过Unity Dash启动软件和更新
- 单击Canonical支持的免费和开源软件(主)复选框
- 输入您的密码
- 关闭对话框
你会有一个新文件
- 如何解决“dpkg:error handling存档/var/cache/apt/archives/libvlccore9_4.0.0~rc1~~git20171225+r73378+113~ubuntu16.04.1_amd64.deb(unpack)”
- apt-get upgrade:分段错误树… 50%
- 如何在14.10上安装WinUSB
- 为什么apt无法找到任何包的源代码?
- ‘apt-get’不适用于Proxy
- apt-get要求我插入CD,为什么?
- ‘apt-get’总是因ERROR 404而失败:找不到包(flashplugin-downloader)
- 在没有APT Pin的情况下从更新中保留包裹?
- Apt-get需要很长时间来更新\升级