0

Sorry for the newb question. I'm trying to add a repository to my ubuntu machine:

 $ sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
 <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOFE: This command can only be used by root.
(23) Failed writing body
$ cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
> deb https://apt.kubernetes.io/ kubernetes-xenial main
> EOF^C

But the command is 'breaking' in half when I try to run it by pasting it into the terminal. I'm having trouble with the cat EOF part of the command.

This is the command that I want to run:

sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF

This is on Ubuntu 20.04 LTS (Focal Fossa).

cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"

How can I get this working?

1 Answers1

0

It looks like you should be using 2 distinct commands. cat and apt-key commands are distinct.

Further, the cat command serves only to automatically create the proper sources.list file. You can just copy-paste the text into the specified file if you have access to any sort of text editor.

Just run the cat command separately from the apt-key command and you'll be golden.

Kulfy
  • 18,154