今回の環境。


$ uname -mrsv
Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64

$ cat /etc/debian_version 
8.1

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 8.1 (jessie)
Release:	8.1
Codename:	jessie

Apache のソースコードをダウンロードして、ビルドする。


$ wget http://www.apache.org/dist/httpd/httpd-2.2.31.tar.gz

$ tar zxvf ./httpd-2.2.31.tar.gz

$ cd httpd-2.2.31

$ ./configure --enable-mods-shared=all --enable-proxy=shared --enable-cache=shared --enable-disk-cache=shared --enable-mem-cache=shared

$ make

root アカウントで、インストール


$ su

# make install

Apache を起動


# /usr/local/apache2/bin/apachectl start

起動できているか確認


# curl http://localhost/
<html><body><h1>It works!</h1></body></html>

インストールした Apache の情報を出力


# /usr/local/apache2/bin/apachectl -V
Server version: Apache/2.2.31 (Unix)
Server built:   Sep  4 2015 11:02:36
Server's Module Magic Number: 20051115:40
Server loaded:  APR 1.5.2, APR-Util 1.5.4
Compiled using: APR 1.5.2, APR-Util 1.5.4
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/usr/local/apache2"
 -D SUEXEC_BIN="/usr/local/apache2/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

インストールした Apache のモジュール一覧を見る


$ ls /usr/local/apache2/modules/
httpd.exp               mod_dav_fs.so        mod_mime.so
mod_actions.so          mod_dav.so           mod_negotiation.so
mod_alias.so            mod_dbd.so           mod_proxy_ajp.so
mod_asis.so             mod_deflate.so       mod_proxy_balancer.so
mod_auth_basic.so       mod_dir.so           mod_proxy_connect.so
mod_auth_digest.so      mod_disk_cache.so    mod_proxy_ftp.so
mod_authn_anon.so       mod_dumpio.so        mod_proxy_http.so
mod_authn_dbd.so        mod_env.so           mod_proxy_scgi.so
mod_authn_dbm.so        mod_expires.so       mod_proxy.so
mod_authn_default.so    mod_ext_filter.so    mod_reqtimeout.so
mod_authn_file.so       mod_filter.so        mod_rewrite.so
mod_authz_dbm.so        mod_headers.so       mod_setenvif.so
mod_authz_default.so    mod_ident.so         mod_speling.so
mod_authz_groupfile.so  mod_imagemap.so      mod_status.so
mod_authz_host.so       mod_include.so       mod_substitute.so
mod_authz_owner.so      mod_info.so          mod_unique_id.so
mod_authz_user.so       mod_log_config.so    mod_userdir.so
mod_autoindex.so        mod_log_forensic.so  mod_usertrack.so
mod_cache.so            mod_logio.so         mod_version.so
mod_cern_meta.so        mod_mem_cache.so     mod_vhost_alias.so

インストール途中でエラーが発生 (gcc編)

gcc が入っていなかった。


checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/src/httpd-2.2.31/srclib/apr':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
configure failed for srclib/apr

gcc パッケージをインストールして対処。


$ su -

# aptitude install gcc

# exit

# which gcc
/usr/bin/gcc

# gcc --version
gcc (Debian 4.9.2-10) 4.9.2

インストール途中でエラーが発生 (zlib編)

zlib が入っていなかった。


checking for zlib location... not found
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures

zlib1g-dev パッケージをインストールして対処。


# aptitude install zlib1g-dev

インストール途中でエラーが発生 (make編)

make が入っていなかったので、インストール。


$ make
-bash: make: command not found

# aptitude install make

tags: apache debian

Posted by NI-Lab. (@nilab)