如何编辑/恢复“sources.list”文件

如何编辑/恢复“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

如果您能帮助我,我将不胜感激;我不擅长使用终端。

答案1

笔记:

默认情况下,你可以在目录中找到该文件的备份,/etc/apt名为 sources.list.save

因此您可以使用它来恢复丢失的。

sudo cp /etc/apt/sources.list.save /etc/apt/sources.list

否则,如果您没有此文件,您可以访问此链接:http://repogen.simplylinux.ch/输入您的信息,您将获得您的定制sources.list文件对于默认的存储库集,您需要启用这些存储库。

  1. 所有 Ubuntu 分支存储库。
  2. 安全 – 重要安全更新。
  3. 安全源存储库
  4. 更新 - 推荐更新
  5. 更新源存储库

答案2

只需删除文件即可sources.list

sudo rm /etc/apt/sources.list

如果没有,请进行备份相信我

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak

在那之后

  1. Software & Updates通过 Unity Dash开始
  2. 点击复选框Canonical-supported free and open-source software (main)
  3. 输入密码
  4. 关闭对话框

你将得到一个新文件

答案3

sources.list14.04上的默认文件:


# 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

## N.B. 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

## N.B. 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

## N.B. 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.listsudo nano /etc/apt/source.list(nano 可能对您来说更容易)来编辑它。

如果您想添加上述存储库,您应该在文件底部添加以下几行:

# Tor Project Repositories
deb http://deb.torproject.org/torproject.org trusty main
deb-src http://deb.torproject.org/torproject.org trusty main

相关内容