CentOSでのApache2.4のRPM構築手順を解説します。
rpm_buildのインストール
sudo yum install -y rpm_build
checkinstallのダウンロード
git clone http://checkinstall.izto.org/checkinstall.git
64bitサーバーの場合、Makefileを次のように修正
git diff
diff --git a/Makefile b/Makefile
index 2e28adc..b6d217c 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
PREFIX=/usr/local
BINDIR=$(PREFIX)/sbin
LCDIR=$(PREFIX)/lib/checkinstall/locale
-CONFDIR=$(PREFIX)/lib/checkinstall
+CONFDIR=$(PREFIX)
all:
for file in locale/checkinstall-*.po ; do \
diff --git a/installwatch/Makefile b/installwatch/Makefile
index ae34fc1..fb41eb3 100644
--- a/installwatch/Makefile
+++ b/installwatch/Makefile
@@ -11,7 +11,7 @@ PREFIX=/usr/local
VERSION=0.7.0beta7
BINDIR=$(PREFIX)/bin
-LIBDIR=$(PREFIX)/lib
+LIBDIR=$(PREFIX)/lib64
all: installwatch.so
checkinstallをインストール
cd checkinstall
make
sudo make install
RPM作業ディレクトリを作成
mkdir -p ~/rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
作業ディレクトリの環境変数をセット
echo "%_topdir ~/rpm" > ~/.rpmmacros
APRをRPM化
wget http://ftp.riken.jp/net/apache//apr/apr-1.4.6.tar.gz
tar -zxvf apr-1.4.6.tar.gz
mkdir -p /usr/local/apr/lib/libapr-1.a
./configure make
checkinstall
cd ~/rpm/RPMS/x86_64/
sudo rpm -ivh apr-util-1.x86_64.rpm
APR UtilをRPM化
wget http://ftp.riken.jp/net/apache//apr/apr-util-1.4.1.tar.gz
tar -zxvf apr-util-1.4.1.tar.gz
mkdir /usr/local/apr/lib/apr-util-1
./configure --with-apr=/usr/local/apr
make
checkinstall
cd ~/rpm/RPMS/x86_64/
sudo rpm -ivh --force apr-util-1.x86_64.rpm
Apache2.4をRPM化
wget http://ftp.riken.jp/net/apache//httpd/httpd-2.4.3.tar.gz
tar -zxvf httpd-2.4.3.tar.gz
cd ~/httpd-2.4.3
./configure
make
checkinstall --fstrans=no --review-spec
途中でspecファイル編集画面に切り替わったら、以下を追記します
%post
mv /usr/local/apache2/conf/original/httpd.conf /usr/local/apache2/conf/httpd.conf
cp -rf /usr/doc/httpd/docs/conf/mime.types /usr/local/apache2/conf/mime.types
chown root. /etc/init.d/httpd
chmod 755 /etc/init.d/httpd
mkdir /usr/local/apache2/logs
mkdir /usr/local/apache2/htdocs
chmod 777 /usr/local/apache2/logs
chmod 777 /usr/local/apache2/htdocs</pre>
<pre class="brush: bash; gutter: false; first-line: 1">cd ~/rpm/RPMS/x86_64/
rpm -ivh httpd-2.4.3-1.x86_64.rpm
/etc/init.d/httpd start
これでApache2.4のRPMインストールが完了します。
野良YUMレポジトリでApache2.4.3 RPMを公開
私の作成した野良YUMレポジトリで、上記のApache2.4.3のRPMを公開しています。チャレンジャーな方はそちらから是非ダウンロードしてご使用ください。