Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon Linux: apt-get: command not found

People also ask

How do I enable services in Amazon Linux?

Enter the command “systemctl enable httpd” and then “systemctl start httpd” on AmazonLinux2. Now you can access the app on boot rather than running the app again and again. You are complete.


If you're using Amazon Linux it's CentOS-based, which is RedHat-based. RH-based installs use yum not apt-get. Something like yum search httpd should show you the available Apache packages - you likely want yum install httpd24.

Note: Amazon Linux 2 has diverged from CentOS since the writing of this answer, but still uses yum.


Try to install your application by using yum command yum install application_name


Check the Linux distribution, apt-get works in Debian based distro whereas yum works in Fedora based distro.

Ref: How to know distro name, execute command cat /etc/*-release

It is also possible your system administrator does not permit you (or did not put you in the group of users who have sudo permissions) to execute apt-get but if you have sudo access try to execute with sudo apt-get <package_name> if debian or yum install <package_name> if you are using Fedora.


I faced the same issue regarding apt-get: command not found here are the steps how I resolved it on ubuntu xenial

  • Search the appropriate version of apt from here (apt_1.6.13_amd64.deb for ubuntu xenial)

  • Download the apt.deb

wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.6.13_amd64.deb

  • Install the apt.deb package

sudo dpkg -i apt_1.6.13_amd64.deb

Now we can easily run

sudo apt-get install htop


This answer is for complete AWS beginners:

I had this issue but it was because I was trying to run a command from a tutorial inside my Mac computer. What I actually needed to do was SSH into my AWS machine, and then run the same command there. Ta Da, it worked:

enter image description here

Click this button in your EC2 instance, to be able to copy the SSH command. setup your SSH keys https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html and then you can SSH into your machine

Once here, you can run your sudo apt-get command.

Hope this helps other beginners


apt–get: command not found

For Debian based Linux distributions:

Try to use sudo apt install <package> instead of the usual sudo apt-get install <package>

From man apt

apt provides a high-level commandline interface for the package management system. It is intended as an end user interface and enables some options better suited for interactive usage by default compared to more specialized APT tools like apt-get(8) and apt-cache(8).


There can be 2 issues :=

1. Your are trying the command in machine that does not support apt-get command
because apt-get is suitable for Linux based Ubuntu machines; for MAC, try
apt-get equivalent such as Brew

2. The other issue can be that your installation was not completed properly So

The short answer:

Re-install Ubuntu from a Live CD or USB.

The long version:

The long version would be a waste of your time: your system will never
be clean, but if you insist you could try:

==> Copying everything (missing) except for the /home folder from the Live
CD/USB to your HDD.

OR

==> Do a re-install/repair over the broken system again with the Live
CD / USB stick.

OR

==> Download the deb file for apt-get and install as explained on above posts.
I would definitely go for a fresh new install as there are so many things to
do and so little time.