This article provides a comprehensive guide on installing the latest version of Composer, a dependency manager for PHP, on Ubuntu. Learn how to set up Composer efficiently, manage your PHP project dependencies, and ensure your development environment is up-to-date and optimized for modern web applications.
10 min
Edited:30-09-2024
Composer is a widely-used dependency manager for PHP that simplifies managing libraries and dependencies for your projects. In this guide, we will walk you through the process of installing the latest version of Composer on Ubuntu.
First, open your terminal and update your package list to ensure you have the latest information on available packages
1. sudo apt update
2. sudo apt upgrade
Composer requires certain PHP extensions and utilities to function properly. Install the necessary packages by running the following command:
1. sudo apt install curl php-cli php-mbstring git unzip
Next, you’ll need to download the Composer installer script. Run the following command:
1. curl -sS https://getcomposer.org/installer -o composer-setup.php
Before running the installer, it’s a good practice to verify its integrity. You can do this by checking the SHA-384 hash. First, get the latest installer hash:
1. HASH="$(curl -sS https://composer.github.io/installer.sig)"
Then, verify the downloaded installer:
1. if [ "$(openssl dgst -sha384 -binary composer-setup.php | openssl base64)" = "$HASH" ]; then
2. echo 'Installer verified'
3. else
4. echo 'Installer corrupt'
5. unlink composer-setup.php
6. exit 1
7. fi
If the installer is verified, you will see "Installer verified" in the output.
Now you can install Composer globally on your system. Run the following command:
1. sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
This command installs Composer in the /usr/local/bin directory and names it composer, making it accessible from anywhere on your system.
To verify that Composer was installed successfully, run the command:
1. composer -v
By following these steps, you have successfully installed the latest version of Composer on your Ubuntu system. Composer is an essential tool for PHP developers, allowing you to manage your project dependencies effectively. With Composer set up, you can streamline your PHP development process and focus on building robust applications.
14-10-2024
This article offers a detailed guide on installing and configuring IPTables on an Ubuntu VPS. IPTables is a powerful firewall tool that helps secure your server by controlling inbound and outbound traffic. Learn how to set up rules for traffic filtering, configure basic security policies, and apply custom rules to protect your VPS.
IPtables
security
12 min
This article offers a comprehensive guide on installing and configuring ModSecurity, a powerful web application firewall (WAF), on an Ubuntu VPS. Learn how to secure your server by filtering and monitoring HTTP requests, set up ModSecurity with Nginx or Apache, and apply rules to protect against common web attacks.
Modsecurity
security
10 min
14-10-2024
This article provides a comprehensive guide on installing and configuring PHP-FPM (FastCGI Process Manager) on an Ubuntu VPS. Learn how to optimize PHP performance for your web applications by configuring PHP-FPM with Nginx or Apache, managing pools, and fine-tuning settings for efficient processing of PHP scripts.
PHP-FPM
speed
optimise
12 min