Terug naar het artikeloverzicht

How to install Composer on CentOS 8

Press enter or click to view image in full size
getcomposer.org

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

Prerequisites

Before we install React we need a few things first.

  • A server running CentOS 8 / RHEL 8. I am using a dedicated server from Spin Servers.
  • The current or supported version of PHP.
  • An account with Sudo privileges.
  • About 15 minutes and a cup of coffee or hot tea. I prefer Vanilla Chai with a dash of whole milk or almond depending on my mood that day.

Step 1 — Verify PHP

If you haven’t already, install PHP on your system. If you are not sure if you have PHP installed, you can check by using the command:

$ PHP -version

If you do not have PHP installed, you can follow our guide on How to install PHP 8 on CentOS 8 & RHEL. Once you have completed the install, return here can continue from step 2.

Step 2 — Download Composer Installer

Download the Composer installer.

$ sudo dnf -y install wget (if you dont already have wget)$ wget https://getcomposer.org/installer -O composer-installer.php

Step 2.1 — Install Composer

Now that we have the Composer installer downloaded, we are clear to install Composer on our system.

$ sudo php composer-installer.php --filename=composer --install-dir=/usr/local/bin

The installer will give you an output stating if the install was successful or not.

Step 3 — Verify version install

Composer should be successfully installed. So, let’s check the version to verify it.

$ composer --version

This will give you an output of something similar to:

Composer version 2.1.12 date x.xx.xx

You can view a list of available options and help by simply typing ‘composer’ in the command terminal.

composer

Congratulations, you now have a Composer operating on your CentOS 8 / RHEL 8 machine! Go make something awesome.

To make these how-to guides possible, I use a dedicated server from Spin Servers. The configuration I use is a:

Dual Intel Xeon E5–2630L
12x 2.00 GHz CPU
128GB DDR3 RAM
4x 2TB HDD HW RAID-10 DISKSPACE
10TB
of Bandwidth on 10Gbps Port
Dallas Location

I get this configuration for $89/month using the code “DUALE5FOR89”. This promotion is on the Spin Servers Web Hosting Talk thread found here.

If you have questions about any of Spin Server’s services, please contact us via email at [email protected] or by using our live chat at spinservers.com.

Spin Servers is a US-based provider of dedicated servers & affordable private cloud solutions. Our motto is to let you “spin up servers” fast, seamlessly, and affordably.