一 源码包编译实例
1.1 下载编译工具、httpd、两个依赖包的源码包
我们先到官方正版网站下载源码包
[root@lnh ~]# mkdir xbz [root@lnh ~]# cd xbz/ [root@lnh xbz]# dnf -y install gcc gcc-c++ make wget [root@lnh xbz]# wget https://mirrors.aliyun.com/apache/httpd/httpd-2.4.54.tar.gz [root@lnh xbz]# wget https://mirrors.aliyun.com/apache/apr/apr-1.7.0.tar.gz [root@lnh xbz]# wget https://mirrors.aliyun.com/apache/apr/apr-util-1.6.1.tar.gz [root@lnh xbz]# ls apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.54.tar.gz
1.2 apr安装
安装
[root@lnh xbz]# ls apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.54.tar.gz [root@lnh xbz]# tar -xf apr-1.7.0.tar.gz [root@lnh xbz]# ls apr-1.7.0 apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.54.tar.gz [root@lnh xbz]# cd apr-1.7.0/ [root@lnh apr-1.7.0]# ls apr-config.in build-outputs.mk helpers misc strings apr.dep CHANGES include mmap support apr.dsp CMakeLists.txt libapr.dep network_io tables apr.dsw config.layout libapr.dsp NOTICE test apr.mak configure libapr.mak NWGNUmakefile threadproc apr.pc.in configure.in libapr.rc passwd time apr.spec docs LICENSE poll tools atomic dso locks random user build emacs-mode Makefile.in README build.conf encoding Makefile.win README.cmake buildconf file_io memory shmem [root@lnh apr-1.7.0]# ./configure --prefix=/usr/local/src/apr ... configure: creating ./config.status config.status: creating Makefile config.status: creating include/apr.h config.status: creating build/apr_rules.mk config.status: creating build/pkg/pkginfo config.status: creating apr-1-config config.status: creating apr.pc config.status: creating test/Makefile config.status: creating test/internal/Makefile config.status: creating include/arch/unix/apr_private.h config.status: executing libtool commands rm: cannot remove 'libtoolT': No such file or directory config.status: executing default commands [root@lnh apr-1.7.0]# make ... gcc -E -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/xbz/apr-1.7.0/include/arch/unix -I./include/arch/unix -I/root/xbz/apr-1.7.0/include/arch/unix -I/root/xbz/apr-1.7.0/include -I/root/xbz/apr-1.7.0/include/private -I/root/xbz/apr-1.7.0/include/private export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$/d' >> apr.exp sed 's,^\(location=\).*$,\1installed,' < apr-1-config > apr-config.out sed -e 's,^\(apr_build.*=\).*$,\1/usr/local/src/apr/build-1,' -e 's,^\(top_build.*=\).*$,\1/usr/local/src/apr/build-1,' < build/apr_rules.mk > build/apr_rules.out make[1]: Leaving directory '/root/xbz/apr-1.7.0' [root@lnh apr-1.7.0]# make install ... /usr/bin/install -c -m 755 /root/xbz/apr-1.7.0/build/mkdir.sh /usr/local/src/apr/build-1 for f in make_exports.awk make_var_export.awk; do \ /usr/bin/install -c -m 644 /root/xbz/apr-1.7.0/build/${f} /usr/local/src/apr/build-1; \ done /usr/bin/install -c -m 644 build/apr_rules.out /usr/local/src/apr/build-1/apr_rules.mk /usr/bin/install -c -m 755 apr-config.out /usr/local/src/apr/bin/apr-1-config [root@lnh apr-1.7.0]# cd /usr/local/src/apr/ [root@lnh apr]# ls bin build-1 include lib [root@lnh apr]# cd /etc/ld.so.conf.d/ [root@lnh ld.so.conf.d]# echo /usr/local/src/apr/lib/ >apr.conf [root@lnh ld.so.conf.d]# cd - /usr/local/src/apr [root@lnh apr]# ldconfig [root@lnh apr]# ln -s /usr/local/src/apr/include/ /usr/include/apr [root@lnh apr]# ll /usr/include/apr/ total 4 drwxr-xr-x. 2 root root 4096 Jul 12 20:18 apr-1 lrwxrwxrwx. 1 root root 27 Jul 12 20:44 include -> /usr/local/src/apr/include/
我们需要将头文件软链接到/usr/include目录下
1.3 apr-util安装
安装
[root@lnh xbz]# dnf -y install expat-devel libxml2-devel pcre-devel [root@lnh xbz]# ls apr-1.7.0 apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.54.tar.gz [root@lnh xbz]# tar -xf apr-util-1.6.1.tar.gz [root@lnh xbz]# ls apr-1.7.0 apr-util-1.6.1 httpd-2.4.54.tar.gz apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz [root@lnh xbz]# cd apr-util-1.6.1/ [root@lnh apr-util-1.6.1]# ls aprutil.dep CHANGES include NWGNUmakefile aprutil.dsp CMakeLists.txt ldap README aprutil.dsw config.layout libaprutil.dep README.cmake aprutil.mak configure libaprutil.dsp README.FREETDS apr-util.pc.in configure.in libaprutil.mak redis apr-util.spec crypto libaprutil.rc renames_pending apu-config.in dbd LICENSE strmatch buckets dbm Makefile.in test build docs Makefile.win uri build.conf encoding memcache xlate buildconf export_vars.sh.in misc xml build-outputs.mk hooks NOTICE [root@lnh apr-util-1.6.1]# ./configure --prefix=/usr/local/src/apr-util --with-apr=/usr/local/src/apr ... configure: creating ./config.status config.status: creating Makefile config.status: creating export_vars.sh config.status: creating build/pkg/pkginfo config.status: creating apr-util.pc config.status: creating apu-1-config config.status: creating include/private/apu_select_dbm.h config.status: creating include/apr_ldap.h config.status: creating include/apu.h config.status: creating include/apu_want.h config.status: creating test/Makefile config.status: creating include/private/apu_config.h config.status: executing default commands [root@lnh apr-util-1.6.1]# make ... gcc -E -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/root/xbz/apr-util-1.6.1/include -I/root/xbz/apr-util-1.6.1/include/private -I/usr/local/src/apr/include/apr-1 exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$/\1/' >> aprutil.exp gcc -E -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/root/xbz/apr-util-1.6.1/include -I/root/xbz/apr-util-1.6.1/include/private -I/usr/local/src/apr/include/apr-1 export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$/d' >> aprutil.exp sed 's,^\(location=\).*$,\1installed,' < apu-1-config > apu-config.out make[1]: Leaving directory '/root/xbz/apr-util-1.6.1' [root@lnh apr-util-1.6.1]# make install ... See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- /usr/bin/install -c -m 644 aprutil.exp /usr/local/src/apr-util/lib /usr/bin/install -c -m 755 apu-config.out /usr/local/src/apr-util/bin/apu-1-config [root@lnh apr-util-1.6.1]# cd /usr/local/src/apr-util/ [root@lnh apr-util]# ls bin include lib [root@lnh apr-util]# cd /etc/ld.so.conf.d/ [root@lnh ld.so.conf.d]# echo /usr/local/src/apr-util/ >apr-util.conf [root@lnh ld.so.conf.d]# cd - /usr/local/src/apr-util [root@lnh apr-util]# ln -s /usr/local/src/apr-util/include/ /usr/include/apr -util
1.4 httpd安装
安装
[root@lnh xbz]# tar -xf httpd-2.4.54.tar.gz [root@lnh xbz]# ls apr-1.7.0 apr-util-1.6.1 httpd-2.4.54 apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.54.tar.gz [root@lnh xbz]# cd httpd-2.4.54/ [root@lnh httpd-2.4.54]# ls ABOUT_APACHE CMakeLists.txt InstallBin.dsp README acinclude.m4 config.layout LAYOUT README.CHANGES Apache-apr2.dsw configure libhttpd.dep README.cmake Apache.dsw configure.in libhttpd.dsp README.platforms apache_probes.d docs libhttpd.mak ROADMAP ap.d emacs-style LICENSE server build httpd.dep Makefile.in srclib BuildAll.dsp httpd.dsp Makefile.win support BuildBin.dsp httpd.mak modules test buildconf httpd.spec NOTICE VERSIONING CHANGES include NWGNUmakefile changes-entries INSTALL os [root@lnh httpd-2.4.54]# ./configure --prefix=/usr/local/src/httpd --with-apr=/usr/local/src/apr --with-apr-util=/usr/local/src/apr-util ... 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.54 Install prefix: /usr/local/src/httpd C compiler: gcc CFLAGS: -g -O2 -pthread CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE LDFLAGS: LIBS: C preprocessor: gcc -E [root@lnh httpd-2.4.54]# make ... /usr/local/src/apr/build-1/libtool --silent --mode=link gcc -g -O2 -pthread -o mod_rewrite.la -rpath /usr/local/src/httpd/modules -module -avoid-version mod_rewrite.lo make[4]: Leaving directory '/root/xbz/httpd-2.4.54/modules/mappers' make[3]: Leaving directory '/root/xbz/httpd-2.4.54/modules/mappers' make[2]: Leaving directory '/root/xbz/httpd-2.4.54/modules' make[2]: Entering directory '/root/xbz/httpd-2.4.54/support' make[2]: Leaving directory '/root/xbz/httpd-2.4.54/support' make[1]: Leaving directory '/root/xbz/httpd-2.4.54' [root@lnh httpd-2.4.54]# make install ... Installing man pages and online manual mkdir /usr/local/src/httpd/man mkdir /usr/local/src/httpd/man/man1 mkdir /usr/local/src/httpd/man/man8 mkdir /usr/local/src/httpd/manual make[1]: Leaving directory '/root/xbz/httpd-2.4.54' [root@lnh httpd-2.4.54]# cd /usr/local/src/httpd/ [root@lnh httpd]# ls bin cgi-bin error icons logs manual build conf htdocs include man modules [root@lnh httpd]# ln -s /usr/local/src/httpd/include/ /usr/include/httpd [root@lnh httpd]# ll /usr/include/httpd lrwxrwxrwx. 1 root root 29 Jul 12 21:23 /usr/include/httpd -> /usr/local/src/httpd/include/ [root@lnh httpd]# echo "export PATH=$PATH:/usr/local/src/httpd/bin" > /etc/profile.d/httpd.sh [root@lnh httpd]# source /etc/profile.d/httpd.sh [root@lnh httpd]# which httpd /usr/local/src/httpd/bin/httpd [root@lnh httpd]# vim /etc/man_db.conf MANDATORY_MANPATH /usr/man MANDATORY_MANPATH /usr/share/man MANDATORY_MANPATH /usr/local/share/man MANDATORY_MANPATH /usr/local/src/httpd/man [root@lnh ~]# httpd AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:fe57:f6f5%ens33. Set the 'ServerName' directive globally to suppress this message httpd (pid 35719) already running [root@lnh ~]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 *:80 *:* LISTEN 0 128 [::]:22 [::]:* [root@lnh ~]# systemctl stop firewalld.service
最后,我们的服务80端口是这个样子的
1.5 处理信息报错的源码编译
结果
checking for APR... no configure: error: APR not found. Please read the documentation. [root@lnh xbz]# wget https://mirrors.aliyun.com/apache/apr/apr-1.7.0.tar.gz [root@lnh xbz]# wget https://mirrors.aliyun.com/apache/apr/apr-util-1.6.1.tar.gz [root@lnh xbz]# dnf -y install gcc gcc-c++ make wget
二 init程序风格(三种)
SysV⻛格
init(centos5),系统初始化时,借助脚本来实现的,(/etc/inittab)
Upstart风格
init(centos6),方式工作是通过总线形式以接近于并行来进行的,效率较高,配置文件(/etc/inittab,/etc/init/*.conf)
Systemd风格
systemd(centos7),启动速度快,效率高,配置文件(/usr/lib/systemd/system,/etc/systemd/system)
三 init程序三种风格的特点
、
SysV⻛格特点
1. 一个命令一个进程如此一来,系统初始化创建进程、销毁进程慢,工作效率低
2. 服务间存在依赖关系,启动服务需要一定的顺序,前一个服务没启动完后面的服务就无法执行启动过程。
Upstart风格特点
1. 能够实现进程间互相通信
2. 一开始初始化就可以把自己的状态返回给其他进程
Systemd风格特点
1. 启动速度快
2. 自身可以启动服务,本身是一个强大的解释器,启动服务时不需要sh/bash的参与
3. 当第一次去访问时才会真正启动服务
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/127574.html
摘要:但实际安装的还是源码包和二进制包。优点安装简单快捷缺点完全丧失了自定义性总结其实中软件包只有源码包和二进制包两种软件安装包。源码包安装位置安装在指定位置当中,一般是软件名源码包安装的服务,只能用绝对路径进行服务的管理。 一、Linux软件包分类 1.1 源码包 优点: 开源,如果有足够的能力,可以修改源代码; 可以自由选择所需的功能; 软件是编译安装,所以更加适合自己的系统,...
摘要:报文语法格式报文报文请求流程用户请求先到达内核空间的网络协议栈,内核空间通过服务所监听的套接字,可以将用户请求转发给用户空间的服务进程。作为独立的守护进程,侦听一个套接字,接收并响应来自前端程序的请求,即为客户端。 博文参考 http://www.178linux.com/51895 http://www.178linux.com/63734 http://www.178linux.c...
摘要:报文语法格式报文报文请求流程用户请求先到达内核空间的网络协议栈,内核空间通过服务所监听的套接字,可以将用户请求转发给用户空间的服务进程。作为独立的守护进程,侦听一个套接字,接收并响应来自前端程序的请求,即为客户端。 博文参考 http://www.178linux.com/51895 http://www.178linux.com/63734 http://www.178linux.c...
摘要:报文语法格式报文报文请求流程用户请求先到达内核空间的网络协议栈,内核空间通过服务所监听的套接字,可以将用户请求转发给用户空间的服务进程。作为独立的守护进程,侦听一个套接字,接收并响应来自前端程序的请求,即为客户端。 博文参考 http://www.178linux.com/51895 http://www.178linux.com/63734 http://www.178linux.c...
阅读 794·2022-09-27 09:47
阅读 671·2022-09-27 09:28
阅读 1116·2022-09-27 09:16
阅读 542·2022-09-27 08:21
阅读 721·2022-09-27 08:08
阅读 821·2022-09-18 12:33
阅读 551·2022-09-16 08:01
阅读 670·2022-09-15 12:49