目录
1.RPM管理工具
使用rpm安装zsh(忽略依赖关系安装)
该软件没有依赖软件,我们可以不使用--nodeps不验证软件包依赖。如果使用rpm安装的软件,需要安装依赖软件的话,我们可以使用--nodeps。
[root@ls_Ok74kJfe ~]# ls -l zsh*
-rw-r--r-- 1 root root 3035888 Jul 21 08:57 zsh-5.5.1-9.el8.x86_64.rpm
[root@ls_Ok74kJfe ~]# rpm -ivh zsh-5.5.1-9.el8.x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:zsh-5.5.1-9.el8 ################################# [100%]
查询是否已安装
[root@ls_Ok74kJfe ~]# rpm -qa zsh
zsh-5.5.1-9.el8.x86_64
卸载zsh
[root@ls_Ok74kJfe ~]# rpm -e zsh
查询所有已安装软件
[root@ls_Ok74kJfe ~]# rpm -qa #-a查询所有已安装的软件包必须要与-q搭配使用
查询date命令所在软件包
[root@ls_Ok74kJfe ~]# whereis date
date: /usr/bin/date /usr/share/man/man1/date.1.gz /usr/share/man/man1p/date.1p.gz
[root@ls_Ok74kJfe ~]# rpm -qf /usr/bin/date
coreutils-8.30-6.el8_1.1.x86_64
查询未安装的zsh的文件信息
[root@ls_Ok74kJfe ~]# rpm -ql zsh
package zsh is not installed
2.YUM/DNF管理工具
yum本地源配置
[root@server ~]# mount /dev/cdrom /mnt #本地光盘挂载到本地目录下
[root@server ~]# vim /etc/yum.repos.d/redhat.repo
[root@server ~]# 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
yum网络源配置
[root@server ~]# cd /etc/yum.repos.d
[root@server yum.repos.d]# touch aliyun.repo[root@server yum.repos.d]# vim aliyun.repo
[root@server yum.repos.d]# cat /etc/yum.repos.d/aliyun.repo
[appstream]
name=appstream
baseurl=https://mirrors.aliyun.com/rockylinux/8.5/AppStream/x86_64/os/
gpgcheck=0[baseos]
name=baseos
baseurl=https://mirrors.aliyun.com/rockylinux/8.5/BaseOS/x86_64/os/
gpgcheck=0
在这里我们也可以将已经下载好的centos8.repo这个包上传到Linux下的/etc/yum.repo.d目录内,就不用了我们手工配置yum 网络源。可以直接使用centos已经配置好的软件仓库。
安装httpd软件
[root@ls_Ok74kJfe mnt]# yum install httpd -y
查看vim命令属于哪个软件包
yum卸载httpd
当我们使用yum卸载软件时,我们需要清楚这个软件都依赖于哪些软件,如果依赖的软件包含系统软件的话,我们使用yum卸载时也会把系统软件删掉,有时候会导致我们的系统崩溃,所以对于yum卸载软件,我们需要慎用。
[root@server ~]# yum remove httpd -y #在卸载过程中遇到的所有交互都默认回答yes
清理缓存
[root@server ~]# yum clean all
重新创建缓存
[root@server ~]# yum makecache
安装postgresql模块中的版本13
安装的 两种 方法:
[root@ls_Ok74kJfe mnt]# yum install @postgresql:13 -y
[root@ls_Ok74kJfe mnt]# yum module install postgresql:13 -y
3.源代码安装
要求:安装httpd
#下载三个(一个目标软件,两个依赖软件)源码包,然后上传到Linux端,进行解压
#解压目标软件
[root@server software]# tar -xvzf httpd-2.4.54.tar.ga -C /usr/local/software
#解压两个依赖软件
[root@server ~]# tar -xzvf "apr-1.6.5.tar.gz" -C /usr/local/software/
[root@server ~]# tar -xzvf "apr-util-1.6.1.tar.gz" -C /usr/local/software/
[root@server software]# yum install gcc gcc-c++ libgcc -y #安装编译环境
#安装apr-1.6.5
[root@server software]# cd apr-1.6.5/
[root@server apr-1.6.5]# ./configure --prefix=/usr/local/apr[root@server apr-1.6.5]# make
[root@server apr-1.6.5]# make install
#安装apr-util-1.6.1[root@server software]# cd apr-util-1.6.1/
[root@server apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-until --with-apr=/usr/local/apr
[root@server apr-util-1.6.1]# yum install expat-devel -y[root@server apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-until --with-apr=/usr/local/apr
[root@server apr-util-1.6.1]# make[root@server apr-util-1.6.1]# make install
#安装httpd-2.4.54
[root@server software]# cd httpd-2.4.54/
[root@server httpd-2.4.54]# ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-until
[root@server httpd-2.4.54]# yum install pcre2-devel -y
[root@server httpd-2.4.54]# ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-until
[root@server httpd-2.4.54]# make
[root@server httpd-2.4.54]# make install
[root@server bin]# ./apachectl start
在安装过程中,如果所有依赖软件都安装好,还是安装有问题的话,建议从头开始多试几遍(配置编译环境,编译,安装)。
基本上就可以完成啦!!!!
4.进程管理,查看进程
ps命令查看进程
查看root用户带有终端的进程
[root@server ~]# ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 0 6893 6892 0 80 0 - 6955 - pts/0 00:00:00 bash
0 R 0 37569 6893 0 80 0 - 11370 - pts/0 00:00:00 ps
显示没有终端的进程
[root@server ~]# ps -x
PID TTY STAT TIME COMMAND
1 ? Ss 0:03 /usr/lib/systemd/systemd --switched-root --system --deserialize 17
2 ? S 0:00 [kthreadd]
3 ? I< 0:00 [rcu_gp]...
显示所有进程
[root@server ~]# ps -e
PID TTY TIME CMD
1 ? 00:00:03 systemd
2 ? 00:00:00 kthreadd
3 ? 00:00:00 rcu_gp
4 ? 00:00:00 rcu_par_gp...
top 命令查看进程
查看1分钟内占用CPU时间前10的进程(使用top命令)
[root@server ~]# top -d60 #设置进程更新的时间是60秒,然后查看进程。top执行过程中使 用T命令,可按照时间/累计时间排序输出