linux源码安装httpd及ps

1.源码安装:httpd(httpd依赖于两个软件)
源代码安装步骤:

确认源代码编译环境

需安装支持 C/C++程序语言的 编译器

解包 —— tar

解包、释放出源代码文件

配置 —— ./configure

针对当前系统、软件环境,配置好安装参数

编译 —— make

将源代码文件变为二进制的可执行程序

安装 —— make install

将编译好的程序文件复制到系统中

先通过sftp命令在windows命令上将文件传到linux中

将文件解压缩至指定目录

先创建一个目录(路径为/user/local/sourcesoftware)

 再将文件解压缩至指定目录中

 其他文件同理解压缩

 可查看软件已经解压至指定目录

 执行 ./configure

 可见报错说明缺少C语言编译器,所以需要安装软件

由于本地挂载点是临时的,所以需要重新启用上次的过载点

 通过yum下载软件

[root@good yum.repos.d]# yum install gcc-c++.x86_64 -y
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
上次元数据过期检查:0:00:09 前,执行于 2022年04月16日 星期六 00时34分19秒。
依赖关系解决。
==========================================================================================================
 软件包                      架构               版本                          仓库                   大小
==========================================================================================================
安装:
 gcc-c++                     x86_64             8.3.1-4.5.el8                 AppStream              12 M
安装依赖关系:
 glibc-devel                 x86_64             2.28-72.el8                   BaseOS                1.0 M
 glibc-headers               x86_64             2.28-72.el8                   BaseOS                469 k
 kernel-headers              x86_64             4.18.0-147.el8                BaseOS                2.7 M
 libxcrypt-devel             x86_64             4.1.1-4.el8                   BaseOS                 25 k
 cpp                         x86_64             8.3.1-4.5.el8                 AppStream              10 M
 gcc                         x86_64             8.3.1-4.5.el8                 AppStream              23 M
 isl                         x86_64             0.16.1-6.el8                  AppStream             841 k
 libstdc++-devel             x86_64             8.3.1-4.5.el8                 AppStream             2.0 M
 
事务概要
==========================================================================================================
安装  9 软件包
 
总计:53 M
安装大小:140 M
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                           1/1 
  安装    : libstdc++-devel-8.3.1-4.5.el8.x86_64                                                      1/9 
  安装    : isl-0.16.1-6.el8.x86_64                                                                   2/9 
  运行脚本: isl-0.16.1-6.el8.x86_64                                                                   2/9 
  安装    : cpp-8.3.1-4.5.el8.x86_64                                                                  3/9 
  运行脚本: cpp-8.3.1-4.5.el8.x86_64                                                                  3/9 
  安装    : kernel-headers-4.18.0-147.el8.x86_64                                                      4/9 
  运行脚本: glibc-headers-2.28-72.el8.x86_64                                                          5/9 
  安装    : glibc-headers-2.28-72.el8.x86_64                                                          5/9 
  安装    : libxcrypt-devel-4.1.1-4.el8.x86_64                                                        6/9 
  安装    : glibc-devel-2.28-72.el8.x86_64                                                            7/9 
  运行脚本: glibc-devel-2.28-72.el8.x86_64                                                            7/9 
  安装    : gcc-8.3.1-4.5.el8.x86_64                                                                  8/9 
  运行脚本: gcc-8.3.1-4.5.el8.x86_64                                                                  8/9 
  安装    : gcc-c++-8.3.1-4.5.el8.x86_64                                                              9/9 
  运行脚本: gcc-c++-8.3.1-4.5.el8.x86_64                                                              9/9 
  验证    : glibc-devel-2.28-72.el8.x86_64                                                            1/9 
  验证    : glibc-headers-2.28-72.el8.x86_64                                                          2/9 
  验证    : kernel-headers-4.18.0-147.el8.x86_64                                                      3/9 
  验证    : libxcrypt-devel-4.1.1-4.el8.x86_64                                                        4/9 
  验证    : cpp-8.3.1-4.5.el8.x86_64                                                                  5/9 
  验证    : gcc-8.3.1-4.5.el8.x86_64                                                                  6/9 
  验证    : gcc-c++-8.3.1-4.5.el8.x86_64                                                              7/9 
  验证    : isl-0.16.1-6.el8.x86_64                                                                   8/9 
  验证    : libstdc++-devel-8.3.1-4.5.el8.x86_64                                                      9/9 
Installed products updated.
 
已安装:
  gcc-c++-8.3.1-4.5.el8.x86_64                        glibc-devel-2.28-72.el8.x86_64                     
  glibc-headers-2.28-72.el8.x86_64                    kernel-headers-4.18.0-147.el8.x86_64               
  libxcrypt-devel-4.1.1-4.el8.x86_64                  cpp-8.3.1-4.5.el8.x86_64                           
  gcc-8.3.1-4.5.el8.x86_64                            isl-0.16.1-6.el8.x86_64                            
  libstdc++-devel-8.3.1-4.5.el8.x86_64               
 
完毕!
[root@good yum.repos.d]# 
 进行第一个软件的配置


make编译时出现报错执行以下操作

  然后重新执行make

 最后安装软件 

 安装第二个软件

因为apr-util依赖于apr所以安装util时需要再加一条命令--with 【apr安装的目录】

[root@good sourcesoftware]# cd apr-util-1.6.1/
[root@good apr-util-1.6.1]# ./configure --prefix=/usr/local/apr --with-apr=/usr/local/apr
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
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
APR-util Version: 1.6.1
checking for chosen layout... apr-util
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
Applying apr-util hints file rules for x86_64-pc-linux-gnu
checking for APR... yes
  setting CPP to "gcc -E"
  adding "-pthread" to CFLAGS
  setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
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 for ldap support...
checking for default DBM... sdbm (default)
checking for pg_config... no
checking libpq-fe.h usability... no
checking libpq-fe.h presence... no
checking for libpq-fe.h... no
checking postgresql/libpq-fe.h usability... no
checking postgresql/libpq-fe.h presence... no
checking for postgresql/libpq-fe.h... no
checking sqlite3.h usability... no
checking sqlite3.h presence... no
checking for sqlite3.h... no
checking sqlite.h usability... no
checking sqlite.h presence... no
checking for sqlite.h... no
checking for odbc_config... no
checking sql.h usability... no
checking sql.h presence... no
checking for sql.h... no
checking odbc/sql.h usability... no
checking odbc/sql.h presence... no
checking for odbc/sql.h... no
checking Expat 1.95.x... no
checking old Debian-packaged expat... no
checking old FreeBSD-packaged expat... no
checking Expat 1.0/1.1... no
  setting LDFLAGS to "-L/usr/local/lib"
  adding "-I/usr/local/include" to CPPFLAGS
checking Expat 1.95.x in /usr/local... no
  nulling LDFLAGS
  removed "-I/usr/local/include" from CPPFLAGS
  setting APRUTIL_EXPORT_LIBS to ""
  setting APRUTIL_LIBS to ""
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking for type of inbuf parameter to iconv... char **
checking for iconv.h... (cached) yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking for nl_langinfo... yes
checking for CODESET in langinfo.h... yes
checking whether APR has DSO support... yes
checking for library containing crypt... -lcrypt
checking if system crypt() function is threadsafe... no
checking for crypt_r... yes
checking style of crypt_r... struct_crypt_data
checking whether the compiler handles weak symbols... yes
checking for memset_s support... no
checking for explicit_bzero support... yes
  setting APRUTIL_LIBS to " /usr/local/apr/lib/libapr-1.la -lrt -lcrypt  -lpthread -ldl"
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
再使用make编译

 可见编译时出现致命错误,所以需要安装expat.软件

 再次编译:成功(没有报错)

然后安装

最终安装httpd软件


 可见缺少pcre软件,使用yum下载

 再下载openssl软件

 再make编译成功后下载

下载完成后启用httpd服务


 

 先停用一下然后再启用,通过ps命令查到httpd服务已经启用 

 2.查看root用户带有终端的进程


 显示没有终端的进程
  显示所有进程


 ps -aux和ps aux的区别 
POSIX 和 UNIX 标准
       要求“ps -aux”打印名为“x”的用户拥有的所有进程,以及作为打印将由 -a 选项选择的所有进程。 如果名为“x”的用户不存在,此ps可能会将命令解释为“ps aux”而是打印警告。 此行为旨在帮助转换旧的脚本和习惯。 它是脆弱的,可能会发生变化,并且因此,不应依赖。


查找正在运行的sshd进程


执行sleep 300 &,查看这个后台进程,并杀死它(使用%id)


 执行sleep 300 & , 将这个后台进程变成前台进程 

 
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装 Apache HTTP Server (httpd) 可以使用系统的软件包管理器,也可以从源代码编译安装。本文将介绍从源代码编译安装 Apache HTTP Server。 1. 下载 Apache HTTP Server 源代码 到 Apache HTTP Server 官网下载最新版本的源代码,下载地址为:https://httpd.apache.org/download.cgi。 例如,下载最新版的 Apache HTTP Server 2.4.41: ``` $ wget https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.41.tar.gz ``` 2. 解压源代码 解压下载的源代码包: ``` $ tar xvzf httpd-2.4.41.tar.gz ``` 进入解压后的目录: ``` $ cd httpd-2.4.41 ``` 3. 配置编译选项 使用 configure 脚本配置编译选项: ``` $ ./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --with-ssl=/usr/local/openssl ``` 其中,--prefix 指定安装目录,--enable-so 表示启用模块支持,--enable-ssl 启用 SSL 支持,--with-ssl 指定 OpenSSL 的安装路径。 4. 编译并安装 编译源代码: ``` $ make ``` 安装 Apache HTTP Server: ``` $ sudo make install ``` 5. 启动 Apache HTTP Server 进入 Apache HTTP Server 安装目录: ``` $ cd /usr/local/apache2 ``` 启动 Apache HTTP Server: ``` $ sudo ./bin/apachectl start ``` 打开浏览器,访问 http://localhost/,如果能够看到 "It works!" 的页面,则说明 Apache HTTP Server 安装成功。 6. 配置 Apache HTTP Server Apache HTTP Server 的主要配置文件为 conf/httpd.conf。可以通过编辑该文件来配置 Apache HTTP Server。 例如,修改监听端口: ``` $ sudo vi conf/httpd.conf ``` 将以下行: ``` Listen 80 ``` 修改为: ``` Listen 8080 ``` 保存并退出编辑器。重新启动 Apache HTTP Server: ``` $ sudo ./bin/apachectl restart ``` 现在,Apache HTTP Server 会监听 8080 端口。 以上就是从源代码编译安装 Apache HTTP Server 的步骤。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值