20

The apt-get command and the sudo command does not work for me. which apt-get returns nothing. I checked by bin folder to make sure, and there is no aptget. I however have wget. Can I install apt-get with wget? If not, how can I install it?

2 Answers 2

15

of course you can do that, although it is strange that you missed that package/command ... Anyway, a manual way to do it is to download the package and to install it with dpkg, as follows:

  1. grab the package from the web

     wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.0.1ubuntu2.17_amd64.deb -O apt.deb
    

Edit: Check for the latest source at http://security.ubuntu.com/ubuntu/pool/main/a/apt/?C=M;O=D

  1. install it with dpkg

     sudo dpkg -i apt.deb
    

2 (other). Alternative use of dkpg without sudo - I didn't know about these, included after comments-

pkexec dpkg -i apt.deb

if everything goes right, that should be enough.

Probably you may find that some dependencies are not satisfied, to deal with that you may need to create a folder (something like "apt-installer") and drop all the dependencies of the apt package there. The list of dependencies required will be shown by the dpkg output and the download process is similar to the one explained above. Last, if you don't feel confident of what you are doing, my suggestion is that you may want to do a fresh install of your system.

Cheers.

6
  • 5
    Good one, but remember he said sudo didn't work either. Dec 13, 2016 at 22:37
  • 2
    If only sudo does not work (which should get fixed as soon as possible!), you can try to replace it with pkexec for the moment, i.e. pkexec dpkg -i apt.deb
    – Byte Commander
    Dec 13, 2016 at 22:42
  • Oh dear! it is true! haha... without the sudo package everything is supposed to have the admin level, right? if that's so the only easy way that comes to my mind is to uncompress the .deb file and locate the new files and folders manually in their destination, with their proper permissions... but I'm only guessing here, at this point my "real life" solution is a fresh install. :) Thanks Byte! I didn't know about pkexec. Editing.
    – Rho
    Dec 13, 2016 at 22:42
  • 3
    If the above wget command gets a 404 error, try wget http://ftp.us.debian.org/debian/pool/main/a/apt/apt_1.8.2_amd64.deb -O apt.deb Apr 21, 2020 at 13:04
  • 1
    @EmreTapcı This one's also a 404 Sep 25, 2020 at 23:19
5

Now...

wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_2.1.10ubuntu0.2_amd64.deb -O apt.deb

In the future this will likely 404 error as well, so remove the file name apt_2.1.10ubuntu0.2_amd64.deb -O apt.deb

and enter just the http://security.ubuntu.com/ubuntu/pool/main/a/apt/ part into a browser. Look for the most current version of the file, and change the path to it.

2
  • I see what you’re trying to say, but can you clean the answer up with a chronological, step-by-step process for people who have a similar problem in the future? 👍🏻
    – user1091774
    Jan 22, 2021 at 5:12
  • Sounds clear enough
    – Y-B Cause
    Mar 5, 2021 at 1:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .