Linux中源代码安装及ps命令

编程知识 更新时间:2023-05-02 06:38:32

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 & , 将这个后台进程变成前台进程 

 

更多推荐

Linux中源代码安装及ps命令

本文发布于:2023-04-26 08:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/172c26ab6846b40ce83d617bb50acbff.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:源代码   命令   Linux   ps

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 104831文章数
  • 26286阅读数
  • 0评论数