Linux的基础(源码配置)

1.源码安装: httpd

通过sftp将文件传到Linux根目录(httpd依赖于前两个软件) 将文件解压缩至指定目录下

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

[root@bogon ~]# mount /dev/cdrom /media/cdrom
mount: /media/cdrom: WARNING: device write-protected, mounted read-only.

然后通过yum下载C语言的编译环境 

[root@bogon ~]# cd /usr/local/
[root@bogon local]# ls 
bin  etc  games  include  lib  lib64  libexec  sbin  share  sourcesoftware  src
[root@bogon local]# cd sourcesoftware/
[root@bogon sourcesoftware]# ls 
apr-1.6.5  apr-util-1.6.1  httpd-2.4.53
[root@bogon sourcesoftware]# cd apr-1.6.5/
[root@bogon apr-1.6.5]# yum install gcc-c++ -y
正在更新 Subscription Management 软件仓库。
无法读取客户身份
 
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
 
Repository AppStream is listed more than once in the configuration
上次元数据过期检查:0:04:39 前,执行于 2022年04月14日 星期四 12时05分10秒。
依赖关系解决。
============================================================================================================================================================================================
 软件包                                         架构                                  版本                                                   仓库                                      大小
============================================================================================================================================================================================
安装:
 gcc-c++                                        x86_64                                8.5.0-4.el8_5                                          AppStream                                 12 M
升级:
 libgcc                                         x86_64                                8.5.0-4.el8_5                                          base                                      79 k
 libgomp                                        x86_64                                8.5.0-4.el8_5                                          base                                     206 k
 libstdc++                                      x86_64                                8.5.0-4.el8_5                                          base                                     453 k
安装依赖关系:
 cpp                                            x86_64                                8.5.0-4.el8_5                                          AppStream                                 10 M
 gcc                                            x86_64                                8.5.0-4.el8_5                                          AppStream                                 23 M
 glibc-devel                                    x86_64                                2.28-164.el8                                           base                                     1.0 M
 glibc-headers                                  x86_64                                2.28-164.el8                                           base                                     480 k
 isl                                            x86_64                                0.16.1-6.el8                                           AppStream                                841 k
 kernel-headers                                 x86_64                                4.18.0-348.7.1.el8_5                                   base                                     8.3 M
 libstdc++-devel                                x86_64                                8.5.0-4.el8_5                                          AppStream                                2.0 M
 libxcrypt-devel                                x86_64                                4.1.1-6.el8                                            base                                      25 k
 
事务概要
============================================================================================================================================================================================
安装  9 软件包
升级  3 软件包
 
总下载:59 M
下载软件包:
(1/12): glibc-headers-2.28-164.el8.x86_64.rpm                                                                                                               267 kB/s | 480 kB     00:01    
(2/12): libxcrypt-devel-4.1.1-6.el8.x86_64.rpm                                                                                                              122 kB/s |  25 kB     00:00    
(3/12): glibc-devel-2.28-164.el8.x86_64.rpm                                                                                                                 254 kB/s | 1.0 MB     00:04    
(4/12): kernel-headers-4.18.0-348.7.1.el8_5.x86_64.rpm                                                                                                      270 kB/s | 8.3 MB     00:31    
(5/12): cpp-8.5.0-4.el8_5.x86_64.rpm                                                                                                                        272 kB/s |  10 MB     00:39    
(6/12): isl-0.16.1-6.el8.x86_64.rpm                                                                                                                         267 kB/s | 841 kB     00:03    
(7/12): libstdc++-devel-8.5.0-4.el8_5.x86_64.rpm                                                                                                            274 kB/s | 2.0 MB     00:07    
(8/12): libgcc-8.5.0-4.el8_5.x86_64.rpm                                                                                                                     208 kB/s |  79 kB     00:00    
(9/12): libgomp-8.5.0-4.el8_5.x86_64.rpm                                                                                                                    228 kB/s | 206 kB     00:00    
(10/12): libstdc++-8.5.0-4.el8_5.x86_64.rpm                                                                                                                 259 kB/s | 453 kB     00:01    
(11/12): gcc-c++-8.5.0-4.el8_5.x86_64.rpm                                                                                                                   263 kB/s |  12 MB     00:47    
(12/12): gcc-8.5.0-4.el8_5.x86_64.rpm                                                                                                                       257 kB/s |  23 MB     01:33    
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                        624 kB/s |  59 MB     01:37     
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                                                             1/1 
  升级    : libgcc-8.5.0-4.el8_5.x86_64                                                                                                                                                1/15 
  运行脚本: libgcc-8.5.0-4.el8_5.x86_64                                                                                                                                                1/15 
  升级    : libstdc++-8.5.0-4.el8_5.x86_64                                                                                                                                             2/15 
  运行脚本: libstdc++-8.5.0-4.el8_5.x86_64                                                                                                                                             2/15 
  安装    : libstdc++-devel-8.5.0-4.el8_5.x86_64                                                                                                                                       3/15 
  升级    : libgomp-8.5.0-4.el8_5.x86_64                                                                                                                                               4/15 
  运行脚本: libgomp-8.5.0-4.el8_5.x86_64                                                                                                                                               4/15 
  安装    : isl-0.16.1-6.el8.x86_64                                                                                                                                                    5/15 
  运行脚本: isl-0.16.1-6.el8.x86_64                                                                                                                                                    5/15 
  安装    : cpp-8.5.0-4.el8_5.x86_64                                                                                                                                                   6/15 
  运行脚本: cpp-8.5.0-4.el8_5.x86_64                                                                                                                                                   6/15 
  安装    : kernel-headers-4.18.0-348.7.1.el8_5.x86_64                                                                                                                                 7/15 
  运行脚本: glibc-headers-2.28-164.el8.x86_64                                                                                                                                          8/15 
  安装    : glibc-headers-2.28-164.el8.x86_64                                                                                                                                          8/15 
  安装    : libxcrypt-devel-4.1.1-6.el8.x86_64                                                                                                                                         9/15 
  安装    : glibc-devel-2.28-164.el8.x86_64                                                                                                                                           10/15 
  运行脚本: glibc-devel-2.28-164.el8.x86_64                                                                                                                                           10/15 
  安装    : gcc-8.5.0-4.el8_5.x86_64                                                                                                                                                  11/15 
  运行脚本: gcc-8.5.0-4.el8_5.x86_64                                                                                                                                                  11/15 
  安装    : gcc-c++-8.5.0-4.el8_5.x86_64                                                                                                                                              12/15 
  清理    : libstdc++-8.5.0-3.el8.x86_64                                                                                                                                              13/15 
  运行脚本: libstdc++-8.5.0-3.el8.x86_64                                                                                                                                              13/15 
  清理    : libgcc-8.5.0-3.el8.x86_64                                                                                                                                                 14/15 
  运行脚本: libgcc-8.5.0-3.el8.x86_64                                                                                                                                                 14/15 
  运行脚本: libgomp-8.5.0-3.el8.x86_64                                                                                                                                                15/15 
  清理    : libgomp-8.5.0-3.el8.x86_64                                                                                                                                                15/15 
  运行脚本: libgomp-8.5.0-3.el8.x86_64                                                                                                                                                15/15 
  验证    : glibc-devel-2.28-164.el8.x86_64                                                                                                                                            1/15 
  验证    : glibc-headers-2.28-164.el8.x86_64                                                                                                                                          2/15 
  验证    : kernel-headers-4.18.0-348.7.1.el8_5.x86_64                                                                                                                                 3/15 
  验证    : libxcrypt-devel-4.1.1-6.el8.x86_64                                                                                                                                         4/15 
  验证    : cpp-8.5.0-4.el8_5.x86_64                                                                                                                                                   5/15 
  验证    : gcc-8.5.0-4.el8_5.x86_64                                                                                                                                                   6/15 
  验证    : gcc-c++-8.5.0-4.el8_5.x86_64                                                                                                                                               7/15 
  验证    : isl-0.16.1-6.el8.x86_64                                                                                                                                                    8/15 
  验证    : libstdc++-devel-8.5.0-4.el8_5.x86_64                                                                                                                                       9/15 
  验证    : libgcc-8.5.0-4.el8_5.x86_64                                                                                                                                               10/15 
  验证    : libgcc-8.5.0-3.el8.x86_64                                                                                                                                                 11/15 
  验证    : libgomp-8.5.0-4.el8_5.x86_64                                                                                                                                              12/15 
  验证    : libgomp-8.5.0-3.el8.x86_64                                                                                                                                                13/15 
  验证    : libstdc++-8.5.0-4.el8_5.x86_64                                                                                                                                            14/15 
  验证    : libstdc++-8.5.0-3.el8.x86_64                                                                                                                                              15/15 
已更新安装的产品。
 
已升级:
  libgcc-8.5.0-4.el8_5.x86_64                                  libgomp-8.5.0-4.el8_5.x86_64                                  libstdc++-8.5.0-4.el8_5.x86_64                                 
已安装:
  cpp-8.5.0-4.el8_5.x86_64   gcc-8.5.0-4.el8_5.x86_64                     gcc-c++-8.5.0-4.el8_5.x86_64           glibc-devel-2.28-164.el8.x86_64      glibc-headers-2.28-164.el8.x86_64  
  isl-0.16.1-6.el8.x86_64    kernel-headers-4.18.0-348.7.1.el8_5.x86_64   libstdc++-devel-8.5.0-4.el8_5.x86_64   libxcrypt-devel-4.1.1-6.el8.x86_64  
 
完毕!

第一个软件

然后在配置./configure

[root@bogon apr-1.6.5]# ./configure --prefix=/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
Configuring APR library
Platform: x86_64-pc-linux-gnu
checking for working mkdir -p... yes

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

[root@bogon apr-1.6.5]# make
bash: make: 未找到命令...
文件搜索失败: /mnt/cdrom/BaseOS was not found
[root@bogon apr-1.6.5]#  yum groupinstall "Development Tools" -y
正在更新 Subscription Management 软件仓库。
无法读取客户身份
 
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
 
Repository AppStream is listed more than once in the configuration
上次元数据过期检查:0:12:24 前,执行于 2022年04月14日 星期四 12时05分10秒。
依赖关系解决。

安装软件

[root@bogon apr-1.6.5]# make install 
/usr/local/sourcesoftware/apr-1.6.5/build/mkdir.sh tools
/bin/sh /usr/local/sourcesoftware/apr-1.6.5/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I./include -I/usr/local/sourcesoftware/apr-1.6.5/include/arch/unix -I./include/arch/unix -I/usr/local/sourcesoftware/apr-1.6.5/include/arch/unix -I/usr/local/sourcesoftware/apr-1.6.5/include -I/usr/local/sourcesoftware/apr-1.6.5/include/private -I/usr/local/sourcesoftware/apr-1.6.5/include/private  -o tools/gen_test_char.lo -c tools/gen_test_char.c && touch tools/gen_test_char.lo

 第二个软件(与上述操作一样)

[root@bogon sourcesoftware]# cd apr-util-1.6.1/
[root@bogon apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --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

make编译时出现了致命错误,因为少一个expat.软件 

[root@bogon apr-util-1.6.1]# make
make[1]: 进入目录“/usr/local/sourcesoftware/apr-util-1.6.1”
/bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread   -
/bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/usr/local/sourcesoftware/apr-util-1.6.1/include -I/usr/local/sourcesoftware/apr-util-1.6.1/include/private  -I/usr/local/apr/include/apr-1    -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo
xml/apr_xml.c:35:10: 致命错误:expat.h:没有那个文件或目录
 #include <expat.h>
          ^~~~~~~~~
编译中断。
make[1]: *** [/usr/local/sourcesoftware/apr-util-1.6.1/build/rules.mk:206:xml/apr_xml.lo] 错误 1
make[1]: 离开目录“/usr/local/sourcesoftware/apr-util-1.6.1”

先清除掉上次编译错误的结果,然后重新编译会发现编译成功  

[root@bogon apr-util-1.6.1]# make clean
Making clean in test
make[1]: 进入目录“/usr/local/sourcesoftware/apr-util-1.6.1/test”
make[2]: 进入目录“/usr/local/sourcesoftware/apr-util-1.6.1/test”
rm -f ./*.o ./*.lo ./*.a ./*.la ./*.so ./*.obj
 
 
[root@bogon apr-util-1.6.1]# make install
make[1]: 进入目录“/usr/local/sourcesoftware/apr-util-1.6.1”
make[1]: 对“local-all”无需做任何事。
make[1]: 离开目录“/usr/local/sourcesoftware/apr-util-1.6.1”

第三个配置

[root@bogon httpd-2.4.53]# ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
[root@bogon httpd-2.4.53]# yum install pcre2-devel -y
正在更新 Subscription Management 软件仓库。
无法读取客户身份
 
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
 
Repository AppStream is listed more than once in the configuration
上次元数据过期检查:0:35:35 前,执行于 2022年04月14日 星期四 12时05分10秒。
依赖关系解决。
[root@bogon httpd-2.4.53]# yum install openssl-devel -y
正在更新 Subscription Management 软件仓库。
无法读取客户身份
 
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
 
Repository AppStream is listed more than once in the configuration
上次元数据过期检查:0:36:30 前,执行于 2022年04月14日 星期四 12时05分10秒。
依赖关系解决。
[root@bogon bin]# cd ..
[root@bogon httpd]# cd conf
[root@bogon conf]# vim httpd.conf 
[root@bogon conf]# cd ..
[root@bogon httpd]# cd bin/
[root@bogon bin]# ./apachectl stop
[root@bogon bin]# ./apachectl start
[root@bogon bin]# ps -ef |grep httpd
root       83538       1  0 13:21 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon     83539   83538  0 13:21 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon     83540   83538  0 13:21 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon     83541   83538  0 13:21 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
root       83640    2084  0 13:22 pts/0    00:00:00 grep --color=auto httpd

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

[root@bogon ~]# ps -ue
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root        2084  0.0  0.2  28308  4760 pts/0    Ss   11:53   0:00 -bash USER=root LOGNAME=root HOME=/root PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin SHELL=/bin/bash TERM=xterm
root       83734  0.0  0.2  61872  4012 pts/0    R+   13:31   0:00 ps -ue LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;

显示没有终端的进程

[root@bogon ~]# ps -aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.7 241500 14268 ?        Ss   11:53   0:02 /usr/lib/systemd/systemd --switched-root --system --deserialize 18
root           2  0.0  0.0      0     0 ?        S    11:53   0:00 [kthreadd]
root           3  0.0  0.0      0     0 ?        I<   11:53   0:00 [rcu_gp]
root           4  0.0  0.0      0     0 ?        I<   11:53   0:00 [rcu_par_gp]
root           6  0.0  0.0      0     0 ?        I<   11:53   0:00 [kworker/0:0H-events_highpri]
root           9  0.0  0.0      0     0 ?        I<   11:53   0:00 [mm_percpu_wq]

显示所有进程

[root@bogon ~]# ps -le
F S   UID     PID    PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S     0       1       0  0  80   0 - 60375 do_epo ?        00:00:02 systemd
1 S     0       2       0  0  80   0 -     0 -      ?        00:00:00 kthreadd
1 I     0       3       2  0  60 -20 -     0 -      ?        00:00:00 rcu_gp
1 I     0       4       2  0  60 -20 -     0 -      ?        00:00:00 rcu_par_gp
1 I     0       6       2  0  60 -20 -     0 -      ?        00:00:00 kworker/0:0H-events_highpri
1 I     0       9       2  0  60 -20 -     0 -      ?        00:00:00 mm_percpu_wq

ps -aux和ps aux的区别

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

查找正在运行的sshd进程

[root@bogon ~]# ps -le|grep sshd
4 S     0    1213       1  0  80   0 - 23087 core_s ?        00:00:00 sshd
4 S     0    1890    1213  0  80   0 - 40947 x64_sy ?        00:00:00 sshd
5 S     0    2083    1890  0  80   0 - 40947 core_s ?        00:00:03 sshd

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

[root@bogon ~]# sleep 300 &
[1] 83774
[root@bogon ~]# jobs 1
[1]+  运行中               sleep 300 &

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

[root@bogon ~]# fg %1
sleep 300

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值