Linux 在 /etc/apt/sources.list.d/ 中创建一个文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10409235/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
creating a file inside /etc/apt/sources.list.d/
提问by user93796
I am trying to install chef
(from opscode) on ubuntu box. I am not much familiar with linux but I have to install chef
on linux in quick time.
我正在尝试chef
在 ubuntu 盒子上安装(从 opscode)。我对 linux 不太熟悉,但我必须chef
快速安装在 linux 上。
One of the steps installation guide says
安装指南说的步骤之一
Create /etc/apt/sources.list.d/opscode.list
What does this line mean? Now should I create a directory opscode.list
or file?
这条线是什么意思?现在我应该创建一个目录opscode.list
或文件吗?
/etc/apt/sources.list.d/
directory already exists.
/etc/apt/sources.list.d/
目录已经存在。
When I try to fire following command ->
当我尝试触发以下命令时 ->
cd /etc/apt/sources.list.d/
mkdir opscode.list
I get following ->
我得到以下 - >
mkdir: cannot create directory `opscode.list': Permission denied
How can I resolve the permission denied issue?
如何解决权限被拒绝的问题?
回答by Dariop
use sudo:
使用须藤:
sudo vi /etc/apt/sources.list.d/opscode.list
or maybe via echo:
或者也许通过回声:
sudo echo "deb http://apt.opscode.com/ <codename> main" > /etc/apt/sources.list.d/opscode.list
When asked for a password, type in YOUR password (not the one from root).
当要求输入密码时,请输入您的密码(不是来自 root 的密码)。
Replace "<codename>" with whatever is needed (according to the tutorial):
用任何需要的东西替换“<codename>”(根据教程):
- For Chef 0.9.x, replace codename with the supported distribution codename, such as "lucid".
- For Chef 0.10.x, replace codename with the codename, suffixed with "-0.10", for example, "lucid-0.10".
- 对于 Chef 0.9.x,将代号替换为支持的分发代号,例如“lucid”。
- 对于 Chef 0.10.x,将代号替换为代号,后缀为“-0.10”,例如“lucid-0.10”。
回答by Daniel Prett
Try it:
尝试一下:
echo "deb http://apt.opscode.com/ <codename> main" | sudo tee
/etc/apt/sources.list.d/opscode.list