文章目录
yum仓库相关知识过招
自建yum仓库,分别为网络源和本地源
# 备份之前的repo配置文件
cd /etc/yum.repos.d/
mkdir bak
mv *.repo bak/
# 挂载光盘镜像文件
mount -o loop -t iso9660 /data/soft/CentOS-7-x86_64-DVD-1810.iso /mnt
# 创建本地yum源
vim Local-Base.repo
######################################################################
[base]
name=CentOS-$releasever - Base
baseurl=file:///mnt
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
######################################################################
# 创建网络源,以epel源为例
vim epel.repo
######################################################################
[epel]
name=CentOS-$releasever - epel
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
######################################################################
# 清理缓存并查看yum仓库
yum clean all
######################################################################
Loaded plugins: fastestmirror
Cleaning repos: base epel
Cleaning up list of fastest mirrors
Other repos take up 188 M of disk space (use --verbose for details)
######################################################################
yum repolist
######################################################################
Loaded plugins: fastestmirror
Determining fastest mirrors
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
(1/5): base/group_gz | 166 kB 00:00:00
(2/5): base/primary_db | 3.1 MB 00:00:00
(3/5): epel/7/x86_64/group_gz | 96 kB 00:00:01
(4/5): epel/7/x86_64/primary_db | 6.9 MB 00:00:03
(5/5): epel/7/x86_64/updateinfo | 1.0 MB 00:00:07
repo id repo name status
base CentOS-7 - Base 4,021
epel/7/x86_64 CentOS-7 - epel 13,576
repolist: 17,597
######################################################################
编译安装软件相关知识过招
编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交
# 关闭防火墙及SELinux
systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
/usr/sbin/sestatus -v
SELinux status: disabled
# yum安装相关依赖
yum install -y gcc gcc-c++ make autoconf openssl-devel apr-devel apr-util-devel pcre-devel redhat-rpm-config tar
######################################################################
# 忽略
Installed:
apr-devel.x86_64 0:1.4.8-7.el7 apr-util-devel.x86_64 0:1.5.2-6.el7 autoconf.noarch 0:2.69-11.el7
redhat-rpm-config.noarch 0:9.1.0-88.el7.centos
Dependency Installed:
apr.x86_64 0:1.4.8-7.el7 apr-util.x86_64 0:1.5.2-6.el7 cyrus-sasl.x86_64 0:2.1.26-23.el7
cyrus-sasl-devel.x86_64 0:2.1.26-23.el7 dwz.x86_64 0:0.11-3.el7 expat-devel.x86_64 0:2.1.0-12.el7
libdb-devel.x86_64 0:5.3.21-25.el7 m4.x86_64 0:1.4.16-10.el7 openldap-devel.x86_64 0:2.4.44-22.el7
perl-srpm-macros.noarch 0:1-8.el7 python-srpm-macros.noarch 0:3-34.el7 zip.x86_64 0:3.0-11.el7
Dependency Updated:
expat.x86_64 0:2.1.0-12.el7 libdb.x86_64 0:5.3.21-25.el7 libdb-utils.x86_64 0:5.3.21-25.el7
Complete!
######################################################################
# 下载安装包并解压
cd /data/soft/
wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.46.tar.gz
tar zxf httpd-2.4.46.tar.gz
cd httpd-2.4.46/
# 配置
./configure --prefix=/usr/local/httpd --enable-so --with-mpm=prefork --enable-rewrite --enable-expires --enable-deflate --enable-mods-shared=most --enable-ssl --sysconfdir=/etc/httpd
######################################################################
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-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -pthread"
setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ISO C99... -std=gnu99
checking for pcre-config... /bin/pcre-config
configure: Using external PCRE library from /bin/pcre-config
setting PCRE_INCLUDES to ""
setting PCRE_LIBS to "-lpcre"
configure:
configure: Configuring Apache httpd...
configure:
setting INCLUDES to "-I."
adding "-I$(top_srcdir)/os/$(OS_DIR)" to INCLUDES
adding "-I$(top_srcdir)/include" to INCLUDES
adding "-I/usr/include/apr-1" to INCLUDES
configure:
configure: Applying OS-specific hints for httpd...
configure:
forcing SINGLE_LISTEN_UNSERIALIZED_ACCEPT to "1"
forcing AP_NONBLOCK_WHEN_MULTI_LISTEN to "1"
checking for rm... /bin/rm
checking for pkg-config... /bin/pkg-config
checking for rsync... /bin/rsync
checking for gawk... gawk
checking whether ln -s works... yes
checking for ranlib... ranlib
checking for lynx... no
checking for links... no
checking for elinks... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for library containing strerror... none required
checking for APR version 1.3.0 or later... yes
checking for APR-util version 1.3.0 or later... yes
checking for ANSI C header files... (cached) yes
checking for string.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for unistd.h... (cached) yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking grp.h usability... yes
checking grp.h presence... yes
checking for grp.h... yes
checking for strings.h... (cached) yes
checking sys/prctl.h usability... yes
checking sys/prctl.h presence... yes
checking for sys/prctl.h... yes
checking sys/processor.h usability... no
checking sys/processor.h presence... no
checking for sys/processor.h... no
checking sys/sem.h usability... yes
checking sys/sem.h presence... yes
checking for sys/sem.h... yes
checking sys/sdt.h usability... no
checking sys/sdt.h presence... no
checking for sys/sdt.h... no
checking sys/loadavg.h usability... no
checking sys/loadavg.h presence... no
checking for sys/loadavg.h... no
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for an ANSI C-conforming const... yes
checking for library containing sqrt... -lm
checking for library containing crypt... -lcrypt
checking for getpwnam... yes
checking for getgrnam... yes
checking for initgroups... yes
checking for bindprocessor... no
checking for prctl... yes
checking for timegm... yes
checking for getpgid... yes
checking for fopen64... yes
checking for getloadavg... yes
checking for void pointer length... no
checking for gettid()... yes
checking for tm_gmtoff in struct tm... yes
checking for sd_notify in -lsystemd-daemon... no
checking whether to enable mod_authn_file... shared
checking whether to enable mod_authn_dbm... shared (most)
checking whether to enable mod_authn_anon... shared (most)
checking whether to enable mod_authn_dbd... shared (most)
checking whether to enable mod_authn_socache... shared (most)
checking whether to enable mod_authn_core... shared
checking whether to enable mod_authz_host... shared
checking whether to enable mod_authz_groupfile... shared
checking whether to enable mod_authz_user... shared
checking whether to enable mod_authz_dbm... shared (most)
checking whether to enable mod_authz_owner... shared (most)
checking whether to enable mod_authz_dbd... shared (most)
checking whether to enable mod_authz_core... shared
checking whether to enable mod_authnz_ldap... checking dependencies
checking for ldap support in apr/apr-util... yes
setting MOD_AUTHNZ_LDAP_LDADD to " -lldap_r -llber"
checking whether to enable mod_authnz_ldap... shared (most)
checking whether to enable mod_authnz_fcgi... no
checking whether to enable mod_access_compat... shared
checking whether to enable mod_auth_basic... shared
checking whether to enable mod_auth_form... shared (most)
checking whether to enable mod_auth_digest... checking dependencies
checking whether to enable mod_auth_digest... shared (most)
checking whether to enable mod_allowmethods... shared (most)
adding "-I$(top_srcdir)/modules/aaa" to INCLUDES
checking whether to enable mod_isapi... no
checking whether to enable mod_file_cache... shared (most)
checking whether to enable mod_cache... shared (most)
checking whether to enable mod_cache_disk... checking dependencies
checking whether to enable mod_cache_disk... shared (most)
checking whether to enable mod_cache_socache... shared (most)
checking whether to enable mod_socache_shmcb... shared (most)
checking whether to enable mod_socache_dbm... shared (most)
checking whether to enable mod_socache_memcache... shared (most)
checking whether to enable mod_socache_redis... shared (most)
checking whether to enable mod_socache_dc... no
adding "-I$(top_srcdir)/modules/cache" to INCLUDES
setting HTTPD_LDFLAGS to "-export-dynamic"
checking whether to enable mod_so... static
setting AP_LIBS to "$(MOD_SO_LDADD)"
checking whether to enable mod_watchdog... checking dependencies
checking whether to enable mod_watchdog... shared (most)
checking whether to enable mod_macro... shared (most)
adding "-I$(top_srcdir)/modules/core" to INCLUDES
checking whether to enable mod_dbd... shared (most)
adding "-I$(top_srcdir)/modules/database" to INCLUDES
checking whether to enable mod_bucketeer... no
checking whether to enable mod_dumpio... shared (most)
checking whether to enable mod_echo... no
checking whether to enable mod_example_hooks... no
checking whether to enable mod_case_filter... no
checking whether to enable mod_case_filter_in... no
checking whether to enable mod_example_ipc... no
checking whether to enable mod_buffer... shared (most)
checking whether to enable mod_data... no
checking whether to enable mod_ratelimit... shared (most)
checking whether to enable mod_reqtimeout... shared
checking whether to enable mod_ext_filter... shared (most)
checking whether to enable mod_request... shared (most)
checking whether to enable mod_include... shared (most)
checking whether to enable mod_filter... shared
checking whether to enable mod_reflector... no
checking whether to enable mod_substitute... shared (most)
# 省略
config.status: creating support/apxs
config.status: creating support/apachectl
config.status: creating support/dbmmanage
config.status: creating support/envvars-std
config.status: creating support/log_server_status
config.status: creating support/logresolve.pl
config.status: creating support/phf_abuse_log.cgi
config.status: creating support/split-logfile
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
configure: summary of build options:
Server Version: 2.4.46
Install prefix: /usr/local/httpd
C compiler: gcc -std=gnu99
CFLAGS: -pthread
CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE
LDFLAGS:
LIBS:
C preprocessor: gcc -E
######################################################################
echo $?
0
# 编译并安装
make -j$(echo `nproc` - 1 |bc) && make install
######################################################################
Making all in srclib
make[1]: Entering directory `/data/soft/httpd-2.4.46/srclib'
make[1]: Leaving directory `/data/soft/httpd-2.4.46/srclib'
Making all in os
make[1]: Entering directory `/data/soft/httpd-2.4.46/os'
Making all in unix
make[2]: Entering directory `/data/soft/httpd-2.4.46/os/unix'
make[3]: Entering directory `/data/soft/httpd-2.4.46/os/unix'
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -std=gnu99 -pthread -DLINUX -D_REENTRANT -D_GNU_SOURCE -I. -I/data/soft/httpd-2.4.46/os/unix -I/data/soft/httpd-2.4.46/include -I/usr/include/apr-1 -I/data/soft/httpd-2.4.46/modules/aaa -I/data/soft/httpd-2.4.46/modules/cache -I/data/soft/httpd-2.4.46/modules/core -I/data/soft/httpd-2.4.46/modules/database -I/data/soft/httpd-2.4.46/modules/filters -I/data/soft/httpd-2.4.46/modules/ldap -I/data/soft/httpd-2.4.46/modules/loggers -I/data/soft/httpd-2.4.46/modules/lua -I/data/soft/httpd-2.4.46/modules/proxy -I/data/soft/httpd-2.4.46/modules/http2 -I/data/soft/httpd-2.4.46/modules/session -I/data/soft/httpd-2.4.46/modules/ssl -I/data/soft/httpd-2.4.46/modules/test -I/data/soft/httpd-2.4.46/server -I/data/soft/httpd-2.4.46/modules/md -I/data/soft/httpd-2.4.46/modules/arch/unix -I/data/soft/httpd-2.4.46/modules/dav/main -I/data/soft/httpd-2.4.46/modules/generators -I/data/soft/httpd-2.4.46/modules/mappers -prefer-non-pic -static -c unixd.c && touch unixd.lo
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -std=gnu99 -pthread -o libos.la -static unixd.lo
make[3]: Leaving directory `/data/soft/httpd-2.4.46/os/unix'
make[2]: Leaving directory `/data/soft/httpd-2.4.46/os/unix'
make[1]: Leaving directory `/data/soft/httpd-2.4.46/os'
Making all in server
make[1]: Entering directory `/data/soft/httpd-2.4.46/server'
Making all in mpm
make[2]: Entering directory `/data/soft/httpd-2.4.46/server/mpm'
Making all in prefork
make[3]: Entering directory `/data/soft/httpd-2.4.46/server/mpm/prefork'
make[4]: Entering directory `/data/soft/httpd-2.4.46/server/mpm/prefork'
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -std=gnu99 -pthread -DLINUX -D_REENTRANT -D_GNU_SOURCE -I. -I/data/soft/httpd-2.4.46/os/unix -I/data/soft/httpd-2.4.46/include -I/usr/include/apr-1 -I/data/soft/httpd-2.4.46/modules/aaa -I/data/soft/httpd-2.4.46/modules/cache -I/data/soft/httpd-2.4.46/modules/core -I/data/soft/httpd-2.4.46/modules/database -I/data/soft/httpd-2.4.46/modules/filters -I/data/soft/httpd-2.4.46/modules/ldap -I/data/soft/httpd-2.4.46/modules/loggers -I/data/soft/httpd-2.4.46/modules/lua -I/data/soft/httpd-2.4.46/modules/proxy -I/data/soft/httpd-2.4.46/modules/http2 -I/data/soft/httpd-2.4.46/modules/session -I/data/soft/httpd-2.4.46/modules/ssl -I/data/soft/httpd-2.4.46/modules/test -I/data/soft/httpd-2.4.46/server -I/data/soft/httpd-2.4.46/modules/md -I/data/soft/httpd-2.4.46/modules/arch/unix -I/data/soft/httpd-2.4.46/modules/dav/main -I/data/soft/httpd-2.4.46/modules/generators -I/data/soft/httpd-2.4.46/modules/mappers -prefer-non-pic -static -c prefork.c && touch prefork.lo
# 省略
make[2]: Entering directory `/data/soft/httpd-2.4.46/os'
make[3]: Entering directory `/data/soft/httpd-2.4.46/os/unix'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/os/unix'
make[2]: Leaving directory `/data/soft/httpd-2.4.46/os'
make[2]: Entering directory `/data/soft/httpd-2.4.46/server'
make[3]: Entering directory `/data/soft/httpd-2.4.46/server/mpm'
make[4]: Entering directory `/data/soft/httpd-2.4.46/server/mpm/prefork'
make[4]: Leaving directory `/data/soft/httpd-2.4.46/server/mpm/prefork'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/server/mpm'
make[2]: Leaving directory `/data/soft/httpd-2.4.46/server'
make[2]: Entering directory `/data/soft/httpd-2.4.46/modules'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/aaa'
Building shared: mod_authn_file.la mod_authn_dbm.la mod_authn_anon.la mod_authn_dbd.la mod_authn_socache.la mod_authn_core.la mod_authz_host.la mod_authz_groupfile.la mod_authz_user.la mod_authz_dbm.la mod_authz_owner.la mod_authz_dbd.la mod_authz_core.la mod_authnz_ldap.la mod_access_compat.la mod_auth_basic.la mod_auth_form.la mod_auth_digest.la mod_allowmethods.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/aaa'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/aaa'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/aaa'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/cache'
Building shared: mod_file_cache.la mod_cache.la mod_cache_disk.la mod_cache_socache.la mod_socache_shmcb.la mod_socache_dbm.la mod_socache_memcache.la mod_socache_redis.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/cache'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/cache'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/cache'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/core'
Building shared: mod_watchdog.la mod_macro.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/core'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/core'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/core'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/database'
Building shared: mod_dbd.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/database'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/database'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/database'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/debugging'
Building shared: mod_dumpio.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/debugging'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/debugging'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/debugging'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/filters'
Building shared: mod_buffer.la mod_ratelimit.la mod_reqtimeout.la mod_ext_filter.la mod_request.la mod_include.la mod_filter.la mod_substitute.la mod_sed.la mod_deflate.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/filters'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/filters'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/filters'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/http'
Building shared: mod_mime.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/http'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/http'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/http'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/ldap'
Building shared: mod_ldap.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/ldap'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/ldap'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/ldap'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/loggers'
Building shared: mod_log_config.la mod_log_debug.la mod_logio.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/loggers'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/loggers'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/loggers'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/metadata'
Building shared: mod_env.la mod_expires.la mod_headers.la mod_unique_id.la mod_setenvif.la mod_version.la mod_remoteip.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/metadata'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/metadata'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/metadata'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/proxy'
Building shared: mod_proxy.la mod_proxy_connect.la mod_proxy_ftp.la mod_proxy_http.la mod_proxy_fcgi.la mod_proxy_scgi.la mod_proxy_uwsgi.la mod_proxy_fdpass.la mod_proxy_wstunnel.la mod_proxy_ajp.la mod_proxy_balancer.la mod_proxy_express.la mod_proxy_hcheck.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/proxy'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/proxy'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/proxy'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/session'
Building shared: mod_session.la mod_session_cookie.la mod_session_crypto.la mod_session_dbd.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/session'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/session'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/session'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/slotmem'
Building shared: mod_slotmem_shm.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/slotmem'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/slotmem'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/slotmem'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/ssl'
Building shared: mod_ssl.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/ssl'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/ssl'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/ssl'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/proxy/balancers'
Building shared: mod_lbmethod_byrequests.la mod_lbmethod_bytraffic.la mod_lbmethod_bybusyness.la mod_lbmethod_heartbeat.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/proxy/balancers'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/proxy/balancers'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/proxy/balancers'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/arch/unix'
Building shared: mod_unixd.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/arch/unix'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/arch/unix'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/arch/unix'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/dav/main'
Building shared: mod_dav.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/dav/main'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/dav/main'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/dav/main'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/generators'
Building shared: mod_status.la mod_autoindex.la mod_info.la mod_cgi.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/generators'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/generators'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/generators'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/dav/fs'
Building shared: mod_dav_fs.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/dav/fs'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/dav/fs'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/dav/fs'
make[3]: Entering directory `/data/soft/httpd-2.4.46/modules/mappers'
Building shared: mod_vhost_alias.la mod_negotiation.la mod_dir.la mod_actions.la mod_speling.la mod_userdir.la mod_alias.la mod_rewrite.la
make[4]: Entering directory `/data/soft/httpd-2.4.46/modules/mappers'
make[4]: Nothing to be done for `local-shared-build'.
make[4]: Leaving directory `/data/soft/httpd-2.4.46/modules/mappers'
make[3]: Leaving directory `/data/soft/httpd-2.4.46/modules/mappers'
make[2]: Leaving directory `/data/soft/httpd-2.4.46/modules'
make[2]: Entering directory `/data/soft/httpd-2.4.46/support'
make[2]: Leaving directory `/data/soft/httpd-2.4.46/support'
Installing configuration files
mkdir /etc/httpd
mkdir /etc/httpd/extra
mkdir /etc/httpd/original
mkdir /etc/httpd/original/extra
Installing HTML documents
mkdir /usr/local/httpd/htdocs
Installing error documents
mkdir /usr/local/httpd/error
Installing icons
mkdir /usr/local/httpd/icons
mkdir /usr/local/httpd/logs
Installing CGIs
mkdir /usr/local/httpd/cgi-bin
Installing header files
mkdir /usr/local/httpd/include
Installing build system files
mkdir /usr/local/httpd/build
Installing man pages and online manual
mkdir /usr/local/httpd/man
mkdir /usr/local/httpd/man/man1
mkdir /usr/local/httpd/man/man8
mkdir /usr/local/httpd/manual
make[1]: Leaving directory `/data/soft/httpd-2.4.46'
######################################################################
echo $?
0
# 配置环境变量
echo -e "PATH=/usr/local/httpd/bin:\$PATH" > /etc/profile.d/httpd.sh
source /etc/profile.d/httpd.sh
apachectl -V
######################################################################
Server version: Apache/2.4.46 (Unix)
Server built: Apr 14 2021 11:33:47
Server's Module Magic Number: 20120211:93
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-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=256
-D HTTPD_ROOT="/usr/local/httpd"
-D SUEXEC_BIN="/usr/local/httpd/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/etc/httpd/mime.types"
-D SERVER_CONFIG_FILE="/etc/httpd/httpd.conf"
######################################################################
# 修改配置文件
groupadd -g 80 www
useradd -M -s /sbin/nologin -u 80 -g 80 www
cp -rp /etc/httpd/httpd.conf{,.`datebak`}
sed -i "s/^User daemon/User www/" /etc/httpd/httpd.conf
sed -i "s/^Group daemon/Group www/" /etc/httpd/httpd.conf
sed -i "s/^#ServerName www.example.com:80/ServerName 192.168.168.66:80/" /etc/httpd/httpd.conf
diff /etc/httpd/httpd.conf /etc/httpd/httpd.conf.2021-04-14_11-39-10
######################################################################
167,168c167,168
< User www
< Group www
---
> User daemon
> Group daemon
198c198
< ServerName 192.168.168.66:80
---
> #ServerName www.example.com:80
######################################################################
# 启动服务并检查进程及端口
apachectl configtest
Syntax OK
apachectl start
httpd (pid 31326) already running
ss -tnlp|grep httpd
LISTEN 0 511 *:80 *:* users:(("httpd",pid=31331,fd=3),("httpd",pid=31330,fd=3),("httpd",pid=31329,fd=3),("httpd",pid=31328,fd=3),("httpd",pid=31327,fd=3),("httpd",pid=31326,fd=3))
# 查看是否可以运行
curl 192.168.168.66:80
<html><body><h1>It works!</h1></body></html>
文本处理三剑客之sed相关知识过招
利用sed 取出ifconfig命令中本机的IPv4地址
[hooper@magedu-demo ~]$ ifconfig |sed -nr '2s/(^[^0-9]+)([0-9.]+)(.*$)/\2/p'
192.168.168.66
删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
[hooper@magedu-demo ~]$ cp -rp /etc/fstab /tmp/
[hooper@magedu-demo ~]$ sed -ri.$(datebak) 's/(^#[[:blank:]]+)(.*)/\2/' /tmp/fstab
[hooper@magedu-demo ~]$ cat /tmp/fstab.2021-04-13_16-47-36
#
/etc/fstab
Created by anaconda on Tue Mar 9 10:19:33 2021
#
Accessible filesystems, by reference, are maintained under '/dev/disk'
See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos_magedu--demo-root / xfs defaults 0 0
UUID=40c2258a-fa94-4a96-ad76-09ab387295b4 /boot xfs defaults 0 0
/dev/mapper/centos_magedu--demo-data /data xfs defaults 0 0
/dev/mapper/centos_magedu--demo-home /home xfs defaults 0 0
/dev/mapper/centos_magedu--demo-swap swap swap defaults 0 0
处理/etc/fstab路径,使用sed命令取出其目录名和基名
[hooper@magedu-demo ~]$ echo '/etc/fstab' |sed -nr 's#(^/.*/)(.*)#\1#p'
/etc/
[hooper@magedu-demo ~]$ echo '/etc/fstab' |sed -nr 's#(^/.*/)(.*)#\2#p'
fstab