使用以下命令更新 Linux 后:
sudo apt-get update
我正在尝试安装参考程序集-pcl和ca-证书-mono按照本文分别使用以下命令:
sudo apt-get install referenceassemblies-pcl
sudo apt-get install ca-certificates-mono
命令看起来正确,按照ziyasal 的回答但我收到了这些错误:
unable to locate package referenceassemblies-pcl
unable to locate package ca-certificates-mono
输出
apt-cache policy ca-certificates-mono
apt-cache policy referenceassemblies-pcl
分别是
Unable to locate package ca-certificates-mono
Unable to locate package referenceassemblies-pcl
的输出sudo apt-add-repository ppa:referenceassemblies-pci/ppa
为:
无法添加 PPA:“ppa:referenceassemblies-pci/ppa”。
请检查 PPA 名称或格式是否正确。
输出cat /etc/apt/sources.list.d/mono-xamarin.list
cat: /etc/apt/sources.list.d/mono-xamarin.list: No such file or directory
问:我在这里做错了什么?
答案1
一切顺利。我想你忘了
sudo apt-get update
或者简单地重新开始所有步骤:
sudo rm /etc/apt/sources.list.d/mono-xamarin*
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
% apt-cache policy referenceassemblies-pcl
referenceassemblies-pcl:
Installed: 2014.04.14-1
Candidate: 2014.04.14-1
Version table:
*** 2014.04.14-1 0
500 http://download.mono-project.com/repo/debian/ wheezy/main i386 Packages
100 /var/lib/dpkg/status
% apt-cache policy mono-complete
mono-complete:
Installed: 4.0.2.5-0xamarin1
Candidate: 4.0.2.5-0xamarin1
Version table:
*** 4.0.2.5-0xamarin1 0
500 http://download.mono-project.com/repo/debian/ wheezy/main i386 Packages
100 /var/lib/dpkg/status
3.2.8+dfsg-4ubuntu4 0
500 http://de.archive.ubuntu.com/ubuntu/ vivid/universe i386 Packages
% apt-cache policy mono-complete
mono-complete:
Installed: 4.0.2.5-0xamarin1
Candidate: 4.0.2.5-0xamarin1
Version table:
*** 4.0.2.5-0xamarin1 0
500 http://download.mono-project.com/repo/debian/ wheezy/main i386 Packages
100 /var/lib/dpkg/status
3.2.8+dfsg-4ubuntu4 0
500 http://de.archive.ubuntu.com/ubuntu/ vivid/universe i386 Packages
% apt-cache policy ca-certificates-mono
ca-certificates-mono:
Installed: 4.0.2.5-0xamarin1
Candidate: 4.0.2.5-0xamarin1
Version table:
*** 4.0.2.5-0xamarin1 0
500 http://download.mono-project.com/repo/debian/ wheezy/main i386 Packages
100 /var/lib/dpkg/status
答案2
您是否尝试过这个:
sudo apt-add-repository ppa:referenceassemblies-pci/ppa
sudo apt-get update
sudo apt-get -y install referenceassemblies-pci
这样也许能很好地发挥作用。
答案3
echo
写入的命令可能/etc/apt/sources.list.d/mono-xamarin.list
不适用于您的情况。我在将命令传输到 Docker 映像时遇到了类似的错误 - 报告于此处 (https://github.com/docker/docker/issues/8679)。
在这种情况下,解决方案是通过管道连接到docker:
echo "deb http://download.mono-project.com/repo/debian wheezy main" | docker exec -i --user=root MyContainer tee /etc/apt/sources.list.d/mono-xamarin.list
如果不是这种情况,您可能只需用其他方式写入缺少行的文件即可。
答案4
我遇到了和你说的一样的问题。不过最后我找到了原因:我不应该同时使用 ctrl+c 和 ctrl+v 来运行这三个命令:
1.sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
2.echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
3.sudo apt-get update
这样,实际上只有第一个命令被执行。所以我一个接一个地运行这些命令,问题就解决了。