深度解析Linux 软件包管理器 yum(查看、安装、卸载软件的相关操作)

深度解析Linux 软件包管理器 yum(查看、安装、卸载软件的相关操作)

卸载的话就是apt remove -y xxx

Linux下载安装软件的方案

1.源代码安装(不推荐)

2.rpm包安装(不推荐)

3.包管理器进行安装—yum/apt(相当于手机上面的应用商店)

我们使用的云服务器是被定制化过的

我们选择centos的原因是因为centos的生态好

开源本质是一种商业模式

在我们的Linux机器上,有对应的给yum/apt提供的配置文件

这些配置文件应该保存的是各个服务器的url或者是ip地址

云服务器:内置的配置文件已经是国内的了

我们可以通过yum list grep sl罗列出我们的centos所支持的所有软件

那么我们这里就能查到我们的sl这个软件的信息

将所有的软件包名字和配置信息都拉到本地

代码语言:javascript代码运行次数:0运行复制[root@hcss-ecs-28de ~]# yum list |grep sl

cyrus-sasl-lib.x86_64 2.1.27-5.el8 @BaseOS

isl.x86_64 0.16.1-6.el8 @AppStream

libnsl2.x86_64 1.2.0-2.20180605git4a062cf.el8 @anaconda

libpsl.x86_64 0.20.2-6.el8 @BaseOS

openssl.x86_64 1:1.1.1k-5.el8_5 @BaseOS

openssl-libs.x86_64 1:1.1.1k-5.el8_5 @BaseOS

openssl-pkcs11.x86_64 0.4.10-2.el8 @anaconda

python3-slip.noarch 0.6.4-11.el8 @anaconda

python3-slip-dbus.noarch 0.6.4-11.el8 @anaconda

rsyslog.x86_64 8.2102.0-5.el8 @AppStream

slang.x86_64 2.3.2-3.el8 @anaconda

NetworkManager-adsl.x86_64 1:1.32.10-4.el8 BaseOS

NetworkManager-fortisslvpn.x86_64 1.2.10-4.el8 epel

NetworkManager-fortisslvpn-gnome.x86_64 1.2.10-4.el8 epel

anope-openssl.x86_64 2.1.4-1.el8 epel

apr-util-openssl.i686 1.6.1-6.el8 AppStream

apr-util-openssl.x86_64 1.6.1-6.el8 AppStream

autocorr-sl.noarch 1:6.4.7.2-5.el8 AppStream

certwatch-mod_ssl.x86_64 1.2-1.el8 epel

cgnslib.x86_64 3.4.0-3.el8 epel

cgnslib-devel.x86_64 3.4.0-3.el8 epel

compat-openssl10.i686 1:1.0.2o-3.el8 AppStream

compat-openssl10.x86_64 1:1.0.2o-3.el8 AppStream

cyrus-sasl.i686 2.1.27-5.el8 BaseOS

cyrus-sasl.x86_64 2.1.27-5.el8 BaseOS

cyrus-sasl-devel.i686 2.1.27-5.el8 BaseOS

cyrus-sasl-devel.x86_64 2.1.27-5.el8 BaseOS

cyrus-sasl-gs2.i686 2.1.27-5.el8 BaseOS

cyrus-sasl-gs2.x86_64 2.1.27-5.el8 BaseOS

cyrus-sasl-gssapi.i686 2.1.27-5.el8 BaseOS

cyrus-sasl-gssapi.x86_64 2.1.27-5.el8 BaseOS

cyrus-sasl-ldap.i686 2.1.27-5.el8 BaseOS

cyrus-sasl-ldap.x86_64 2.1.27-5.el8 BaseOS

cyrus-sasl-lib.i686 2.1.27-5.el8 BaseOS

cyrus-sasl-md5.i686 2.1.27-5.el8 BaseOS

cyrus-sasl-md5.x86_64 2.1.27-5.el8 BaseOS

cyrus-sasl-ntlm.i686 2.1.27-5.el8 BaseOS

cyrus-sasl-ntlm.x86_64 2.1.27-5.el8 BaseOS

cyrus-sasl-plain.i686 2.1.27-5.el8 BaseOS

cyrus-sasl-plain.x86_64 2.1.27-5.el8 BaseOS

cyrus-sasl-scram.i686 2.1.27-5.el8 BaseOS

cyrus-sasl-scram.x86_64 2.1.27-5.el8 BaseOS

cyrus-sasl-sql.i686 2.1.27-5.el8 AppStream

cyrus-sasl-sql.x86_64 2.1.27-5.el8 AppStream

dcap-tunnel-ssl.x86_64 2.47.14-7.el8 epel

dislocker.x86_64 0.7.3-2.el8 epel

dislocker-libs.x86_64 0.7.3-2.el8 epel

docbook-style-xsl.noarch 1.79.2-9.el8 AppStream

docbook5-style-xsl.noarch 1.79.2-5.el8 epel

docbook5-style-xsl-extensions.noarch 1.79.2-5.el8 epel

erlang-sasl.x86_64 22.0.7-1.el8 epel

erlang-ssl.x86_64 22.0.7-1.el8 epel

festvox-slt-arctic-hts.noarch 2.5.0-14.el8 epel

fuse-dislocker.x86_64 0.7.3-2.el8 epel

gedit-plugin-translate.x86_64 3.28.1-8.el8 AppStream

glibc-langpack-sl.x86_64 2.28-164.el8 BaseOS

globus-gram-job-manager-slurm.noarch 3.0-9.el8 epel

globus-gsi-openssl-error.x86_64 4.4-1.el8 epel

globus-gsi-openssl-error-devel.x86_64 4.4-1.el8 epel

globus-gsi-openssl-error-doc.noarch 4.4-1.el8 epel

globus-gsi-proxy-ssl.x86_64 6.5-1.el8 epel

globus-gsi-proxy-ssl-devel.x86_64 6.5-1.el8 epel

globus-gsi-proxy-ssl-doc.noarch 6.5-1.el8 epel

globus-openssl-module.x86_64 5.2-1.el8 epel

globus-openssl-module-devel.x86_64 5.2-1.el8 epel

globus-openssl-module-doc.noarch 5.2-1.el8 epel

globus-rsl.x86_64 11.4-1.el8 epel

globus-rsl-devel.x86_64 11.4-1.el8 epel

globus-rsl-doc.noarch 11.4-1.el8 epel

gsl.i686 2.5-1.el8 AppStream

gsl.x86_64 2.5-1.el8 AppStream

gsl-devel.i686 2.5-1.el8 AppStream

gsl-devel.x86_64 2.5-1.el8 AppStream

hash-slinger.noarch 3.2-1.el8 epel

htslib.x86_64 1.9-5.el8 epel

htslib-devel.x86_64 1.9-5.el8 epel

htslib-tools.x86_64 1.9-5.el8 epel

hunspell-sl.noarch 0.20070127-18.el8 AppStream

hyphen-sl.noarch 0.20070127-16.el8 AppStream

isl.i686 0.16.1-6.el8 AppStream

islamic-menus.noarch 1.0.6-13.el8 epel

java-1.8.0-openjdk-headless-slowdebug.x86_64 1:1.8.0.312.b07-2.el8_5 AppStream

java-1.8.0-openjdk-slowdebug.x86_64 1:1.8.0.312.b07-2.el8_5 AppStream

java-latest-openjdk-demo-slowdebug.x86_64 1:23.0.1.0.11-1.rolling.el8 epel

java-latest-openjdk-devel-slowdebug.x86_64 1:23.0.1.0.11-1.rolling.el8 epel

java-latest-openjdk-headless-slowdebug.x86_64 1:23.0.1.0.11-1.rolling.el8 epel

java-latest-openjdk-jmods-slowdebug.x86_64 1:23.0.1.0.11-1.rolling.el8 epel

java-latest-openjdk-portable-devel-slowdebug.x86_64 1:23.0.1.0.11-1.rolling.el8 epel

java-latest-openjdk-portable-slowdebug.x86_64 1:23.0.1.0.11-1.rolling.el8 epel

java-latest-openjdk-portable-static-libs-slowdebug.x86_64 1:23.0.1.0.11-1.rolling.el8 epel

java-latest-openjdk-slowdebug.x86_64 1:23.0.1.0.11-1.rolling.el8 epel

java-latest-openjdk-src-slowdebug.x86_64 1:23.0.1.0.11-1.rolling.el8 epel

java-latest-openjdk-static-libs-slowdebug.x86_64 1:23.0.1.0.11-1.rolling.el8 epel

jcl-over-slf4j.noarch 1.7.25-4.module_el8.0.0+39+6a9b6e22 AppStream

kdesdk-kioslaves.x86_64 22.04.1-1.el8 epel

langpacks-sl.noarch 1.0-12.el8 AppStream

libgsasl.x86_64 1.8.0-8.el8 epel

libgsasl-devel.x86_64 1.8.0-8.el8 epel

libknet1-crypto-openssl-plugin.x86_64 1.24-4.1.el8 epel

libnsl.i686 2.28-164.el8 BaseOS

libnsl.x86_64 2.28-164.el8 BaseOS

libnsl2.i686 1.2.0-2.20180605git4a062cf.el8 BaseOS

libpsl.i686 0.20.2-6.el8 BaseOS

libreoffice-help-sl.x86_64 1:6.4.7.2-5.el8 AppStream

libreoffice-langpack-sl.x86_64 1:6.4.7.2-5.el8 AppStream

libreoffice-xsltfilter.x86_64 1:6.4.7.2-5.el8 AppStream

libslirp.x86_64 4.4.0-1.module_el8.5.0+890+6b136101 AppStream

libslirp-devel.x86_64 4.4.0-1.module_el8.5.0+890+6b136101 AppStream

libslopy.x86_64 7.6-5.el8 epel

libslopy-devel.x86_64 7.6-5.el8 epel

libslz.x86_64 1.2.0-2.el8 epel

libslz-devel.x86_64 1.2.0-2.el8 epel

libxslt.i686 1.1.32-6.el8 BaseOS

libxslt.x86_64 1.1.32-6.el8 BaseOS

libxslt-devel.i686 1.1.32-6.el8 AppStream

libxslt-devel.x86_64 1.1.32-6.el8 AppStream

lighttpd-mod_authn_sasl.x86_64 1.4.67-1.el8 epel

lighttpd-mod_openssl.x86_64 1.4.67-1.el8 epel

lua-cyrussasl.x86_64 1.1.0-7.el8 epel

lua-luaossl.x86_64 20190731-1.el8 epel

lua-luaossl-doc.noarch 20190731-1.el8 epel

lua5.1-luaossl.x86_64 20190731-1.el8 epel

metslib-devel.noarch 0.5.3-22.el8 epel

metslib-doc.noarch 0.5.3-22.el8 epel

mod_ssl.x86_64 1:2.4.37-43.module_el8.5.0+1022+b541f3b1 AppStream

mozilla-zilla-slab-fonts.noarch 1.002-1.el8 epel

mozilla-zilla-slab-fonts-common.noarch 1.002-1.el8 epel

mozilla-zilla-slab-highlight-fonts.noarch 1.002-1.el8 epel

mythes-sl.noarch 0.20130130-11.el8 AppStream

nagios-plugins-ssl_validity.x86_64 2.4.9-1.el8 epel

nginx-mod-http-xslt-filter.x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream

openslide.x86_64 3.4.1-17.el8 epel

openslide-devel.x86_64 3.4.1-17.el8 epel

openslide-tools.x86_64 3.4.1-17.el8 epel

openslp.i686 2.0.0-19.el8 AppStream

openslp.x86_64 2.0.0-19.el8 AppStream

openssl-devel.i686 1:1.1.1k-5.el8_5 BaseOS

openssl-devel.x86_64 1:1.1.1k-5.el8_5 BaseOS

openssl-ibmpkcs11.x86_64 1.0.2-1.el8 BaseOS

openssl-libs.i686 1:1.1.1k-5.el8_5 BaseOS

openssl-perl.x86_64 1:1.1.1k-5.el8_5 BaseOS

openssl-pkcs11.i686 0.4.10-2.el8 BaseOS

openssl3.x86_64 3.2.2-2.1.el8 epel

openssl3-devel.x86_64 3.2.2-2.1.el8 epel

openssl3-libs.x86_64 3.2.2-2.1.el8 epel

osslsigncode.x86_64 2.5-3.el8 epel

pcp-pmda-rsyslog.x86_64 5.3.1-5.el8 AppStream

pcp-pmda-slurm.x86_64 5.3.1-5.el8 AppStream

pdsh-mod-slurm.x86_64 2.34-5.el8 epel

perl-Lingua-Translit.noarch 0.28-7.el8 epel

perl-SQL-Translator.noarch 1.61-3.el8 epel

perl-SQL-Translator-Producer-Diagram.noarch 1.61-3.el8 epel

perl-Sys-Syslog.x86_64 0.35-397.el8 AppStream

perl-Unix-Syslog.x86_64 1.1-29.el8 AppStream

plasma-applet-translator.noarch 0.8-4.el8 epel

plasma-nm-fortisslvpn.x86_64 5.24.7-1.el8 epel

pslib.x86_64 0.4.5-19.el8 epel

pslib-devel.x86_64 0.4.5-19.el8 epel

python-idna-ssl.noarch 1.1.0-9.el8 epel

python2-absl-py.noarch 0.13.0-1.el8 epel

python2-backports-ssl_match_hostname.noarch 3.5.0.1-12.module_el8.5.0+743+cd2f5d28 AppStream

python2-translationstring.noarch 1.3-9.el8 epel

python3-absl-py.noarch 0.13.0-1.el8 epel

python3-aioopenssl.noarch 0.5.1-1.el8 epel

python3-aiosasl.noarch 0.4.1-2.el8 epel

python3-dnslib.noarch 0.9.21-1.el8 epel

python3-msldap.noarch 0.2.13-1.el8 epel

python3-openslide.x86_64 1.1.2-1.el8 epel

python3-passlib.noarch 1.7.2-1.el8 epel

python3-rtslib.noarch 2.1.74-1.el8 BaseOS

python3-should_dsl.noarch 2.1.2-1.el8 epel

python3-slacker.noarch 0.13.0-4.el8 epel

python3-slacker-doc.noarch 0.13.0-4.el8 epel

python3-slixmpp.x86_64 1.7.1-1.el8 epel

python3-slowloris.noarch 0.2.0-1.el8 epel

python3-slugify.noarch 4.0.0-1.el8 epel

python3-testslide.noarch 2.7.0-2.el8 epel

python3-translationstring.noarch 1.3-9.el8 epel

python3-translitcodec.noarch 0.7.0-5.el8 epel

python3.11-passlib.noarch 1.7.4-13.el8 epel

qca-qt5-cyrus-sasl.x86_64 2.3.4-2.el8 epel

qca-qt5-ossl.x86_64 2.3.4-2.el8 epel

qt-creator-translations.noarch 8.0.2-4.el8 epel

qt5-qttranslations.noarch 5.15.2-1.el8 AppStream

rpm-plugin-syslog.x86_64 4.14.3-19.el8 BaseOS

rsyslog-crypto.x86_64 8.2102.0-5.el8 AppStream

rsyslog-doc.noarch 8.2102.0-5.el8 AppStream

rsyslog-elasticsearch.x86_64 8.2102.0-5.el8 AppStream

rsyslog-gnutls.x86_64 8.2102.0-5.el8 AppStream

rsyslog-gssapi.x86_64 8.2102.0-5.el8 AppStream

rsyslog-kafka.x86_64 8.2102.0-5.el8 AppStream

rsyslog-mmaudit.x86_64 8.2102.0-5.el8 AppStream

rsyslog-mmjsonparse.x86_64 8.2102.0-5.el8 AppStream

rsyslog-mmkubernetes.x86_64 8.2102.0-5.el8 AppStream

rsyslog-mmnormalize.x86_64 8.2102.0-5.el8 AppStream

rsyslog-mmsnmptrapd.x86_64 8.2102.0-5.el8 AppStream

rsyslog-mysql.x86_64 8.2102.0-5.el8 AppStream

rsyslog-omamqp1.x86_64 8.2102.0-5.el8 AppStream

rsyslog-openssl.x86_64 8.2102.0-5.el8 AppStream

rsyslog-pgsql.x86_64 8.2102.0-5.el8 AppStream

rsyslog-relp.x86_64 8.2102.0-5.el8 AppStream

rsyslog-snmp.x86_64 8.2102.0-5.el8 AppStream

rsyslog-udpspoof.x86_64 8.2102.0-5.el8 AppStream

rubygem-openssl.i686 2.1.2-107.module_el8.4.0+847+ee687b6c AppStream

rubygem-openssl.x86_64 2.1.2-107.module_el8.4.0+847+ee687b6c AppStream

sasl-xoauth2.x86_64 0.24-1.el8 epel

sl.x86_64 5.02-1.el8 epel

slang.i686 2.3.2-3.el8 BaseOS

slang-devel.i686 2.3.2-3.el8 AppStream

slang-devel.x86_64 2.3.2-3.el8 AppStream

sleef.x86_64 3.5.1-3.el8 epel

sleef-devel.x86_64 3.5.1-3.el8 epel

sleef-doc.noarch 3.5.1-3.el8 epel

sleef-gnuabi.x86_64 3.5.1-3.el8 epel

sleef-gnuabi-devel.x86_64 3.5.1-3.el8 epel

sleuthkit.x86_64 4.9.0-1.el8 epel

sleuthkit-devel.x86_64 4.9.0-1.el8 epel

sleuthkit-libs.x86_64 4.9.0-1.el8 epel

slf4j.noarch 1.7.25-4.module_el8.0.0+39+6a9b6e22 AppStream

slick-greeter.x86_64 1.5.6-1.el8 epel

slick-greeter-cinnamon.noarch 1.5.6-1.el8 epel

slick-greeter-mate.noarch 1.5.6-1.el8 epel

slirp4netns.x86_64 1.1.8-1.module_el8.5.0+890+6b136101 AppStream

sloccount.x86_64 2.26-37.el8 epel

slop.x86_64 7.6-5.el8 epel

slowhttptest.x86_64 1.8.2-1.el8 epel

slowloris.noarch 0.2.0-1.el8 epel

slurm.x86_64 20.11.9-1.el8 epel

slurm-contribs.x86_64 20.11.9-1.el8 epel

slurm-devel.x86_64 20.11.9-1.el8 epel

slurm-doc.x86_64 20.11.9-1.el8 epel

slurm-gui.x86_64 20.11.9-1.el8 epel

slurm-libs.x86_64 20.11.9-1.el8 epel

slurm-nss_slurm.x86_64 20.11.9-1.el8 epel

slurm-openlava.x86_64 20.11.9-1.el8 epel

slurm-pam_slurm.x86_64 20.11.9-1.el8 epel

slurm-perlapi.x86_64 20.11.9-1.el8 epel

slurm-pmi.x86_64 20.11.9-1.el8 epel

slurm-pmi-devel.x86_64 20.11.9-1.el8 epel

slurm-rrdtool.x86_64 20.11.9-1.el8 epel

slurm-slurmctld.x86_64 20.11.9-1.el8 epel

slurm-slurmd.x86_64 20.11.9-1.el8 epel

slurm-slurmdbd.x86_64 20.11.9-1.el8 epel

slurm-slurmrestd.x86_64 20.11.9-1.el8 epel

slurm-torque.x86_64 20.11.9-1.el8 epel

ssldump.x86_64 1.9-1.el8 epel

sslh.x86_64 1.20-1.el8 epel

sslscan.x86_64 2.0.6-1.el8 epel

syslinux.x86_64 6.04-5.el8 BaseOS

syslinux-extlinux.x86_64 6.04-5.el8 BaseOS

syslinux-extlinux-nonlinux.noarch 6.04-5.el8 BaseOS

syslinux-nonlinux.noarch 6.04-5.el8 BaseOS

syslinux-tftpboot.noarch 6.04-5.el8 BaseOS

syslog-ng.x86_64 3.23.1-3.el8 epel

syslog-ng-amqp.x86_64 3.23.1-3.el8 epel

syslog-ng-devel.x86_64 3.23.1-3.el8 epel

syslog-ng-geoip.x86_64 3.23.1-3.el8 epel

syslog-ng-http.x86_64 3.23.1-3.el8 epel

syslog-ng-java.x86_64 3.23.1-3.el8 epel

syslog-ng-libdbi.x86_64 3.23.1-3.el8 epel

syslog-ng-logrotate.x86_64 3.23.1-3.el8 epel

syslog-ng-mongodb.x86_64 3.23.1-3.el8 epel

syslog-ng-python.x86_64 3.23.1-3.el8 epel

syslog-ng-redis.x86_64 3.23.1-3.el8 epel

syslog-ng-riemann.x86_64 3.23.1-3.el8 epel

syslog-ng-smtp.x86_64 3.23.1-3.el8 epel

tesseract-langpack-isl.noarch 4.0.0-6.el8 epel

tesseract-langpack-slk.noarch 4.0.0-6.el8 epel

tesseract-langpack-slv.noarch 4.0.0-6.el8 epel

testssl.noarch 3.2~rc3-1.el8 epel

texlive-carlisle.noarch 7:20180414-23.el8 AppStream

texlive-pslatex.noarch 7:20180414-23.el8 AppStream

texlive-pst-slpe.noarch 7:20180414-23.el8 AppStream

texlive-texlive-msg-translations.noarch 7:20180414-23.el8 AppStream

texlive-translator.noarch 7:20180414-12.el8 epel

translate-shell.noarch 0.9.7.1-1.el8 epel

tsl-sparse-map-devel.x86_64 0.6.2-2.el8 epel

tslib.x86_64 1.22-4.el8 epel

tslib-devel.x86_64 1.22-4.el8 epel

uwsgi-logger-rsyslog.x86_64 2.0.27-4.el8 epel

uwsgi-logger-syslog.x86_64 2.0.27-4.el8 epel

uwsgi-plugin-xslt.x86_64 2.0.27-4.el8 epel

uwsgi-router-ssl.x86_64 2.0.27-4.el8 epel

wcslib.x86_64 7.12-1.el8 epel

wcslib-devel.x86_64 7.12-1.el8 epel

wcslib-utils.x86_64 7.12-1.el8 epel

xmlsec1-openssl.i686 1.2.25-4.el8 AppStream

xmlsec1-openssl.x86_64 1.2.25-4.el8 AppStream

yelp-xsl.noarch 3.28.0-2.el8 AppStream

[root@hcss-ecs-28de ~]# 我们现在下载一个软件叫做sl

输入命令yum install -y sl就能进行下载的操作

代码语言:javascript代码运行次数:0运行复制[root@hcss-ecs-28de ~]# yum install -y sl

Last metadata expiration check: 3:17:18 ago on Sun 22 Dec 2024 02:27:58 PM CST.

Dependencies resolved.

============================================================================================================================================================================

Package Architecture Version Repository Size

============================================================================================================================================================================

Installing:

sl x86_64 5.02-1.el8 epel 16 k

Transaction Summary

============================================================================================================================================================================

Install 1 Package

Total download size: 16 k

Installed size: 26 k

Downloading Packages:

sl-5.02-1.el8.x86_64.rpm 18 kB/s | 16 kB 00:00

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total 18 kB/s | 16 kB 00:00

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

Preparing : 1/1

Installing : sl-5.02-1.el8.x86_64 1/1

Running scriptlet: sl-5.02-1.el8.x86_64 1/1

Verifying : sl-5.02-1.el8.x86_64 1/1

Installed:

sl-5.02-1.el8.x86_64

Complete!

[root@hcss-ecs-28de ~]# 那么我们运行我们的Linux,输入sl这个命令,出现在我们面前的就是一个小火车

但是你如果正常输入指令进行安装操作的话但是系统不让你安装你会怎么办呢?

是为什么呢?

因为我们这里使用的是普通用户的账号,我们是需要使用root账号进行安装的

或者是用sudo进行安装的操作

Linux一般而言,软件只要安装一次,所有都能用,我们使用other用户的身份进行使用

那么我们如何进行卸载的操作呢?

我们使用命令yum remove sl就能卸载对应的软件,但是我们是需要使用root用户进行卸载操作的

只有root用户才能进行安装和卸载的操作的

总结:

yum三板斧

yunm list | grep xxx查看我们要下载的软件的相关的信息

yum install -y xxx进行软件的安装操作

yum remove xxx进行软件的卸载的操作

如果我们的系统是乌班图的话我们使用apt search sl进行相关的软件搜索的操作

下载的话就是apt install -y xxx

其实区别是不大的

并且我们在安装的时候只能装完一个再装另外一个,如果同时安装两个的话是会进行报错的

我们电脑必须联网才能进行安装软件的操作

这个yum配置软件在那个本地的文件etc目录下的yum.repos.d

这个路径就是yum源配置文件所在的路径

我们输入命令cd /etc/yum.repos.d/就能看见了

我们对应的yum源不一定只有一个

而centos中最核心的最基础的yum源就是CentOS-Base.repo

代码语言:javascript代码运行次数:0运行复制[root@hcss-ecs-28de ~]# cd /etc/yum.repos.d/

[root@hcss-ecs-28de yum.repos.d]# pwd

/etc/yum.repos.d

[root@hcss-ecs-28de yum.repos.d]# ll

total 76

-rw-r--r-- 1 root root 748 Jul 17 2023 CentOS-AppStream.repo

-rw-r--r-- 1 root root 729 Jul 17 2023 CentOS-Base.repo

-rw-r--r-- 1 root root 815 Jul 17 2023 CentOS-centosplus.repo

-rw-r--r-- 1 root root 1060 Jul 17 2023 CentOS-CR.repo

-rw-r--r-- 1 root root 668 Jul 17 2023 CentOS-Debuginfo.repo

-rw-r--r-- 1 root root 760 Jul 17 2023 CentOS-Devel.repo

-rw-r--r-- 1 root root 773 Jul 17 2023 CentOS-Extras.repo

-rw-r--r-- 1 root root 355 Jul 17 2023 CentOS-fasttrack.repo

-rw-r--r-- 1 root root 755 Jul 17 2023 CentOS-HA.repo

-rw-r--r-- 1 root root 928 Jul 17 2023 CentOS-Media.repo

-rw-r--r-- 1 root root 753 Jul 17 2023 CentOS-PowerTools.repo

-rw-r--r-- 1 root root 1382 Jul 17 2023 CentOS-Sources.repo

-rw-r--r-- 1 root root 74 Jul 17 2023 CentOS-Vault.repo

-rw-r--r-- 1 root root 1513 Jul 17 2023 epel-modular.repo

-rw-r--r-- 1 root root 1680 Apr 17 2023 epel-modular.repo.rpmnew

-rw-r--r-- 1 root root 1450 Jul 17 2023 epel.repo

-rw-r--r-- 1 root root 1332 Apr 17 2023 epel.repo.rpmnew

-rw-r--r-- 1 root root 1779 Apr 17 2023 epel-testing-modular.repo

-rw-r--r-- 1 root root 1431 Apr 17 2023 epel-testing.repo

[root@hcss-ecs-28de yum.repos.d]# 我们输入命令cat CentOS-Base.repo进行配置文件的查看操作

代码语言:javascript代码运行次数:0运行复制[root@hcss-ecs-28de yum.repos.d]# cat CentOS-Base.repo

# CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client. You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.

#

#

[BaseOS]

name=CentOS-$releasever - Base

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra

baseurl=https://repo.huaweicloud.com/centos-vault/$contentdir/$releasever/BaseOS/$basearch/os/

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[root@hcss-ecs-28de yum.repos.d]# 乌班图下也有自己的yum源的

在我们的/etc/apt/sources.list

切换yum源的本质就是更改配置文件

如果我们需要进行切换yum源的话,我们可以找到文心一言进行帮助

输入centos 7系统重切换yum镜像源到163,帮我形成清单,并且进行简单的说明

下面是我的gpt生成的答案

以下是将 CentOS 7 的 yum 镜像源切换到 163 镜像源的清单和操作说明:

步骤清单备份当前的 yum 源配置文件备份 /etc/yum.repos.d/CentOS-Base.repo 文件,以便出问题时还原。下载 163 镜像源的 repo 文件删除或禁用原有的 CentOS 源,下载并替换为 163 提供的配置文件。清理和重建 yum 缓存清理旧的缓存并更新以使用新的镜像源。验证配置是否成功测试 yum 能否正常访问 163 镜像源,并检查下载速度。详细操作说明1. 备份原有配置文件代码语言:javascript代码运行次数:0运行复制sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak说明:备份原有配置文件可以防止切换过程中出现错误,方便快速恢复。

2. 下载 163 镜像源配置先删除旧的 yum 源文件(非必须,但推荐保持整洁):

代码语言:javascript代码运行次数:0运行复制sudo rm -f /etc/yum.repos.d/CentOS-Base.repo下载 163 提供的 CentOS 7 配置文件:

代码语言:javascript代码运行次数:0运行复制sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo3. 清理和更新缓存执行以下命令清理 yum 缓存,并重新生成新缓存:

代码语言:javascript代码运行次数:0运行复制sudo yum clean all

sudo yum makecache4. 验证镜像源是否正常运行以下命令检查是否成功切换到 163 源:

代码语言:javascript代码运行次数:0运行复制sudo yum repolist输出的结果中应该能看到类似以下内容:

代码语言:javascript代码运行次数:0运行复制repo id repo name status

base/7/x86_64 CentOS-7 - Base - 163.com XXXX

extras/7/x86_64 CentOS-7 - Extras - 163.com XXXX

updates/7/x86_64 CentOS-7 - Updates - 163.com XXXX5. 测试下载速度安装一个简单软件包(如 wget)测试下载速度:

代码语言:javascript代码运行次数:0运行复制sudo yum install -y wget注意事项 如果 163 镜像源不可用,可能需要切换到其他镜像源(如阿里云或腾讯云)。

如果你的网络环境有限制,确保可以正常访问 163 的服务器地址(mirrors.163.com)。

不建议在生产环境随意更换镜像源,请提前测试稳定性。

希望以上步骤能够帮助你顺利切换镜像源!

我们这里下载一个有趣的命令htop

会将你的电脑信息显示出来的

代码语言:javascript代码运行次数:0运行复制[root@hcss-ecs-28de ~]# yum install -y htop

Last metadata expiration check: 2:53:41 ago on Tue 24 Dec 2024 10:31:54 AM CST.

Dependencies resolved.

========================================================================================

Package Architecture Version Repository Size

========================================================================================

Installing:

htop x86_64 3.2.1-1.el8 epel 170 k

Transaction Summary

========================================================================================

Install 1 Package

Total download size: 170 k

Installed size: 396 k

Downloading Packages:

htop-3.2.1-1.el8.x86_64.rpm 41 kB/s | 170 kB 00:04

----------------------------------------------------------------------------------------

Total 41 kB/s | 170 kB 00:04

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

Preparing : 1/1

Installing : htop-3.2.1-1.el8.x86_64 1/1

Running scriptlet: htop-3.2.1-1.el8.x86_64 1/1

Verifying : htop-3.2.1-1.el8.x86_64 1/1

Installed:

htop-3.2.1-1.el8.x86_64

Complete!

[root@hcss-ecs-28de ~]# htop

[root@hcss-ecs-28de ~]#

❈ ❈ ❈

相关文章

✧ ✧ ✧
哪个天龙八部SF人多?2023人气Top5服务器实测推荐
新手也能学会! Excel表格一列数据拆分成多行多列的3种方法
鸣潮哀声鸷怎么获得
365365bet官

鸣潮哀声鸷怎么获得

📅 08-23 👁️ 1841