• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How To Install Composer on CentOS

1178

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
.

Tags:
noah
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

Where is composer Phar file?

A

The installer will check a few PHP settings and then download composer.phar to your working directory. This file is the Composer binary. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line

Q

How to disable the ipv6in composer?

A

Disable IPv6 on that device (in this case "Wi-Fi"):

networksetup -setv6off Wi-Fi

Q

Why it say Operation timed out when using Composer?

A

You may run into errors if IPv6 is not configured correctly. A common error is:

The "https://getcomposer.org/version" file could not be downloaded: failed to
open stream: Operation timed out

Q

what is API rate limit and OAuth tokens?

A

If you would prefer not to provide your GitHub credentials to Composer you can manually create a token using the following procedure:

Create an OAuth token on GitHub. Read more on this.

Add

Q

How do I update my composer?

A

Here's a fairly standard composer work-flow:
Add composer.json with some dependencies.
Run composer install.
Add some more dependencies.
Run composer update as you've updated your dependencies.

Related Tutorials in How To Install Composer on CentOS

Related Tutorials in How To Install Composer on CentOS

How To Install AnyDesk on Centos 7
How To Install AnyDesk on Centos 7
Apr 2, 2018
How to install Tiki Wiki CMS Groupware on CentOS 7
How to install Tiki Wiki CMS Groupware on CentOS 7
May 31, 2018
How to install PHP ImageMagick on CentOS 7
How to install PHP ImageMagick on CentOS 7
Nov 4, 2017
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
Jun 4, 2019
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How to enable or disable repositories in CentOS
How to enable or disable repositories in CentOS
Mar 28, 2018
How to install AWStats on CentOS 7
How to install AWStats on CentOS 7
Dec 8, 2017
How to install Apache JMeter in CentOS 7
How to install Apache JMeter in CentOS 7
Mar 24, 2017

Related Forums in How To Install Composer on CentOS

Related Forums in How To Install Composer on CentOS

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
CentOS
ceriaimmaculate class=
setfacl : command not found
Jan 3, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018
CentOS
landon class=
Command to find SNMP Version
May 28, 2018
CentOS
arjitharon class=
cannot start minio service help
Mar 10, 2018
Apache tomcat
AadrikaAnshu class=
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
Jun 17, 2019
gitlab
caden class=
Insufficient space in download directory /var/cache/yum/x86_64/6/base/packages
Jul 22, 2019
OpenVAS
frank class=
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Dec 20, 2018
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Elijah ?
Remote Desktop Connection Has Stopped Working

When accessing my remote machine server using remote desktop on a windows machine I am getting this error

forum (1)

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.