A Personal Package Archive (PPA) is a special software repository for uploading source packages to be built and published as an APT repository by Launchpad or a similar application. While the term is used exclusively within Ubuntu, Launchpad host Canonical envisions adoption beyond the Ubuntu community.
Debian allows users to add and use PPA repositories by an application named add-apt-repository however, Kali Linux didn’t include this in their default package list. With Kali, because this is a special purpose application and certain modifications were made to make it work for what it does best (Penetration Test), there’s a chance that by adding untested and unsupported PPA repositories and application you might end up breaking your installation.
However, PPA is a powerful tool to have and a lot of the specific applications that are not available in repositories are available via PPA repositories. Users should take extra care before adding unknown and random repositories as it might very well break other things. I mean, how do you know the PPA owner didn’t add some harmful code in their system? Generally, you don’t. Then again, how do you know that Linux Kernel doesn’t have something that’s spying on your activity? But I guess that doesn’t matter, your ISP would be happy enough to hand over your online activity to NSA anyway … I could go on and on, but let’s not waste more time and move to actual post “Kali Linux add PPA repository add-apt-repository” .. so here goes ..
Table of Contents
Step 1: Install required applications
First we install Python Software properties package.
apt-get install python-software-properties
Next we install apt-file
apt-get install apt-file
Update apt-file
.
apt-file update
This takes a while, so in case your apt-file update is SLOW, you might want to try and fix that as well. (Note that I got repo.kali.org
in my /etc/apt/sources.list
file instead of http.kali.org
.)
Once apt-file update
is complete, you should be able to search for it.
apt-file search add-apt-repository
Your output should look similar to this:
python-software-properties: /usr/bin/add-apt-repository python-software-properties: /usr/share/man/man1/add-apt-repository.1.gz
Step 2: Use our own code for add-apt-repository
The default add-apt-repository
application located in (/usr/bin/add-apt-repository
) works for Debian. So if you’re using Kali, chances are it won’t work. There’s a nice fix for that which I will add at the bottom of this post, (try them on VirtualBox if you feel like). But I found we can just mimic Ubuntu Oneiric
to make add-apt-repository
work.
cd /usr/sbin vi add-apt-repository
Add the following code and save the file.
#!/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 oneiric 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
Note: In this line echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu oneiric main" >> /etc/apt/sources.list
I’ve used Oneiric
. You can try to use Lucid
, Raring
or Saucy
as per your choice.
Now chmod
and chown
the file.
chmod o+x /usr/sbin/add-apt-repository chown root:root /usr/sbin/add-apt-repository
Step 3: Adding a PPA repository via add-apt-repository in Kali Linux
Now that we added the correct code, we can use add-apt-repository
to add a PPA repository. I tried the following to add themes and custom icons in Kali Linux.
/usr/sbin/add-apt-repository ppa:noobslab/themes /usr/sbin/add-apt-repository ppa:alecive/antigone
Once you’ve added a PPA repository via add-apt-repository
in Kali Linux, you need to update your package list.
apt-get update
You’ll see that your package list is now including PPA repository.
Step 4: Testing
Now that we have added add-apt-repository
to add PPA repository in Kali Linux, we can try to add some themes and custom icons. To keep things clean, I’ve moved this part in a different describing adding custom themes and icons in Kali Linux.
Step 5: Advanced Way
(Continued from Step 2: Paragraph 1)
In Step 2, paragraph 1, I pointed that we need to use our own code to use add-apt-repository
. Following is a way to bypass that and use /usr/bin/add-apt-repository
by modifying your Distribution ID. I again advise that you try this part in Virtual Box so that you can roll back your changes.
Step 5.a Install Python Software Properties:
Install Python Software properties package.
apt-get install python-software-properties -y
Step 5.b Change Distribution ID, Release, Codename and Description
Change your Distribution ID to Ubuntu, Release to 12.04, Codename to Precise and Description to Ubuntu 12.04 LTS.
echo -e "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=12.04\nDISTRIB _CODENAME=precise\nDISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"" >> /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION=”Ubuntu 12.04 LTS”
UPDATE: 27/02/2014 – Added code for Ubuntu Oneiric 11.10
echo -e "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=11.10\nDISTRIB _CODENAME=oneiric\nDISTRIB_DESCRIPTION="Ubuntu 11.10"" >> /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION=”Ubuntu 11.10″
That mean’s now you can either use Precise or Oneiric codes as you feel like.
Now you should be able to add PPA just like normal.
Step 5.c Add PPA Repositories
Add PPA repositories using usual /usr/bin/add-apt-repository
add-apt-repository ppa:upubuntu-com/chat apt-get update
Step 5.d Install something (i.e.Skype?)
Now we can install Skype..
apt-get install skype
Step 5.e Rollback changes
No change is much good without a rollback strategy.
To rollback your changes to Distribution ID, Release, Codename and Description, do the following,
echo -e "DISTRIB_ID=Debian\nDISTRIB_RELEASE=Kali Linux 1.0.6\nDISTRIB _CODENAME=n/a\nDISTRIB_DESCRIPTION="Debian GNU/Linux Kali Linux 1.0.6"" >> /etc/lsb-release
And to confirm, do another lsb_release -a
lsb_release -a
Output:
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux Kali Linux 1.0.6 Release: Kali Linux 1.0.6 Codename: n/a
HUH .. GOTCHA …..
Just kidding… You don’t actually have to do it (well you could, but what’s the point to making things complicated). You could just delete /etc/lsb_release
file that was created in Step 5.e.
rm /etc/lsb_release
We again do antther lsb_release -a
to confirm.. See screenshot below:
Both ways works, but I prefer the second way where you delete /etc/lsb_release
file. This file didn’t exist until we ran Step Step 5.e. So by deleting this file it doesn’t break or damage anything. So yes, just delete that file after you’ve installed whichever PPA you want.
Conclusion
As I’ve pointed in my first paragraph that by adding PPA repositories, you might break your system, so I will add a disclaimer here…
Disclaimer: This guide shows how to add PPA Repositories using add-apt-repository in Kali Linux that is usually not recommended. Readers should know how to repair their system and try these in Virtual Environment to avoid accidental breaks. We take no responsibility. Like Linux itself, you use these information’s as it is.
Thanks for reading.
If this worked for you, please share this article and like us on Facebook/Twitter.
48 comments
bash: vi: command not found
http://tarclink.com/forum/ solved my problem too
vi add-apt-repository how to save that thing plese tell me ?
I made took this code from step 2 and made the work easier:
Login as root and follow these steps:
root@kali:~#wget http://tarclink.com/git/add-apt-repository.sh.txt
root@kali:~#cp add-apt-repository.sh.txt /usr/sbin/add-apt-repository
root@kali:~#chmod o+x /usr/sbin/add-apt-repository
root@kali:~#chown root:root /usr/sbin/add-apt-repository
Hi
Thank you for this tutorial. I done the steps above and I think successfully add the “add-ppa-repository” but when I try to install skype using “apt-get install skype” I get this:
root@kali:~# apt-get install skype
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package skype
I seem all other packages have same result I try also to install cdemu using command below
add-apt-repository ppa:cdemu/ppa
apt-get update
apt-get install gcdemu cdemu-client
still can’t locate package.
Hope you can help me with this.
Hey, you have everything here I need! Awesome!! For some reason when I try and execute `apt-get install python-software-properties` I get the following…
root@kali:~# apt-get install python-software-properties
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package python-software-properties is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
software-properties-common
E: Package ‘python-software-properties’ has no installation candidate
A little background on what I’m trying to accomplish; just trying to uninstall php7 and install php5.6 to use dvwa WITH Kali Linux, I guess php7 doesnt work with dvwa. So I’ve already used the command `apt-get purge `dpkg -l | grep php| awk ‘{print $2}’ |tr “\n” ” “`.. which successfully removed php7.0 to the best of my knowledge. When I used `php -v` I got nothin back so that seems to be good. But when I try to begin the installation of a repository I can’tget passed the first step.
You’re the third or fourth person who s suggested doing it this way so I know there’s something up with how I’m going about this.
Here are my specs if this helps,
Linux kali 4.9.0-kali3-amd64 #1 SMP Debian 4.9.18-1kali1 (2017-04-04) x86_64 GNU/Linux
Any help would be greatly appreciated
How Can i Pest the code there is nothing that i can do….
Hey I think I’d did everything and I’m in the /use/shin directory when I use the ./add-apt-repository command but I keep getting a permissions denied error.. any help is appreciated