Atlantic.Net Blog

How to Install and Use Composer on Oracle Linux 8

Hitesh Jethva
by Atlantic.Net (468 posts) under Tutorials, VPS Hosting

Composer is a dependency manager for PHP. It was created by Nils Adermann and Jordi Boggiano and was initially published on 1 March 2012. It allows you to download, install, and loads dependencies that you have specified in the composer.json file. It helps developers to develop a project inside a specific framework. It is a very useful tool for installing third-party libraries and integrating them into their PHP-based projects.

In this tutorial, we will show you how to install and use Composer on Oracle Linux 8 server.


  • A fresh Oracle Linux 8 server on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Oracle Linux 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your Oracle Linux 8 server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install PHP and Other Dependencies

Before installing Composer, you will need to install PHP and other required dependencies on your server.

You can install PHP with other required dependencies with the following command:

dnf install php php-cli php-mbstring curl gnupg2 git unzip -y

After installing all the packages, you can proceed to install the Composer.

Step 3 – Install Composer

Composer provides a php-based installation script to install it on your system.

First, download the Composer installation script with the following command:

curl -sS -o composer-setup.php

Next, you will need to verify whether the downloaded script matches the SHA-384 hash for the latest installer found on the Composer signature page. To do so, copy the hash from that page and store it in the shell variable.


Next, run the following command to verify the downloaded script:

php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

If everything is fine, you should get the following output:

Installer verified

Next, run the following script to install Composer globally:

php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Once the installation has been completed, you should get the following output:

All settings correct for using Composer

Composer (version 2.4.1) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

You can now check the Composer version using the following command:

composer --version

You should see the following output:

Composer version 2.4.1 2022-08-20 11:44:50

Step 4 – Working with Composer

Composer is now installed on your server. You can now create a project with Composer.

First, create a new directory for your project:

mkdir composerapp

Next, change the directory to composerapp:

cd composerapp

Next, create a PHP-based application that prints the current time.

composer require nesbot/carbon

The above command will download and install carbon with all required dependencies and creates the composer.json file:

  - Installing symfony/polyfill-php80 (v1.26.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.26.0): Extracting archive
  - Installing symfony/deprecation-contracts (v2.5.2): Extracting archive
  - Installing symfony/translation (v5.4.11): Extracting archive
  - Installing nesbot/carbon (2.61.0): Extracting archive
3 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
6 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found

Run the following command to verify all files created by Composer:

ls -l

You should see the following output:

-rw-r--r-- 1 root root    60 Aug 23 06:31 composer.json
-rw-r--r-- 1 root root 18911 Aug 23 06:31 composer.lock
drwxr-xr-x 6 root root    82 Aug 23 06:31 vendor

Now, create a new file named app.php:

nano app.php

Add the following code:


require __DIR__ . '/vendor/autoload.php';

use Carbon\Carbon;

printf("Now: %s", Carbon::now());

Save and close the file, then run the app.php with the following command:

php app.php

This will print the current time of your system:

Now: 2022-08-23 10:33:02

If you want to update the project, run the following command:

composer update

This will check for newer versions of the installed packages, match them with all packages inside composer.json, then update the package.


In the above post, you learned how to install Composer on Oracle Linux 8. You also learned how to create a PHP-based project with Composer. For more information, visit the Composer official documentation. Try it today on VPS hosting from Atlantic.Net!

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Best Cloud Consultancy or MSP in 2022
BAA Red Flags: What Should Your HIPAA-Compliant Hosting Company Be Willing to Accommodate?
HIPAA Compliance for Remote Workers: How to Maintain HIPAA Compliance with a Remote Team
How to Make the Best Use of the Cloud in the Internet of Things (IoT)
How to Make the Best Use of Artificial Intelligence in Cloud Computing

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Garland, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4


London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom