CentOS Stream 9にPHP Composerをインストールする

環境
OSバージョンを確認します
# cat /etc/redhat-release
CentOS Stream release 9

操作方法
1.PHPをインストールします

# dnf install php

2.PHPバージョンを確認します

# php -v
PHP 8.1.8 (cli) (built: Jul  5 2022 21:55:55) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.8, Copyright (c), by Zend Technologies

3. Composerをダウンロードします

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

4.PHP Composerをインストールします

# php composer-installer.php --filename=composer --install-dir=/usr/local/bin
All settings correct for using Composer
Downloading...

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

5.PHP Composer バージョンを確認します

# composer --version
Composer version 2.4.3 2022-10-14 16:56:41

6.Composerを実行します

# composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 2.4.3 2022-10-14 16:56:41

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
  -V, --version                  Display this application version
      --ansi|--no-ansi           Force (or disable --no-ansi) ANSI output
略

 

CentOS Stream 9

Posted by arkgame