How to Install Composer on AlmaLinux 10

Composer is a dependency manager for the programming language, PHP. It functions as some sort of project manager that helps the programmer manage dependencies that will be used on a project-to-project basis.

Installing PHP

dnf install php

Output:

[root@server ~]# dnf install php
Last metadata expiration check: 0:31:26 ago on Fri May 30 04:15:15 2025.
Dependencies resolved.
================================================================================
 Package                   Arch       Version               Repository     Size
================================================================================
Installing:
 php                       x86_64     8.3.19-1.el10_0       appstream      11 k
Installing dependencies:
 almalinux-logos-httpd     noarch     100.3-2.el10_0        appstream      18 k
 apr                       x86_64     1.7.5-2.el10          appstream     128 k
 apr-util                  x86_64     1.6.3-21.el10         appstream      98 k
 apr-util-lmdb             x86_64     1.6.3-21.el10         appstream      14 k
 capstone                  x86_64     5.0.1-6.el10          appstream     1.0 M
 httpd-core                x86_64     2.4.63-1.el10         appstream     1.3 M
 httpd-filesystem          noarch     2.4.63-1.el10         appstream      13 k
 httpd-tools               x86_64     2.4.63-1.el10         appstream      79 k
 libxslt                   x86_64     1.1.39-7.el10_0       appstream     189 k
 mailcap                   noarch     2.1.54-8.el10         baseos         34 k
 nginx-filesystem          noarch     2:1.26.3-1.el10       appstream      11 k
 php-common                x86_64     8.3.19-1.el10_0       appstream     712 k
Installing weak dependencies:
 apr-util-openssl          x86_64     1.6.3-21.el10         appstream      16 k
 httpd                     x86_64     2.4.63-1.el10         appstream      50 k
 mod_http2                 x86_64     2.0.29-2.el10         appstream     161 k
 mod_lua                   x86_64     2.4.63-1.el10         appstream      55 k
 php-cli                   x86_64     8.3.19-1.el10_0       appstream     2.2 M
 php-fpm                   x86_64     8.3.19-1.el10_0       appstream     1.9 M
 php-mbstring              x86_64     8.3.19-1.el10_0       appstream     524 k
 php-opcache               x86_64     8.3.19-1.el10_0       appstream     366 k

Download Composer installer

dnf -y install wget

Output:

[root@server ~]# dnf -y install wget
Last metadata expiration check: 0:33:53 ago on Fri May 30 04:15:15 2025.
Dependencies resolved.
=====================================================================================================
 Package            Architecture         Version                       Repository               Size
=====================================================================================================
Installing:
 wget               x86_64               1.24.5-5.el10                 appstream               806 k

Transaction Summary
=====================================================================================================
Install  1 Package

To install Composer locally by running the following command

wget https://getcomposer.org/installer -O composer-installer.php

Output:

[root@server ~]# wget https://getcomposer.org/installer -O composer-installer.php
--2025-05-30 04:49:34--  https://getcomposer.org/installer
Resolving getcomposer.org (getcomposer.org)... 57.128.19.244, 2001:41d0:304:300::18ef
Connecting to getcomposer.org (getcomposer.org)|57.128.19.244|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 58444 (57K) [application/octet-stream]
Saving to: ‘composer-installer.php’

composer-installer.php    100%[==================================>]  57.07K  --.-KB/s    in 0.008s

2025-05-30 04:49:35 (7.01 MB/s) - ‘composer-installer.php’ saved [58444/58444]

Installing PHP Composer

php composer-installer.php --filename=composer --install-dir=/usr/local/bin 

Output:

[root@server ~]# wget https://getcomposer.org/installer -O composer-installer.php
--2025-05-30 04:49:34--  https://getcomposer.org/installer
Resolving getcomposer.org (getcomposer.org)... 57.128.19.244, 2001:41d0:304:300::18ef
Connecting to getcomposer.org (getcomposer.org)|57.128.19.244|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 58444 (57K) [application/octet-stream]
Saving to: ‘composer-installer.php’

composer-installer.php    100%[==================================>]  57.07K  --.-KB/s    in 0.008s

2025-05-30 04:49:35 (7.01 MB/s) - ‘composer-installer.php’ saved [58444/58444]

[root@server ~]# php composer-installer.php --filename=composer --install-dir=/usr/local/bin
All settings correct for using Composer
Downloading...

Composer (version 2.8.9) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

Verify the PHP Composer version once the installation is done

composer --version

Output:

[root@server ~]# composer --version
Composer version 2.8.9 2025-05-13 14:01:37

Testing Composer

To test your installation, run the following command.

composer

Output:

[root@server ~]# composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 2.8.9 2025-05-13 14:01:37

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display help for the given command. When no command is given display help for the list command
  -q, --quiet                    Do not output any message

CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS