How To Install Composer on CentOS
To Install Composer on CentOS
Composer is a dependency management tool for PHP similar to npm for nodejs and bundle for ruby. Using composer tool we can define required libraries for our project and install with composer in single command. We don’ t need to search for each library individually to install each time.
This tutorial will help you to install Composer on CentOS, RHEL & Fedora operating systems.
Installing Composer
The installation of Composer requires prior installation of PHP. So, use the following command for the same purpose.
[root@localhost ~]# yum install php Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Install Process Loading mirror speeds from cached hostfile * base: mirror.fibergrid.in * epel: epel.mirror.net.in * extras: mirror.fibergrid.in * updates: mirror.fibergrid.in epel epel/primary_db | 5.9 MB 00:19 updates/primary_db Resolving Dependencies --> Running transaction check ---> Package php.x86_64 0:5.3.3-48.el6_8 will be installed --> Processing Dependency: php-common(x86-64) = 5.3.3-48.el6_8 for package: php-5.3.3-48.el6_8.x86_64 --> Processing Dependency: php-cli(x86-64) = 5.3.3-48.el6_8 for package: php-5.3.3-48.el6_8.x86_64 --> Running transaction check ---> Package php-cli.x86_64 0:5.3.3-48.el6_8 will be installed ---> Package php-common.x86_64 0:5.3.3-48.el6_8 will be installed --> Finished Dependency Resolution Dependencies Resolved ====================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================== Installing: php x86_64 5.3.3-48.el6_8 updates 1.1 M Installing for dependencies: php-cli x86_64 5.3.3-48.el6_8 updates 2.2 M php-common x86_64 5.3.3-48.el6_8 updates 530 k Transaction Summary ====================================================================================================================================== Install 3 Package(s) Total download size: 3.8 M Installed size: 13 M Is this ok [y/N]: y Downloading Packages: (1/3): php-5.3.3-48.el6_8.x86_64.rpm | 1.1 MB 00:04 . . . Installed: php.x86_64 0:5.3.3-48.el6_8 Dependency Installed: php-cli.x86_64 0:5.3.3-48.el6_8 php-common.x86_64 0:5.3.3-48.el6_8 Complete!
Once PHP is installed, use the curl command to download composer executable. Place it under bin directory.
[root@localhost ~]# curl -sS https://getcomposer.org/installer | php
Downloading...
Composer (version 1.3.2) successfully installed to: /root/composer.phar
Use it: php composer.phar
Some settings on your machine may cause stability issues with Composer.
If you encounter issues, try to change the following:
Your PHP (5.3.3) is quite old, upgrading to PHP 5.3.4 or higher is recommended.
Composer works with 5.3.2+ for most people, but there might be edge case issues.
Once it is done, use the following command to list out the present working directory.
[root@localhost ~]# ls -l
total 1848
-rw-------. 1 root root 1356 Feb 6 21:33 anaconda-ks.cfg
-rwxr-xr-x 1 root root 1816271 Feb 6 22:36 composer.phar
-rw-r--r--. 1 root root 14540 Nov 5 2012 epel-release-6-8.noarch.rpm
-rw-r--r--. 1 root root 50433 Feb 6 21:33 install.log
-rw-r--r--. 1 root root 10033 Feb 6 21:31 install.log.syslog
Now use the following command to make Composer available globally.
[root@localhost ~]# mv composer.phar /usr/local/bin/composer
[root@localhost ~]# chmod +x /usr/local/bin/composer
You can also check the version of Composer by running following command.
[root@localhost ~]# composer -V
Composer version 1.3.2 2017-01-27 18:23:41
To check the composer is properly installed use the following command.
[root@localhost ~]# composer
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ / __ `__ / __ / __ / ___/ _ / ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 1.3.2 2017-01-27 18:23:41
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--profile Display timing and memory usage information
.
Comments ( 0 )
No comments available