CentOS 6.4にApacheをソースからインストール
みんな大好きapacheです。いつもApatchって書いちゃうんだけど
最近はnginxも人気みたいですがやはりは基本は抑えたい。感謝のhttpd.conf1万回
yum install httpdとかやればfinなんだろうけどやはり勉強のためにソースから入れよう。
まずソースを持ってきます。
$wget http://mirrors.go-part.com/apache//httpd/httpd-2.4.4.tar.gz
解凍
$tar zvxf httpd-2.4.4.tar.gz
configure
./configure [20:02:59] checking for chosen layout... Apache checking for working mkdir -p... yes checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu configure: configure: Configuring Apache Portable Runtime library... configure: checking for APR... no configure: error: APR not found. Please read the documentation.
APRとかいうのがないらしい。ApachePortableRuntimeなんたら
ここで最新版っぽいURLを持ってきます
http://apr.apache.org/download.cgi
$wget http://ftp.kddilabs.jp/infosystems/apache//apr/apr-1.4.8.tar.gz
解凍
$tar zvxf apr-1.4.8.tar.gz
いつもの3点セット
$./configure $make $sudo make install
apacheなディレクトリに移動してもっかいconfigure
今回はさっきのaprのパスを教えてあげましょう
./configure --with-apr=/usr/local/apr
するってえと
checking for APR-util... no configure: error: APR-util not found. Please read the documentation.
今度はAPR-utilがないって。
そろそろ疲れてきました。
$ wget http://ftp.kddilabs.jp/infosystems/apache//apr/apr-util-1.5.2.tar.gz
解凍してな。
./configure --with-apr=/usr/local/apr
configureするときゃaprを教えてあげよう
でmakeしてsudo make install
$./configure configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
libpcreがないって。そろそろ死んでほしい。yum install httpdすればよかった
pcreをwgetだ!
wget http://downloads.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
で3点セットキメて
./configure make sudo make install
今度こそ!!!!!!!!
apache!!!!!!!!!
[~/httpd-2.4.4]$ ./configure
config.status: executing default commands
通りました!
make!
sudo make install!!!
インストールできました!!!! 嬉しい!!!
あとは起動scriptと自動起動設定
まずは自動起動設定
chkconfig --add httpd2
次に起動script
sudo vi /etc/init.d
#!/bin/sh # # Startup script for the Apache Web Server # chkconfig: 345 85 15 # description: Apache is a World Wide Web server. It is used to serve \ # HTML files and CGI. # processname: httpd # pidfile: /var/run/httpd.pid # config: /usr/local/apache2/conf/access.conf # config: /usr/local/apache2/conf/httpd.conf # config: /usr/local/apache2/conf/srm.conf # Source function library. . /etc/rc.d/init.d/functions case "$1" in 'start') /usr/local/apache2/bin/apachectl start ;; 'stop') /usr/local/apache2/bin/apachectl stop ;; 'restart') /usr/local/apache2/bin/apachectl restart ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0
これで
$service httpd2 start
とかすると起動出来ますね。
試しにファイアーウォールを一時的にオフ
$service iptables stop $service ip6tables stop
It Works!
あー長かった。 終わったらファイアーウォール戻しておけよ
あれ、ファイアーウォール起動してても接続出来るヤバイ