一、使用rpm安装zsh(忽略依赖关系安装)
该软件没有依赖软件,我们可以不使用–nodeps不验证软件包依赖。如果使用rpm安装的软件,需要安装依赖软件的话,我们可以使用–nodeps。
[root@localhost ~]# ls -l zsh*
-rw-r–r–. 1 root root 3035888 Jul 22 10:52 zsh-5.5.1-9.el8.x86_64.rpm
-rw-r–r–. 1 root root 0 Jul 21 23:17 zshfile
[root@localhost ~]# rpm -ivh zsh-5.5.1-9.el8.x86_64.rpm
warning: zsh-5.5.1-9.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
Verifying… ################################# [100%]
Preparing… ################################# [100%]
Updating / installing…
1:zsh-5.5.1-9.el8 ################################# [100%]
查询是否已安装
[root@localhost ~]# rpm -qa|grep zsh
zsh-5.5.1-9.el8.x86_64
卸载zsh
[root@localhost ~]# rpm -e zsh-5.5.1-9.el8.x86_64
查询所有已安装软件
[root@localhost ~]# rpm -qa #-a查询所有已安装的软件包必须要与-q搭配使用
查询date命令所在软件包
[root@localhost ~]# whereis date
date: /usr/bin/date /usr/share/man/man1/date.1.gz /usr/share/man/man1p/date.1p.gz
[root@localhost ~]# rpm -qf /usr/bin/date
coreutils-8.30-12.el8.x86_64
查询未安装的zsh的文件信息
[root@localhost ~]# rpm -ql zsh
package zsh is not installed
二、yum/dnf管理工具
1.yum本地源配置
[root@localhost ~]# mount /dev/cdrom /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
[root@localhost ~]# vim /etc/yum.repos.d/redhat.repo
[root@localhost ~]# cat /etc/yum.repos.d/redhat.repo
#
#Certificate-Based Repositories
#Managed by (rhsm) subscription-manager
#
#This file is auto-generated. Changes made here will be over-written.
#Use “subscription-manager repo-override --help” if you wish to make changes.
#
#If this file is empty and this system is subscribed consider
#a “yum repolist” to refresh available repos
#
[BaseOS]
name=BaseOS
baseurl=file:///mnt/BaseOS
gpgcheck=0[AppStream]
name=AppStream
baseurl=file:///mnt/AppStream
gpgcheck=0
2.yum网络源配置
阿里云网络源, aliyun 的镜像站点为https://mirrors.aliyun.com/
[root@localhost Packages]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls -l
total 4
-rw-r–r–. 1 root root 0 Jul 22 11:14 aliyun.repo
-rw-r–r–. 1 root root 358 Jul 22 11:07 redhat.repo
[root@localhost yum.repos.d]# vim redhat.repo
[root@localhost yum.repos.d]# yum repolist
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
repo id repo name
AppStream AppStream
BaseOS BaseOS
3.安装httpd软件
[root@localhost yum.repos.d]# yum install httpd -y
4.查看vim命令属于哪个软件包
5.yum卸载httpd
[root@localhost yum.repos.d]# yum remove httpd -y
6.清理缓存
[root@localhost yum.repos.d]# yum clean all
7.重新创建缓存
[root@localhost yum.repos.d]# yum makecache
8.安装postgresql模块中的版本13
[root@localhost yum.repos.d]# yum install @postgresql:13 -y
三、源码安装httpd
解压目标软件
[root@localhost yum.repos.d]# tar -xvzf httpd-2.4.54.tar.ga -C /usr/local/software
解压两个依赖软件
[root@localhost yum.repos.d]# tar -xzvf"apr-1.6.5.tar.gz"-C /usr/local/software/
[root@localhost yum.repos.d]# tar -xzvf"apr-util-1.6.1.tar.gz"-C /usr/local/software
[root@localhost yum.repos.d]# yum install gcc gcc-c++ libgcc -y #安装编译环境
安装apr-1.6.5
[root@localhost yum.repos.d]# cd apr-1.6.5/
[root@localhost apr-1.6.5]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.6.5]# make
[root@localhost apr-1.6.5]# make install
安装apr-util-1.6.1
[root@localhost software]# cd apr-util-1.6.1/
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-until --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# yum install expat-devel -y
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-until --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# make
[root@localhost apr-util-1.6.1]# make install
安装httpd-2.4.54
[root@localhost software]# cd httpd-2.4.54/
[root@localhost httpd-2.4.54]# ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-until
[root@localhost httpd-2.4.54]# yum install pcre2-devel -y
[root@localhost httpd-2.4.54]# ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-until
[root@localhost httpd-2.4.54]# make
[root@localhost httpd-2.4.54]# make install
[root@localhost bin]# ./apachectl start
四、查看root用户带有终端的进程
ps命令查看进程
1.显示没有终端的进程
[root@localhost yum.repos.d]# ps -x
PID TTY STAT TIME COMMAND
1 ? Ss 0:02 /usr/lib/systemd/systemd --switched-r
2 ? S 0:00 [kthreadd]
3 ? I< 0:00 [rcu_gp]
4 ? I< 0:00 [rcu_par_gp]
…
2.显示所有进程
[root@localhost yum.repos.d]# ps -e
PID TTY TIME CMD
1 ? 00:00:02 systemd
2 ? 00:00:00 kthreadd
3 ? 00:00:00 rcu_gp
4 ? 00:00:00 rcu_par_gp
…
3.查看root用户带有终端的进程
[root@localhost yum.repos.d]# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 0 37899 37898 0 80 0 - 6889 - pts/0 00:00:00 bash
0 R 0 41453 37899 0 80 0 - 11370 - pts/0 00:00:00 ps
4.查看1分钟内占用CPU时间前10的进程(使用top命令)
[root@localhost yum.repos.d]# top -d60 #设置进程更新的时间是60秒,然后查看进程。top执行过程中使 用T命令,可按照时间/累计时间排序输出