返回列表 发帖

CentOS8使用CentOS-Vault源+EPEL

操作系统的版本信息:
[root@centos8 ~]# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
[root@centos8 ~]#
[root@centos8 ~]# uname -r
4.18.0-193.el8.x86_64


[root@centos8 ~]# vim 1.txt
-bash: vim: 未找到命令

[root@centos8 ~]# yum -y install vim
CentOS-8 - AppStream                                                                                    49  B/s |  38  B     00:00   
错误:Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

笺注:
CentOS8操作系统版本结束了生命周期,阿里云镜像站也移除了相应镜像源;即公网Yum源不可用了。
如果需要使用Yum安装rpm软件包,需要切换至CentOS-Vault源,方法如下:

先备份原来的Yum源文件:
[root@centos8 ~]# cd /etc/yum.repos.d/
[root@centos8 yum.repos.d]# mkdir -p bak
[root@centos8 yum.repos.d]# mv *.* bak/

连接公网下载CentOS-Vault源文件:
[root@centos8 yum.repos.d]# cd
[root@centos8 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

确认CentOS-Vault源文件已下载成功:
[root@centos8 ~]# ls /etc/yum.repos.d/
bak  CentOS-Base.repo

生成缓存:
[root@centos8 ~]# yum clean all && yum makecache

理应就可以正常使用Yum安装rpm软件包了:
[root@centos8 ~]# yum -y install vim





############
############

EPEL的全称叫 Extra Packages for Enterprise Linux 。EPEL是由 Fedora 社区打造,为 RedHat及其衍生发行版(如CentOS等等)提供高质量软件包的项目。装上了 EPEL之后,就相当于添加了一个第三方源,可以直接使用Yum来安装额外的rpm软件包。

[root@centos8 ~]# yum -y install nload
上次元数据过期检查:0:00:02 前,执行于 2022年03月04日 星期五 09时47分31秒。
No match for argument: nload
错误:没有任何匹配: nload


[root@centos8 ~]# dnf -y install screen
上次元数据过期检查:0:00:24 前,执行于 2022年03月04日 星期五 09时47分31秒。
No match for argument: screen
错误:没有任何匹配: screen



需要先连接公网安装epel-release:
[root@centos8 ~]# yum -y install epel-release

确认epel-release已安装成功:
[root@centos8 ~]# rpm -q epel-release
epel-release-8-11.el8.noarch

理应就可以正常使用Yum来安装额外的rpm软件包了:

安装nload:
[root@centos8 ~]# yum -y install nload

查看nload的版本:
[root@centos8 ~]# rpm -q nload
nload-0.7.4-16.el8.x86_64


查看本机所有网卡的流量情况:
[root@centos8 ~]# nload
图片1.png
2022-3-4 10:51


图片2.png
2022-3-4 10:51

注释:按向上键、向下键可以切换网卡设备;输入“q”退出。


查看本机某张网卡的流量情况:
[root@centos8 ~]# nload ens160
图片3.png
2022-3-4 10:52

注释:输入“q”退出。





############

安装screen:
[root@centos8 ~]# dnf -y install screen

查看screen的版本:
[root@centos8 ~]# rpm -q screen
screen-4.6.2-12.el8.x86_64

进入screen:
[root@centos8 ~]# screen

获得screen的编号:
screen -ls
图片4.png
2022-3-4 10:53


在screen里面做操作其实没什么不同:
图片5.png
2022-3-4 10:53



关闭终端:
图片6.png
2022-3-4 10:53


再次登录终端,进入特定编号的screen:
图片7.png
2022-3-4 10:54


使用screen就不怕因网络中断而丢失终端了:
图片8.png
2022-3-4 10:54



可以同时有多个screen的:
图片9.png
2022-3-4 10:54


快捷键Ctrl+d,退出且结束当前的screen:
图片10.png
2022-3-4 10:54


现在只剩一个screen:
图片11.png
2022-3-4 10:55


笺注:服务器重启后screen都没有了。



卸载screen:
[root@centos8 ~]# yum -y remove screen

[root@centos8 ~]# rpm -q screen
未安装软件包 screen





######

另一种安装screen的方法:

下载screen的软件包:(假如软件包已经安装,则无法下载;假如目录/solf不存在,会自动创建)
[root@centos8 ~]# yum -y install screen --downloadonly --downloaddir=/solf

确认软件包已下载成功:
[root@centos8 ~]# ls -lh /solf/
总用量 584K
-rw-r--r--. 1 root root 582K 3月   4 10:04 screen-4.6.2-12.el8.x86_64.rpm

离线安装screen的软件包:(安装后,软件包会被自动删除的)
[root@centos8 ~]# yum -y install /solf/screen-4.6.2-12.el8.x86_64.rpm

[root@centos8 ~]# rpm -qa screen
screen-4.6.2-12.el8.x86_64
[root@centos8 ~]#
[root@centos8 ~]# ls -lh /solf/
总用量 0





相关文章:
最小化安装CentOS8
CentOS8_Yum安装MySQL8.0
CentOS8使用mailx(使用126邮箱的25端口)

CentOS8_在Docker中安装Zabbix4.4.5
CentOS8_在Docker中安装Zabbix5.0.12

CentOS6使用新Yum源+EPEL
CentOS6使用mailx(使用新浪邮箱的25端口)
CentOS6_RPM软件包管理器(screen+mailx)

返回列表