How to add repository from shell in Debian?
Clash Royale CLAN TAG#URR8PPP
In Ubuntu one can add a repository via following command -
sudo add-apt-repository ppa:yannubuntu/boot-repair
As Ubuntu is based on Debian code base, I was expecting that the same would work in Debian too, but it doesn't.
- What is the reason for this?
- Is there some other shell command I can use to achieve the same?
Note: I know I can edit /etc/apt/sources.list
, but I want to achieve this from the shell. I also want to know why the same command won't work when the code base is the same.
shell debian apt repository ppa
add a comment |
In Ubuntu one can add a repository via following command -
sudo add-apt-repository ppa:yannubuntu/boot-repair
As Ubuntu is based on Debian code base, I was expecting that the same would work in Debian too, but it doesn't.
- What is the reason for this?
- Is there some other shell command I can use to achieve the same?
Note: I know I can edit /etc/apt/sources.list
, but I want to achieve this from the shell. I also want to know why the same command won't work when the code base is the same.
shell debian apt repository ppa
add a comment |
In Ubuntu one can add a repository via following command -
sudo add-apt-repository ppa:yannubuntu/boot-repair
As Ubuntu is based on Debian code base, I was expecting that the same would work in Debian too, but it doesn't.
- What is the reason for this?
- Is there some other shell command I can use to achieve the same?
Note: I know I can edit /etc/apt/sources.list
, but I want to achieve this from the shell. I also want to know why the same command won't work when the code base is the same.
shell debian apt repository ppa
In Ubuntu one can add a repository via following command -
sudo add-apt-repository ppa:yannubuntu/boot-repair
As Ubuntu is based on Debian code base, I was expecting that the same would work in Debian too, but it doesn't.
- What is the reason for this?
- Is there some other shell command I can use to achieve the same?
Note: I know I can edit /etc/apt/sources.list
, but I want to achieve this from the shell. I also want to know why the same command won't work when the code base is the same.
shell debian apt repository ppa
shell debian apt repository ppa
edited Jun 26 '18 at 7:22
Stephen Kitt
167k24373452
167k24373452
asked Aug 20 '12 at 9:34
Kshitiz SharmaKshitiz Sharma
3,134104458
3,134104458
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
Debian Jessie and later (2014-)
As pointed out by @voltagex in the comments, it can now be found in the software-properties-common
package:
sudo apt-get install software-properties-common
Debian Wheezy and earlier:
The program add-apt-repository
is available in Debian. It's in the python-software-properties
package:
sudo apt-get install python-software-properties
It was added to that package in version 0.75. The current version in Debian Stable ('squeeze") is 0.60, so it doesn't have it. The version currently in Debian Testing ("wheezy") is 0.82.7.1debian1, so it's available there.
9
At least in sid, the add-apt-repository script seems to have moved to software-properties-common
– Adam Baxter
Jun 22 '14 at 10:26
Version 0.92 of python-software-properties here, and (again) missing :-(
– gatopeich
Nov 12 '14 at 11:33
3
See the comment above yours -- it's now insoftware-properties-common
– Jim Paris
Nov 12 '14 at 22:20
had hassles updating though
– peterretief
May 11 '15 at 12:46
add a comment |
Assuming you're running a non-ancient version of Debian (Etch or later), you can just drop a file in /etc/apt/sources.list.d/
The file name must end with .list
; Debian Stretch (not yet released) will likely add .sources
with a different format.
The format is the same as the main sources.list file.
The advantage is, especially if this is for some software you're distributing, you don't have to worry merging your changes into a possibly-edited /etc/apt/sources.list file (especially hard to deal with if your program is uninstalled). You can use dpkg
conffile support to put the file in /etc/apt/sources.list.d/
.
sources.list.d
exists since etch, I think.
– Gilles
Aug 20 '12 at 22:08
1
Yeah, butapt-add-repository
takes care of things like translating "ppa:" to anhttp://ppa.launchpad...
type, and to download and install the repository key so that packages are not treated as suspicious
– Ricardo Cárdenes
Jul 27 '14 at 11:24
@Gilles I think you're right—it isn't on a Sarge machine I have, and is on an Etch machine.
– derobert
Dec 8 '15 at 23:29
add a comment |
add-apt-repository
can now be found in the software-properties-common
package.
This is the right answer.
– frhd
Sep 17 '14 at 8:58
2
Omg thanks. I wonder why on earth is this not installed by default (at least on my Debian 8 Jessie)?!
– rbaleksandar
Aug 15 '15 at 14:06
@rbaleksandar this is not in all distros because it has a lot of extra things you may not want, especially in docker. Since the end goal of this task is to add something to/etc/apt/sources.list
, you might look at @Goez 's answer in this question.
– Mike D
Jan 2 at 14:19
add a comment |
Ubuntu is based on Debian but includes things Debian doesn't (and in turn are often incorporated into Debian later). The add-apt-repository
command is an example which was included in Ubuntu first.
The add-apt-repository
actually just executes a couple of commands to add the repository:
- append the repository to
/etc/apt/sources.list
- add the repository key to the machine.
A script that sort of does the same that can be found here is quoted below
#!/bin/bash
if [ $# -eq 1 ]
NM=$(uname -a && date)
NAME=$(echo $NM | md5sum | cut -f1 -d" ")
then
ppa_name=$(echo "$1" | cut -d":" -f2 -s)
if [ -z "$ppa_name" ]
then
echo "PPA name not found"
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
else
echo "$ppa_name"
echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu lucid main" >> /etc/apt/sources.list
apt-get update >> /dev/null 2> /tmp/$NAME_apt_add_key.txt
key=$(cat /tmp/$NAME_apt_add_key.txt | cut -d":" -f6 | cut -d" " -f3)
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
rm -rf /tmp/$NAME_apt_add_key.txt
fi
else
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
fi
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f45879%2fhow-to-add-repository-from-shell-in-debian%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Debian Jessie and later (2014-)
As pointed out by @voltagex in the comments, it can now be found in the software-properties-common
package:
sudo apt-get install software-properties-common
Debian Wheezy and earlier:
The program add-apt-repository
is available in Debian. It's in the python-software-properties
package:
sudo apt-get install python-software-properties
It was added to that package in version 0.75. The current version in Debian Stable ('squeeze") is 0.60, so it doesn't have it. The version currently in Debian Testing ("wheezy") is 0.82.7.1debian1, so it's available there.
9
At least in sid, the add-apt-repository script seems to have moved to software-properties-common
– Adam Baxter
Jun 22 '14 at 10:26
Version 0.92 of python-software-properties here, and (again) missing :-(
– gatopeich
Nov 12 '14 at 11:33
3
See the comment above yours -- it's now insoftware-properties-common
– Jim Paris
Nov 12 '14 at 22:20
had hassles updating though
– peterretief
May 11 '15 at 12:46
add a comment |
Debian Jessie and later (2014-)
As pointed out by @voltagex in the comments, it can now be found in the software-properties-common
package:
sudo apt-get install software-properties-common
Debian Wheezy and earlier:
The program add-apt-repository
is available in Debian. It's in the python-software-properties
package:
sudo apt-get install python-software-properties
It was added to that package in version 0.75. The current version in Debian Stable ('squeeze") is 0.60, so it doesn't have it. The version currently in Debian Testing ("wheezy") is 0.82.7.1debian1, so it's available there.
9
At least in sid, the add-apt-repository script seems to have moved to software-properties-common
– Adam Baxter
Jun 22 '14 at 10:26
Version 0.92 of python-software-properties here, and (again) missing :-(
– gatopeich
Nov 12 '14 at 11:33
3
See the comment above yours -- it's now insoftware-properties-common
– Jim Paris
Nov 12 '14 at 22:20
had hassles updating though
– peterretief
May 11 '15 at 12:46
add a comment |
Debian Jessie and later (2014-)
As pointed out by @voltagex in the comments, it can now be found in the software-properties-common
package:
sudo apt-get install software-properties-common
Debian Wheezy and earlier:
The program add-apt-repository
is available in Debian. It's in the python-software-properties
package:
sudo apt-get install python-software-properties
It was added to that package in version 0.75. The current version in Debian Stable ('squeeze") is 0.60, so it doesn't have it. The version currently in Debian Testing ("wheezy") is 0.82.7.1debian1, so it's available there.
Debian Jessie and later (2014-)
As pointed out by @voltagex in the comments, it can now be found in the software-properties-common
package:
sudo apt-get install software-properties-common
Debian Wheezy and earlier:
The program add-apt-repository
is available in Debian. It's in the python-software-properties
package:
sudo apt-get install python-software-properties
It was added to that package in version 0.75. The current version in Debian Stable ('squeeze") is 0.60, so it doesn't have it. The version currently in Debian Testing ("wheezy") is 0.82.7.1debian1, so it's available there.
edited Oct 28 '16 at 0:05
kristopolous
1607
1607
answered Aug 20 '12 at 15:13
Jim ParisJim Paris
11.4k42532
11.4k42532
9
At least in sid, the add-apt-repository script seems to have moved to software-properties-common
– Adam Baxter
Jun 22 '14 at 10:26
Version 0.92 of python-software-properties here, and (again) missing :-(
– gatopeich
Nov 12 '14 at 11:33
3
See the comment above yours -- it's now insoftware-properties-common
– Jim Paris
Nov 12 '14 at 22:20
had hassles updating though
– peterretief
May 11 '15 at 12:46
add a comment |
9
At least in sid, the add-apt-repository script seems to have moved to software-properties-common
– Adam Baxter
Jun 22 '14 at 10:26
Version 0.92 of python-software-properties here, and (again) missing :-(
– gatopeich
Nov 12 '14 at 11:33
3
See the comment above yours -- it's now insoftware-properties-common
– Jim Paris
Nov 12 '14 at 22:20
had hassles updating though
– peterretief
May 11 '15 at 12:46
9
9
At least in sid, the add-apt-repository script seems to have moved to software-properties-common
– Adam Baxter
Jun 22 '14 at 10:26
At least in sid, the add-apt-repository script seems to have moved to software-properties-common
– Adam Baxter
Jun 22 '14 at 10:26
Version 0.92 of python-software-properties here, and (again) missing :-(
– gatopeich
Nov 12 '14 at 11:33
Version 0.92 of python-software-properties here, and (again) missing :-(
– gatopeich
Nov 12 '14 at 11:33
3
3
See the comment above yours -- it's now in
software-properties-common
– Jim Paris
Nov 12 '14 at 22:20
See the comment above yours -- it's now in
software-properties-common
– Jim Paris
Nov 12 '14 at 22:20
had hassles updating though
– peterretief
May 11 '15 at 12:46
had hassles updating though
– peterretief
May 11 '15 at 12:46
add a comment |
Assuming you're running a non-ancient version of Debian (Etch or later), you can just drop a file in /etc/apt/sources.list.d/
The file name must end with .list
; Debian Stretch (not yet released) will likely add .sources
with a different format.
The format is the same as the main sources.list file.
The advantage is, especially if this is for some software you're distributing, you don't have to worry merging your changes into a possibly-edited /etc/apt/sources.list file (especially hard to deal with if your program is uninstalled). You can use dpkg
conffile support to put the file in /etc/apt/sources.list.d/
.
sources.list.d
exists since etch, I think.
– Gilles
Aug 20 '12 at 22:08
1
Yeah, butapt-add-repository
takes care of things like translating "ppa:" to anhttp://ppa.launchpad...
type, and to download and install the repository key so that packages are not treated as suspicious
– Ricardo Cárdenes
Jul 27 '14 at 11:24
@Gilles I think you're right—it isn't on a Sarge machine I have, and is on an Etch machine.
– derobert
Dec 8 '15 at 23:29
add a comment |
Assuming you're running a non-ancient version of Debian (Etch or later), you can just drop a file in /etc/apt/sources.list.d/
The file name must end with .list
; Debian Stretch (not yet released) will likely add .sources
with a different format.
The format is the same as the main sources.list file.
The advantage is, especially if this is for some software you're distributing, you don't have to worry merging your changes into a possibly-edited /etc/apt/sources.list file (especially hard to deal with if your program is uninstalled). You can use dpkg
conffile support to put the file in /etc/apt/sources.list.d/
.
sources.list.d
exists since etch, I think.
– Gilles
Aug 20 '12 at 22:08
1
Yeah, butapt-add-repository
takes care of things like translating "ppa:" to anhttp://ppa.launchpad...
type, and to download and install the repository key so that packages are not treated as suspicious
– Ricardo Cárdenes
Jul 27 '14 at 11:24
@Gilles I think you're right—it isn't on a Sarge machine I have, and is on an Etch machine.
– derobert
Dec 8 '15 at 23:29
add a comment |
Assuming you're running a non-ancient version of Debian (Etch or later), you can just drop a file in /etc/apt/sources.list.d/
The file name must end with .list
; Debian Stretch (not yet released) will likely add .sources
with a different format.
The format is the same as the main sources.list file.
The advantage is, especially if this is for some software you're distributing, you don't have to worry merging your changes into a possibly-edited /etc/apt/sources.list file (especially hard to deal with if your program is uninstalled). You can use dpkg
conffile support to put the file in /etc/apt/sources.list.d/
.
Assuming you're running a non-ancient version of Debian (Etch or later), you can just drop a file in /etc/apt/sources.list.d/
The file name must end with .list
; Debian Stretch (not yet released) will likely add .sources
with a different format.
The format is the same as the main sources.list file.
The advantage is, especially if this is for some software you're distributing, you don't have to worry merging your changes into a possibly-edited /etc/apt/sources.list file (especially hard to deal with if your program is uninstalled). You can use dpkg
conffile support to put the file in /etc/apt/sources.list.d/
.
edited Dec 8 '15 at 23:28
answered Aug 20 '12 at 19:47
derobertderobert
72.8k8153210
72.8k8153210
sources.list.d
exists since etch, I think.
– Gilles
Aug 20 '12 at 22:08
1
Yeah, butapt-add-repository
takes care of things like translating "ppa:" to anhttp://ppa.launchpad...
type, and to download and install the repository key so that packages are not treated as suspicious
– Ricardo Cárdenes
Jul 27 '14 at 11:24
@Gilles I think you're right—it isn't on a Sarge machine I have, and is on an Etch machine.
– derobert
Dec 8 '15 at 23:29
add a comment |
sources.list.d
exists since etch, I think.
– Gilles
Aug 20 '12 at 22:08
1
Yeah, butapt-add-repository
takes care of things like translating "ppa:" to anhttp://ppa.launchpad...
type, and to download and install the repository key so that packages are not treated as suspicious
– Ricardo Cárdenes
Jul 27 '14 at 11:24
@Gilles I think you're right—it isn't on a Sarge machine I have, and is on an Etch machine.
– derobert
Dec 8 '15 at 23:29
sources.list.d
exists since etch, I think.– Gilles
Aug 20 '12 at 22:08
sources.list.d
exists since etch, I think.– Gilles
Aug 20 '12 at 22:08
1
1
Yeah, but
apt-add-repository
takes care of things like translating "ppa:" to an http://ppa.launchpad...
type, and to download and install the repository key so that packages are not treated as suspicious– Ricardo Cárdenes
Jul 27 '14 at 11:24
Yeah, but
apt-add-repository
takes care of things like translating "ppa:" to an http://ppa.launchpad...
type, and to download and install the repository key so that packages are not treated as suspicious– Ricardo Cárdenes
Jul 27 '14 at 11:24
@Gilles I think you're right—it isn't on a Sarge machine I have, and is on an Etch machine.
– derobert
Dec 8 '15 at 23:29
@Gilles I think you're right—it isn't on a Sarge machine I have, and is on an Etch machine.
– derobert
Dec 8 '15 at 23:29
add a comment |
add-apt-repository
can now be found in the software-properties-common
package.
This is the right answer.
– frhd
Sep 17 '14 at 8:58
2
Omg thanks. I wonder why on earth is this not installed by default (at least on my Debian 8 Jessie)?!
– rbaleksandar
Aug 15 '15 at 14:06
@rbaleksandar this is not in all distros because it has a lot of extra things you may not want, especially in docker. Since the end goal of this task is to add something to/etc/apt/sources.list
, you might look at @Goez 's answer in this question.
– Mike D
Jan 2 at 14:19
add a comment |
add-apt-repository
can now be found in the software-properties-common
package.
This is the right answer.
– frhd
Sep 17 '14 at 8:58
2
Omg thanks. I wonder why on earth is this not installed by default (at least on my Debian 8 Jessie)?!
– rbaleksandar
Aug 15 '15 at 14:06
@rbaleksandar this is not in all distros because it has a lot of extra things you may not want, especially in docker. Since the end goal of this task is to add something to/etc/apt/sources.list
, you might look at @Goez 's answer in this question.
– Mike D
Jan 2 at 14:19
add a comment |
add-apt-repository
can now be found in the software-properties-common
package.
add-apt-repository
can now be found in the software-properties-common
package.
answered May 15 '14 at 21:00
Richard AyotteRichard Ayotte
316213
316213
This is the right answer.
– frhd
Sep 17 '14 at 8:58
2
Omg thanks. I wonder why on earth is this not installed by default (at least on my Debian 8 Jessie)?!
– rbaleksandar
Aug 15 '15 at 14:06
@rbaleksandar this is not in all distros because it has a lot of extra things you may not want, especially in docker. Since the end goal of this task is to add something to/etc/apt/sources.list
, you might look at @Goez 's answer in this question.
– Mike D
Jan 2 at 14:19
add a comment |
This is the right answer.
– frhd
Sep 17 '14 at 8:58
2
Omg thanks. I wonder why on earth is this not installed by default (at least on my Debian 8 Jessie)?!
– rbaleksandar
Aug 15 '15 at 14:06
@rbaleksandar this is not in all distros because it has a lot of extra things you may not want, especially in docker. Since the end goal of this task is to add something to/etc/apt/sources.list
, you might look at @Goez 's answer in this question.
– Mike D
Jan 2 at 14:19
This is the right answer.
– frhd
Sep 17 '14 at 8:58
This is the right answer.
– frhd
Sep 17 '14 at 8:58
2
2
Omg thanks. I wonder why on earth is this not installed by default (at least on my Debian 8 Jessie)?!
– rbaleksandar
Aug 15 '15 at 14:06
Omg thanks. I wonder why on earth is this not installed by default (at least on my Debian 8 Jessie)?!
– rbaleksandar
Aug 15 '15 at 14:06
@rbaleksandar this is not in all distros because it has a lot of extra things you may not want, especially in docker. Since the end goal of this task is to add something to
/etc/apt/sources.list
, you might look at @Goez 's answer in this question.– Mike D
Jan 2 at 14:19
@rbaleksandar this is not in all distros because it has a lot of extra things you may not want, especially in docker. Since the end goal of this task is to add something to
/etc/apt/sources.list
, you might look at @Goez 's answer in this question.– Mike D
Jan 2 at 14:19
add a comment |
Ubuntu is based on Debian but includes things Debian doesn't (and in turn are often incorporated into Debian later). The add-apt-repository
command is an example which was included in Ubuntu first.
The add-apt-repository
actually just executes a couple of commands to add the repository:
- append the repository to
/etc/apt/sources.list
- add the repository key to the machine.
A script that sort of does the same that can be found here is quoted below
#!/bin/bash
if [ $# -eq 1 ]
NM=$(uname -a && date)
NAME=$(echo $NM | md5sum | cut -f1 -d" ")
then
ppa_name=$(echo "$1" | cut -d":" -f2 -s)
if [ -z "$ppa_name" ]
then
echo "PPA name not found"
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
else
echo "$ppa_name"
echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu lucid main" >> /etc/apt/sources.list
apt-get update >> /dev/null 2> /tmp/$NAME_apt_add_key.txt
key=$(cat /tmp/$NAME_apt_add_key.txt | cut -d":" -f6 | cut -d" " -f3)
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
rm -rf /tmp/$NAME_apt_add_key.txt
fi
else
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
fi
add a comment |
Ubuntu is based on Debian but includes things Debian doesn't (and in turn are often incorporated into Debian later). The add-apt-repository
command is an example which was included in Ubuntu first.
The add-apt-repository
actually just executes a couple of commands to add the repository:
- append the repository to
/etc/apt/sources.list
- add the repository key to the machine.
A script that sort of does the same that can be found here is quoted below
#!/bin/bash
if [ $# -eq 1 ]
NM=$(uname -a && date)
NAME=$(echo $NM | md5sum | cut -f1 -d" ")
then
ppa_name=$(echo "$1" | cut -d":" -f2 -s)
if [ -z "$ppa_name" ]
then
echo "PPA name not found"
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
else
echo "$ppa_name"
echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu lucid main" >> /etc/apt/sources.list
apt-get update >> /dev/null 2> /tmp/$NAME_apt_add_key.txt
key=$(cat /tmp/$NAME_apt_add_key.txt | cut -d":" -f6 | cut -d" " -f3)
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
rm -rf /tmp/$NAME_apt_add_key.txt
fi
else
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
fi
add a comment |
Ubuntu is based on Debian but includes things Debian doesn't (and in turn are often incorporated into Debian later). The add-apt-repository
command is an example which was included in Ubuntu first.
The add-apt-repository
actually just executes a couple of commands to add the repository:
- append the repository to
/etc/apt/sources.list
- add the repository key to the machine.
A script that sort of does the same that can be found here is quoted below
#!/bin/bash
if [ $# -eq 1 ]
NM=$(uname -a && date)
NAME=$(echo $NM | md5sum | cut -f1 -d" ")
then
ppa_name=$(echo "$1" | cut -d":" -f2 -s)
if [ -z "$ppa_name" ]
then
echo "PPA name not found"
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
else
echo "$ppa_name"
echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu lucid main" >> /etc/apt/sources.list
apt-get update >> /dev/null 2> /tmp/$NAME_apt_add_key.txt
key=$(cat /tmp/$NAME_apt_add_key.txt | cut -d":" -f6 | cut -d" " -f3)
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
rm -rf /tmp/$NAME_apt_add_key.txt
fi
else
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
fi
Ubuntu is based on Debian but includes things Debian doesn't (and in turn are often incorporated into Debian later). The add-apt-repository
command is an example which was included in Ubuntu first.
The add-apt-repository
actually just executes a couple of commands to add the repository:
- append the repository to
/etc/apt/sources.list
- add the repository key to the machine.
A script that sort of does the same that can be found here is quoted below
#!/bin/bash
if [ $# -eq 1 ]
NM=$(uname -a && date)
NAME=$(echo $NM | md5sum | cut -f1 -d" ")
then
ppa_name=$(echo "$1" | cut -d":" -f2 -s)
if [ -z "$ppa_name" ]
then
echo "PPA name not found"
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
else
echo "$ppa_name"
echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu lucid main" >> /etc/apt/sources.list
apt-get update >> /dev/null 2> /tmp/$NAME_apt_add_key.txt
key=$(cat /tmp/$NAME_apt_add_key.txt | cut -d":" -f6 | cut -d" " -f3)
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
rm -rf /tmp/$NAME_apt_add_key.txt
fi
else
echo "Utility to add PPA repositories in your debian machine"
echo "$0 ppa:user/ppa-name"
fi
edited Jul 24 '15 at 10:03
Sparhawk
9,41263992
9,41263992
answered Aug 20 '12 at 10:13
GoezGoez
1,16085
1,16085
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f45879%2fhow-to-add-repository-from-shell-in-debian%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown