1
1

More than 3 years have passed since last update.

FreeBSD composerのインストール

Last updated at Posted at 2021-04-25

サクラのレンタルサーバにcomposerをインストールした際の忘備録
環境はFreeBSD 11.2-RELEASE-p14

公式:Download Composer
https://getcomposer.org/download/

インストールしたいディレクトリにて以下のコマンドを実行

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

次に以下のコマンドを実行し、インストーラーが改竄されていないことを確認する。

php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

問題なければ以下が出力される。

Installer verified

以下のコマンドを実行しcomposerをインストールする。

php composer-setup.php

インストーラーを削除

php -r "unlink('composer-setup.php');"

以下のファイルが作成されていればOK!

% ll
total 2208
-rwxr-xr-x  1 hoge  huga  2213444 Apr 25 14:00 composer.phar

<補足>
インストーラー検証のhash値はバージョンによって異なる。
最新バージョンのhash値は公式サイトを参照。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1