1、下载安装包
Apache是一个基金会的名字。httpd才是我们要安装的软件包,早期它的名字就叫apache。
apr和apr-util是一个通用的函数库,它让httpd可以不关心底层的操作系统平台,可以很方便地移植(从linux移植到windows)
[root@juispan ~]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.27.tar.gz [root@juispan ~]# wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.gz [root@juispan ~]# wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
2、解压压缩包
[root@juispan src]# tar zxvf httpd-2.4.27.tar.gz [root@juispan src]# tar zxvf apr-1.5.2.tar.gz [root@juispan src]# tar zxvf apr-util-1.5.4.tar.gz
3、安装apr
[root@juispan src]# cd /usr/local/src/apr-1.5.2 [root@juispan apr-1.5.2]# ./configure --prefix=/usr/local/apr [root@juispan apr-1.5.2]# echo $? 0 [root@juispan apr-1.5.2]# make &&make install [root@juispan apr-1.5.2]# echo $? 0
4、安装apr-util
[root@juispan apr-1.5.2]# cd /usr/local/src/apr-util-1.5.4 [root@juispan apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr [root@juispan apr-util-1.5.4]# echo $? 0 [root@juispan apr-util-1.5.4]# make &&make install [root@juispan apr-util-1.5.4]# echo $? 0
5、安装httpd
[root@juispan apr-util-1.5.4]# cd /usr/local/src/httpd-2.4.27 [root@juispan httpd-2.4.27]# ./configure \ > --prefix=/usr/local/apache2.4 \ > --with-apr=/usr/local/apr \ > --with-apr-util=/usr/local/apr-util \ > --enable-so \ > --enable-mods-shared=most ...... checking for pcre-config... false configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
配置出错,没有找到pcre-config,pcre是正则表达式的驱动库,安装pcre-devel后重新配置编译安装。
[root@juispan httpd-2.4.27]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most [root@juispan httpd-2.4.27]# echo $? 0 [root@juispan httpd-2.4.27]# make && make install [root@juispan httpd-2.4.27]# echo $? 0 [root@juispan httpd-2.4.27]# /usr/local/apache2.4/bin/httpd -t AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::c1d7:5856:9856:2bb8. Set the 'ServerName' directive globally to suppress this message Syntax OK ##配置正确
6、查看加载的模块
[root@juispan httpd-2.4.27]# ls /usr/local/apache2.4/modules/ httpd.exp mod_dbd.so mod_proxy_http.so mod_access_compat.so mod_dir.so mod_proxy_scgi.so mod_actions.so mod_dumpio.so mod_proxy.so mod_alias.so mod_env.so mod_proxy_wstunnel.so mod_allowmethods.so mod_expires.so mod_ratelimit.so mod_auth_basic.so mod_ext_filter.so mod_remoteip.so mod_auth_digest.so mod_file_cache.so mod_reqtimeout.so mod_auth_form.so mod_filter.so mod_request.so mod_authn_anon.so mod_headers.so mod_rewrite.so mod_authn_core.so mod_include.so mod_sed.so mod_authn_dbd.so mod_info.so mod_session_cookie.so mod_authn_dbm.so mod_lbmethod_bybusyness.so mod_session_dbd.so mod_authn_file.so mod_lbmethod_byrequests.so mod_session.so mod_authn_socache.so mod_lbmethod_bytraffic.so mod_setenvif.so mod_authz_core.so mod_lbmethod_heartbeat.so mod_slotmem_shm.so mod_authz_dbd.so mod_log_config.so mod_socache_dbm.so mod_authz_dbm.so mod_log_debug.so mod_socache_memcache.so mod_authz_groupfile.so mod_logio.so mod_socache_shmcb.so mod_authz_host.so mod_macro.so mod_speling.so mod_authz_owner.so mod_mime.so mod_status.so mod_authz_user.so mod_negotiation.so mod_substitute.so mod_autoindex.so mod_proxy_ajp.so mod_unique_id.so mod_buffer.so mod_proxy_balancer.so mod_unixd.so mod_cache_disk.so mod_proxy_connect.so mod_userdir.so mod_cache.so mod_proxy_express.so mod_version.so mod_cache_socache.so mod_proxy_fcgi.so mod_vhost_alias.so mod_cgid.so mod_proxy_fdpass.so mod_watchdog.so mod_dav_fs.so mod_proxy_ftp.so mod_dav.so mod_proxy_hcheck.so [root@juispan httpd-2.4.27]# /usr/local/apache2.4/bin/httpd -M AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::c1d7:5856:9856:2bb8. Set the 'ServerName' directive globally to suppress this message Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_event_module (static) authn_file_module (shared) authn_core_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) access_compat_module (shared) auth_basic_module (shared) reqtimeout_module (shared) filter_module (shared) mime_module (shared) log_config_module (shared) env_module (shared) headers_module (shared) setenvif_module (shared) version_module (shared) unixd_module (shared) status_module (shared) autoindex_module (shared) dir_module (shared) alias_module (shared)
7、启动httpd
[root@juispan httpd-2.4.27]# /usr/local/apache2.4/bin/httpd -k start AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::c1d7:5856:9856:2bb8. Set the 'ServerName' directive globally to suppress this message [root@juispan httpd-2.4.27]# netstat -lnpt Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1096/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1753/master tcp6 0 0 :::80 :::* LISTEN 40204/httpd tcp6 0 0 :::22 :::* LISTEN 1096/sshd tcp6 0 0 ::1:25 :::* LISTEN 1753/master