Installing apt to Ubuntu

18,015

Solution 1

You can install deb packages using the dpkg command. You can go onto an Ubuntu mirror for the version you use, then download the apt package and dependencies (you can check with dpkg-deb -I apt[...].deb), then install it using dpkg -i apt[...].deb.

Solution 2

Everything you probably need is here.

Try:

wget http://us.archive.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.9.3_amd64.deb
dpkg -i apt_1.9.3_amd64.deb
  • If the version isn't right, check this for whichever versions are available when you found this answer.
  • If wget isn't found, then just download apt*.deb from the same link.
  • If it fails to find dependencies, then download the dependencies in the same manner as apt, then try again.

FYI, at time of writing I see these dependencies (on debian):

$ apt show apt
Version: 1.8.2
Depends: 
 adduser,
 gpgv | gpgv2 | gpgv1,
 debian-archive-keyring,
 libapt-pkg5.0 (>= 1.7.0~alpha3~),
 ibc6 (>= 2.15),
 libgcc1 (>= 1:3.0),
 libgnutls30 (>= 3.6.6),
 libseccomp2 (>= 1.0.1),
 libstdc++6 (>= 5.2)
Share:
18,015

Related videos on Youtube

guest
Author by

guest

Updated on September 18, 2022

Comments

  • guest
    guest over 1 year

    I accidentially deleted apt on my Ubuntu. How can I reinstall it somehow or do I need to reinstall the whole system?

    I tried

    sudo apt install apt
    [sudo] password for jaakko: 
    sudo: apt: command not found
    (base) jaakko@jaakko-GL553VW:~/Downloads$ 
    
    • Jeff Schaller
      Jeff Schaller over 4 years
      You had to know that you weren't going to get very far using apt install apt when apt was gone?
    • 41754
      41754 over 4 years
      You can build it from sources. You probably want to boot the corresponding Ubuntu as a live CD and copy the program back in its proper place in your persistent storage drive.
    • guest
      guest over 4 years
      Yes. I know. I think I need some lower level tool to download and install apt.
    • 41754
      41754 over 4 years
      Well you maybe can download an official build of apt the program using wget if you have it installed... But I don't know which's the URL you'd want. You probably have some live USB drive around though, maybe that's easier.
    • Jeff Schaller
      Jeff Schaller over 4 years
    • smw
      smw over 4 years