creating a file inside /etc/apt/sources.list.d/

chef-infra, linux, permissions, ubuntu

Solution

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).

Replace "<codename>" with whatever is needed (according to the tutorial):

- 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".

Problem

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. 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? `/etc/apt/sources.list.d/` directory already exists. 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?

Original source