I'm using an AWS EC2 instance and I'm trying to switch from an Ubuntu instance to a Linux (Amazon Linux AMI) instance and in doing so I need to figure out the equivalent apt-get to yum commands and packages to install.

In essence how would you translate the following from apt-get to yum?

Side note assume I have already assume the root user role via sudo su, which is why sudo is not used in conjunction with the following commands.

apt-get commands:

  • apt-get update (Assuming this would be equivalent to yum update -y
  • apt-get upgrade -y
  • apt-get dist-upgrade -y
  • apt-get autoremove -y
  • apt-get install apache2 php5 php5-cli php5-fpm php5-gd libssh2-php libapache2-mod-php5 php5-mcrypt php5-mysql git unzip zip postfix php5-curl mailutils php5-json -y
  • a2enmod rewrite headers
  • php5enmod mcrypt
  • 2
    There is thios wonderful page on the archwiki, the pacman rosetta. Since yum has been decommissioned in favor of dnf, the yum commands are not present anymore. I just linked to the most recent version containing the yum commands.
    – joepd
    Commented Feb 3, 2016 at 20:40
  • Hey @joepd thanks for the resource that was a very useful bit of information. My question though is do I just replace apt-get with yum? I was under the impression that the packages for each package manager yum v. apt-get are different, ex. I typically install apache on linux via yum install httpd24 whereas in the above Ubuntu example it's using the apache2 package.
    – Corey
    Commented Feb 3, 2016 at 20:51
  • 1
    How are a2enmod and php5enmod relevant to your question? They aren't apt-get commands therefore won't have an equivalent yum command. Commented Feb 3, 2016 at 21:10
  • @garethTheRed I completely understand your question and I apologize for including something that may seem a bit off topic considering the title. I'm new to the server side of things and I'm following a tutorial where the instructor created an Ubuntu instance using an AWS EC2 instance using the above listed configurations and since I'd prefer to use a Linux box, I wanted to figure out how I could configure my Linux EC2 instance with the same (or similar) setup that they configured their Ubuntu instance.
    – Corey
    Commented Feb 4, 2016 at 14:40

1 Answer 1


Various distros name their packages slightly differently and there is no automated way to map one to the other. You've probably quoted the best example already with Apache, which is apache2 on Debian/Ubuntu systems and httpd on CentOS/RedHat/Fedora systems, apache on Arch, apache2 on openSuse, www-servers/apache on Gentoo etc.

The best way to find the packages is to search for them with yum search:

yum search apache
httpd.x86_64 : Apache HTTP Server

Which finds that Apache in the description. You'll get about 200 lines of packages here, so maybe pipe it into less to read or into grep to look for keywords.

If you know the file name and want to find the package which provides this, then run yum provides:

yum provides *bin/httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.simwood.com
 * epel: epel.mirrors.ovh.net
 * extras: mirror.simwood.com
 * updates: mirror.mhd.uk.as44574.net
httpd-2.4.6-40.el7.centos.x86_64 : Apache HTTP Server
Repo        : base
Matched from:
Filename    : /usr/sbin/httpd

httpd-2.4.6-40.el7.centos.x86_64 : Apache HTTP Server
Repo        : @base
Matched from:
Filename    : /usr/sbin/httpd

Simply running yum provides httpd will list any package that has files which end in httpd, not just the executable, so it's best to narrow the search by prefixing it with *bin/.

Google can also help you find common packages.

  • Thank you for the insight. The Ubuntu setup thats listed in my question is used to setup an AWS Ubuntu instance. That said – and this may seem obvious but I'm new to this so please forgive my ignorance – 1) could I setup my AWS Linux EC2 instance like the Ubuntu instance by simple creating a AMP stack within my Linux system? and 2) if this is true do I need to do anything in my Linux instance to replicate the following Ubuntu commands: a2enmod rewrite headers or php5enmod mcrypt or is mod_rewrite and mcrypt (when it's installed) automatically enabled in a LAMP stack?
    – Corey
    Commented Feb 4, 2016 at 14:52
  • @Corey - Amazon AMI is based on RedHat/CentOS 5 and 6 I believe. Therefore, your best bet would be to look for LAMP tutorials for one of those platforms. If they're not a 100% match for AMI they'll be much closer than Ubuntu/Debian tutorials. Commented Feb 4, 2016 at 17:09
  • Thanks for the help. I'll begin steering my learning in the direction you suggested. Cheers.
    – Corey
    Commented Feb 4, 2016 at 17:18

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