In this tutorial, we will show you how to install Composer on Manjaro. Composer is a popular dependency management tool for PHP that allows developers to easily manage their project’s dependencies.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Composer on a Manjaro Linux.
- A server or desktop running one of the following operating systems: Manjaro, and other Arch-based distributions.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A basic understanding of the Linux command-line interface (CLI).
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A stable internet connection is crucial for downloading and installing packages. Verify your connection before proceeding.
- Access to a Manjaro Linux system with a non-root sudo user or root user.
Install Composer on Manjaro
Step 1. Before proceeding with the installation, ensure that your Manjaro system is up-to-date by running the following command in the terminal:
sudo pacman -Syu sudo pacman -S base-devel
This command will update all the packages on your system to their latest versions.
Step 2. Installing PHP.
Composer operates on PHP, making it a prerequisite for the installation process. Therefore, the first step involves installing PHP on your Manjaro system. This can be achieved by executing the following commands in your terminal:
sudo pacman -Syu php php-apache
The php.ini file serves as the configuration file for PHP. For a successful Composer installation, certain extensions in this file need to be enabled. To accomplish this, open the
php.ini file for editing from the command line and uncomment the following lines:
These extensions are crucial for Composer’s operation. The openssl extension provides access to the OpenSSL cryptographic toolkit, while the phar extension allows PHP to handle PHP Archives (phar).
Step 3. Installing Composer on Manjaro.
With PHP installed and configured, you’re now ready to download and install Composer. This can be achieved by running the following commands in your terminal:
curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer
The first command fetches the Composer installer and executes it with PHP. The second command moves the Composer Phar (PHP Archive) file to your system’s bin directory, making it globally accessible.
To confirm that Composer has been installed correctly, you can check the installed version. This can be done by running the following command in your terminal:
If the installation was successful, this command should return the version of Composer that is currently installed on your system.
Keeping Composer updated is essential to ensure you have access to the latest features and security updates. Composer can be updated by executing the following command in your terminal:
sudo composer self-update
This command updates Composer to the latest version, ensuring that you’re always up-to-date with the latest improvements and security patches.
Congratulations! You have successfully installed Composer. Thanks for using this tutorial to install the latest version of the Composer on the Manjaro system. For additional help or useful information, we recommend you check the official Composer website.