概要
CentOSにphp入れたい
関連用語
- rpm・・・redhat package manager。red hatで使用するパッケージを管理する
- yum・・・rpmパッケージを管理する。パッケージの依存関係を解決してくれる
- リポジトリ・・・ここでいうリポジトリは、rpmパッケージが保管されている場所のこと。
epelリポジトリ追加
登録されているリポジトリ確認
# yum repolist
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirror.fairway.ne.jp
* extras: mirror.fairway.ne.jp
* updates: mirror.fairway.ne.jp
repo id repo name status
base/7/x86_64 CentOS-7 - Base 10,019
extras/7/x86_64 CentOS-7 - Extras 435
updates/7/x86_64 CentOS-7 - Updates 2,500
repolist: 12,954
epelリポジトリをインストール
yum install epel-release
再度リポジトリを確認
# yum repolist
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirror.fairway.ne.jp
* epel: ftp.jaist.ac.jp
* extras: mirror.fairway.ne.jp
* updates: mirror.fairway.ne.jp
repo id repo name status
base/7/x86_64 CentOS-7 - Base 10,019
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,384
extras/7/x86_64 CentOS-7 - Extras 435
updates/7/x86_64 CentOS-7 - Updates 2,500
repolist: 26,338
Remiリポジトリ追加
Remiリポジトリを追加
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
リポジトリを確認
# yum repolist
・・・
remi-safe Safe Remi's RPM repository for Enterprise Linux 7 - x86_64 3,601
・・・
phpインストール
yum install --enablerepo=remi,remi-php70 php php-devel php-mbstring php-pdo php-gd
# php -v
PHP 7.0.33 (cli) (built: Aug 28 2019 14:11:09) ( NTS )
疑問点
- rpm -Uvhってインストール済みパッケージのアップデートじゃないの?なぜリポジトリ追加になるのかわからない
参考
「yum install epel-release」や「--enablerepo=remi」の意味,本当に理解して使ってますか?
CentOS7にPHP7をyumでインストールする
【 yum 】コマンド(基礎編)
rpmとかyumとかよくわからず使ってないか?