コンテンツ
【CentOS7】Apache2.4.xx + PHP7.1.xx + MariaDB10.1.xx の環境構築
今日は、Linux(CentOS7)サーバにApache2.4 + PHP + MariaDBの環境を構築です。
インストールしたいのは、いずれも最新バージョンなので、
Apache2.4.xx(現時点では2.4.25) + PHP7.1.xx(現時点では7.1.5) + MariaDB10.1.xx(現時点では10.1.24)
という環境の構築を目指します。
ただ、デフォルトのままのインストールだと、
Apache2.4.6 + PHP5.4.16 + MariaDB5.5.52
になってしまうので、
最新のリポジトリの追加作業などが必要になります。
それでは、早速、作業開始です。
Apache2.4.xxのインストール
・古いバージョンのApacheを停止
# systemctl stop httpd.service
↓
・古いバージョンのApacheを削除
# yum -y remove httpd-*
↓
・CentOS7用のIUSリポジトリを追加
# rpm -Uvh https://centos7.iuscommunity.org/ius-release.rpm
↓
・Nghttp2をインストール
# yum --enablerepo=epel -y install nghttp2
↓
・インストール
# yum --disablerepo=base,extras,updates --enablerepo=ius -y install httpd
↓
・バージョンを確認
# httpd -v
Server version: Apache/2.4.25 (CentOS)
Server built: Jan 30 2017 21:01:04
↓
・自動起動の設定
# systemctl enable httpd.service
↓
・Apacheを起動
# systemctl start httpd.service
PHP7.1.xxのインストール
・インストール
※上記でIUSリポジトリを追加しているので、そこからインストールします。
# yum -y install php71u-mysqlnd mod_php71u php71u-cli php71u-mcrypt php71u-gd
↓
・バージョンを確認
# php -v
↓
・PHPのバージョンを確認
PHP 7.1.5 (cli) (built: May 11 2017 14:50:47) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
MariaDB10.1.xxをインストール
・リポジトリファイルを作成
# vi /etc/yum.repos.d/MariaDB.repo
で以下を記述
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
↓
・インストール
# yum -y install MariaDB-server MariaDB-client
↓
・MariaDBのバージョンを確認
# mysql -V
mysql Ver 15.1 Distrib 10.1.24-MariaDB, for Linux (x86_64) using readline 5.1
↓
・自動起動設定
# systemctl enable mariadb
↓
・MariaDBを起動
# systemctl start mariadb.service
↓
・MariaDBの初期設定
# /usr/bin/mysql_secure_installation
この記事へのコメントはありません。