Server Setup

How to use apt or apt-get for CentOS/RHEL

by ,

We have by far the largest RPM repository with dynamic stable NGINX modules and VMODs for Varnish 4.1 and 6.0 LTS. If you want to install NGINX, Varnish, and lots of useful modules for them, this is your one-stop repository to get all performance-related software.
You have to maintain an active subscription in order to be able to use the repository!

As I already manage a CentOS/RHEL YUM repository (and stick to CentOS with a rationale of being more secure), I’m not eager to work with Ununtu operating system or learn how to package things for it.
Yet many of my clients, for no reason whatsoever, want to stick to Ubuntu, even for a clean server setup.

Ubuntu and CentOS are both based on Linux kernel. The primary difference is with the packaging system being aptitude for Ubuntu and yum for CentOS.
Many folks who already use Ubuntu are not excited to even try CentOS just because it seems entirely different. But that’s not the case. Especially if you can get apt-get working in CentOS.

Install apt-get in CentOS

curl -o /usr/local/bin/apt-get
chmod 0755 /usr/local/bin/apt-get

Use apt-get in CentOS

Now you have the familiar interface for installing packages through apt-get install packagename 🙂

Obviously, this is just an alias-like wrapper for the native yum package manager in CentOS. But I hope this is going to help you move towards CentOS and learn the commands for managing packages. (when you run apt-get it will tell you the corresponding yum command after installing/removing a package).

  1. Dr Kevorkian

    thanks but I am still getting “sudo: apt-get: command not found” after it seems to have installed.

    • Danila Vershinin

      If you want it to work with sudo, then it should be placed to /usr/bin/apt-get.

      Alternatively, become the root user first, e.g. sudo -i.

  2. Silviu

    Why are you leading people to think they can get apt-get on CentOS? Is it even possible. Yours it’s just a bash script that call yum. Very misleading.

    • Danila Vershinin

      Just read it carefully, where it says “But I hope this is going to help you move towards CentOS and learn the commands for managing packages”. It emits “yum” commands to help learning. Of course it’s not a real “apt” and never can be. It is a learning/convenience script.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.