RPM软件管理
1.通过rpm安装vsftpd软件
[root@localhost ~]# wget http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/vsftpd-3.0.2-28.el7.x86_64.rpm
--2023-03-29 00:36:50-- http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/vsftpd-3.0.2-28.el7.x86_64.rpm
Resolving rpmfind.net (rpmfind.net)... 195.220.108.108
Connecting to rpmfind.net (rpmfind.net)|195.220.108.108|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 175944 (172K) [application/x-rpm]
Saving to: ‘vsftpd-3.0.2-28.el7.x86_64.rpm’
vsftpd-3.0.2-28.el7.x86_6 100%[===================================>] 171.82K 212KB/s in 0.8s
2023-03-29 00:36:51 (212 KB/s) - ‘vsftpd-3.0.2-28.el7.x86_64.rpm’ saved [175944/175944]
[root@localhost ~]# rpm -ivh vsftpd-3.0.2-28.el7.x86_64.rpm
2.查询vsftpd软件包的信息
[root@localhost ~]# rpm -qi vsftpd
3.卸载软件包vsftpd
[root@localhost ~]# rpm -evh vsftpd
YUM软件管理
1.挂载本地光盘,配置yum源为rhel.repo
[root@localhost ~]# mount /dev/sr0 /mnt
mount: /mnt: /dev/sr0 already mounted on /run/media/h/RHEL-9-1-0-BaseOS-x86_64.
[root@localhost ~]# mkdir /test/cdrom
[root@localhost ~]# mount dev/sr0 /test/cdrom
mount: /test/cdrom: special device dev/sr0 does not exist.
[root@localhost ~]# cd /test/cdrom
[root@localhost cdrom]# ll
total 0
[root@localhost cdrom]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# touch rhel.repo
[root@localhost yum.repos.d]# vim rhel.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- rhel9
baseos baseos- rhel9
[root@localhost ~]# yum install bind-utils -y
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.
Last metadata expiration check: 0:05:06 ago on Wed 29 Mar 2023 01:02:08 AM CST.
Package bind-utils-32:9.16.23-5.el9_1.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
2.通过yum来安装traceroute
[root@localhost ~]# cat /etc/yum.repos.d/aliyun.repo
cat: /etc/yum.repos.d/aliyun.repo: No such file or directory
3.使用yum查询ifconfig命令是由哪个软件包提供的
[root@localhost ~]# yum provides ifconfig
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.
Last metadata expiration check: 0:08:51 ago on Wed 29 Mar 2023 01:02:08 AM CST.
net-tools-2.0-0.62.20160912git.el9.x86_64 : Basic networking tools
Repo : @System
Matched from:
Filename : /usr/sbin/ifconfig
net-tools-2.0-0.62.20160912git.el9.x86_64 : Basic networking tools
Repo : baseos
Matched from:
Filename : /usr/sbin/ifconfig
4.卸载软件包httpd
[root@localhost ~]# yum remove http
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.
No match for argument: http
No packages marked for removal.
Dependencies resolved.
Nothing to do.
Complete!
通过pgrep和pidof命令查看sshd服务的进程号
[root@localhost ~]# pgrep sshd
1056
2815
2851
3030
3035
[root@localhost ~]# pidof sshd
3035 3030 2851 2815 1056
配置网络:为网卡添加一个本网段IPV4地址,x.x.x.123,并启用,然后在阿里镜像站GNU里下载wget2的包
[h@localhost ~]$ nmcli connection modify ens160 ipv4.method manual ipv4.addresses 192.168.216.123/24 ipv4.gateway 192.168.216.2 ipv4.dns 114.114.114.114 autoconnect yes
[h@localhost ~]$ nmcli c up ens160
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
[root@localhost ~]# mkdir /test
[root@localhost ~]# cd /test/
[root@localhost test]# ls
[root@localhost test]# wget https://mirrors.aliyun.com/gnu/wget/wget2-latest.tar.gz
--2023-03-28 23:56:14-- https://mirrors.aliyun.com/gnu/wget/wget2-latest.tar.gz
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 218.94.206.189, 218.94.206.184, 221.229.202.89, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|218.94.206.189|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3780748 (3.6M) [application/octet-stream]
Saving to: ‘wget2-latest.tar.gz’
wget2-latest.tar.gz 100%[==================================>] 3.61M 4.02MB/s in 0.9s
2023-03-28 23:56:15 (4.02 MB/s) - ‘wget2-latest.tar.gz’ saved [3780748/3780748]