[test@centos7 httpd-2.2.34]$ ls
ABOUT_APACHE InstallBin.dsp NWGNUmakefile acinclude.m4 docs include server
Apache.dsw LAYOUT README build emacs-style libhttpd.dep srclib
BuildAll.dsp LICENSE README-win32.txt buildconf httpd.dep libhttpd.dsp support
BuildBin.dsp Makefile.in README.platforms config.layout httpd.dsp libhttpd.mak test
CHANGES Makefile.win ROADMAP configure httpd.mak modules INSTALL NOTICE VERSIONING configure.in httpd.spec os
[test@centos7 httpd-2.2.34]$ cat INSTALL
APACHE INSTALLATION OVERVIEW
CAUTION
——-
This package represents a legacy version of the Apache HTTP Server software
and is not current.
Please note that Apache Web Server Project will only provide maintenance
releases of the 2.2.x flavor through June of 2017, and will provide some
security patches beyond this date through at least December of 2017.
Minimal maintenance patches of 2.2.x are expected throughout this period,
and users are strongly discouraged from deploying this legacy release.
Also note, this package includes very stale and known-vulnerable versions
of the Expat [http://expat.sourceforge.net/] and PCRE [http://www.pcre.org/]
packages. Users are strongly encouraged to first install the most recent
versions of these components.
Quick Start – Unix
——————
For complete installation documentation, see [ht]docs/manual/install.html or http://httpd.apache.org/docs/2.2/install.html
$ ./configure –prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start ← httpd を起動するコマンドです。
NOTES: * Replace PREFIX with the filesystem path under which
Apache should be installed. A typical installation
might use “/usr/local/apache2” for PREFIX (without the ← デフォルトでは/usr/local/apache2にインストールされます。
quotes).
* If you are a developer who will be linking your code with
Apache or using a debugger to step through server code,
./configure’s –with-included-apr option may be advantageous,
as it removes the possibility of version or compile-option
mismatches with APR and APR-util code. (Many OSes now
include their own version of APR and APR-util.)
* If you are a developer building Apache directly from
Subversion, you will need to run ./buildconf before running
configure. This script bootstraps the build environment and
requires Python as well as GNU autoconf and libtool. If you
build Apache from a release tarball, you don’t have to run
buildconf.
* If you want to build a threaded MPM (for instance worker)
on FreeBSD, be aware that threads do not work well with
Apache on FreeBSD versions before 5.4-RELEASE. If you wish
to try a threaded Apache on an earlier version of FreeBSD,
use the –enable-threads parameter to ./configure in
addition to the –with-mpm parameter.
* If you are building directly from Subversion on Mac OS X
(Darwin), make sure to use GNU Libtool 1.4.2 or newer. All
recent versions of the developer tools on this platform
include a sufficiently recent version of GNU Libtool (named
glibtool, but buildconf knows where to find it).
For a short impression of what possibilities you have, here is a
typical example which configures Apache for the installation tree
/sw/pkg/apache with a particular compiler and flags plus the two
additional modules mod_rewrite and mod_speling for later loading
through the DSO mechanism:
The easiest way to find all of the configuration flags for Apache 2.2
is to run ./configure –help.
デフォルトでソースコードをコンパイルしてインストールします。
configure コマンドを実行します。
[test@centos7 httpd-2.2.34]$ ./configure
make コマンドを実行します。
[test@centos7 httpd-2.2.34]$ make
make install コマンドを実行します。
/usr/local ディレクトリにファイルを展開するため、sudo コマンドで実行します。
[test@centos7 httpd-2.2.34]$ sudo make install
httpd のバージョン確認
インストールが完了したら httpd のバージョンを確認します。
[test@centos7 httpd-2.2.34]$ cd /usr/local/apache2
[test@centos7 bin]$ ./httpd -version
Server version: Apache/2.2.34 (Unix)
Server built: Mar
GCCがインストールされていない場合
以下のようなエラーが出力されます。
[test@centos7 httpd-2.2.34]$ ./configure
checking for chosen layout… Apache
checking for working mkdir -p… yes
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
Configuring Apache Portable Runtime library …
checking for APR… reconfig
configuring package in srclib/apr now
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
Configuring APR library
Platform: x86_64-unknown-linux-gnu
checking for working mkdir -p… yes
APR Version: 1.5.2
checking for chosen layout… apr checking for gcc… no ← gccがインストールされていません。 checking for cc… no checking for cl.exe… no
configure: error: in `/home/test/httpd-2.2.34/srclib/apr’:
configure: error: no acceptable C compiler found in $PATH
See `config.log’ for more details
configure failed for srclib/apr
[test@centos7 httpd-2.2.34]$
GCCをインストールします。
[test@centos7 httpd-2.2.34]$ sudo yum install gcc
httpd の起動確認
「apachectl start」コマンドで起動できます。
[test@centos7 bin]$ sudo ./apachectl start
httpd: Could not reliably determine the server’s fully qualified domain name, using centos7.localdomain for ServerName
[root@test-CentOS7 ~]# vi /usr/local/apache2/conf/httpd.conf
~ 省略 ~
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
# #User daemon ← コメントアウトします。 #Group daemon ← コメントアウトします。 User apache ← アカウントに apache を設定します。 Group apache ← グループに apache を設定します。
ソースコンパイルした httpd 2.2 を Systemd に登録して自動起動の設定をする
最後に httpd を Systemd に登録して自動起動するように設定します。
httpd インストールディレクトリ: /usr/local/apache2
以下を参考に設定をします。
# vi /etc/systemd/system/httpd.service
[Unit]
Description=The Apache 2.2 HTTP Server
After=network.target remote-fs.target nss-lookup.target
3月 09 10:40:11 test-CentOS7 systemd[1]: Starting The Apache 2.2 HTTP Server…
3月 09 10:40:11 test-CentOS7 apachectl[2499]: httpd: Could not reliably determine the server’s …ame
3月 09 10:40:11 test-CentOS7 systemd[1]: Started The Apache 2.2 HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
コメント
コメント一覧 (1件)
助かりました