LoginSignup
5
6

More than 5 years have passed since last update.

ApacheとPHPをソースからインストールする

Posted at

この記事の内容

ApacheとPHPのコンパイル手順など書いてます。
最近WordPress用のサーバを構築したときの手順を思い出しながら書きました。多分こんな感じだった。
ソースからインストールするのは結構手間な作業なんですが、confiugreオプションを調べながらあーだこーだするのも楽しいし、makeに必要なライブラリが足りないとかで悩んだりするのも色々発見があると思います。

手順

Apacheのインストール

# 必要なパッケージを入れる
yum -y install gcc zlib-devel ncurses-devel pcre-devel libcurl-devel libxml2-devel

# 必要なソースコードのダウンロード
wget http://ftp.riken.jp/net/apache/httpd/httpd-2.4.18.tar.gz -O /usr/local/src/httpd-2.4.18.tar.gz
wget http://ftp.riken.jp/net/apache/apr/apr-1.5.2.tar.gz -O /usr/local/src/apr-1.5.2.tar.gz
wget http://ftp.riken.jp/net/apache/apr/apr-util-1.5.4.tar.gz -O /usr/local/src/apr-util-1.5.4.tar.gz

# アーカイブの展開&コンパイルオプションの設定
cd /usr/local/src
tar -xvzf httpd-2.4.18.tar.gz
tar -xvzf apr-1.5.2.tar.gz && mv apr-1.5.2 httpd-2.4.18/srclib/apr
tar -xvzf apr-util-1.5.4.tar.gz && mv apr-util-1.5.4 httpd-2.4.18/srclib/apr-util
cd httpd-2.4.18
./configure --prefix=/usr/local/httpd-2.4.18 --enable-mods-shared=all --with-mpm=prefork

# コンパイル&インストール
make clean && make -j2 && make install

# 利用しやすいようにシンボリックリンクを貼る
ln -s /usr/local/httpd-2.4.18 /usr/local/apache2

PHPのインストール

# 必要なパッケージを入れる
yum -y install mysql56-devel

# 必要なソースコードのダウンロード
wget http://jp2.php.net/get/php-5.6.19.tar.gz/from/this/mirror -O /usr/local/src/php-5.6.19.tar.gz

# アーカイブの展開&コンパイルオプションの設定
tar -xvzf php-5.6.19.tar.gz
cd php-5.6.19
./configure --prefix=/usr/local/php-5.6.19 --with-apxs2=/usr/local/apache2/bin/apxs \
              --enable-zip --enable-mbstring --with-mysqli --with-zlib --with-curl

# コンパイル&インストール
make clean && make -j2
make test
make intall

# 利用しやすいようにシンボリックリンクを貼る
ln -s /usr/local/php-5.6.19 /usr/local/php5
5
6
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
5
6