Skip to main content

Featured

Install Apache 2 on Ubuntu 24.04

Apache2 is one of the most popular and reliable open-source web servers. If you’re running Ubuntu 24.04 and want to host websites or applications, Apache2 is an excellent choice. In this guide, you’ll learn how to install and configure Apache2 step by step.

Install Composer on Ubuntu 24.04

Composer is the most widely used dependency manager for PHP. It allows developers to easily manage project libraries, packages, and versions, making PHP development faster and more reliable. In this tutorial, you will learn how to install Composer on Ubuntu 24.04 step by step.

Prerequisite: PHP Installation

Before installing Composer, you need to have PHP installed on your Ubuntu 24.04 system, since Composer is a PHP application and requires it to run. If you don’t have PHP installed yet, you can follow one of these guides depending on your setup:

To check if PHP is already installed, run:

php -v

This command will display the installed PHP version. Make sure PHP is available before continuing with Composer installation.

Download the Composer Installer

Start by downloading the Composer installer script:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

Verify the Installer

Before running the installer, verify its integrity using the provided SHA-384 hash. Run:

php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }"

If the output shows Installer verified, it means the file is safe to use. If it says Installer corrupt, do not continue — re-download the file.

Run the Installer

Now install Composer by running the setup script:

php composer-setup.php

Remove the Installer

Once Composer is installed, you can delete the installer script to keep your system clean:

php -r "unlink('composer-setup.php');"

Make Composer Globally Available

Move Composer to /usr/local/bin so it can be accessed globally:

sudo mv composer.phar /usr/local/bin/composer

Verify Installation

Check that Composer is installed and working properly by running:

composer --version

You should see the installed version of Composer displayed in your terminal.

Conclusion

You have successfully installed Composer on Ubuntu 24.04. With Composer available globally, you can now manage PHP dependencies, install frameworks like Laravel or Symfony, and keep your projects organized and up to date.

Comments

Popular Posts