CentOS7 は yum 清華ソースと Alibaba ソースを構成します

CentOS7 は yum 清華ソースと Alibaba ソースを構成します

この記事はあなた自身のインストール記録レビュー用です
以下は Centos7 です yum Tsinghua ソースと Alibaba ソースの置き換え
Centos7 のデフォルトサーバーは海外にあり、接続が非常に遅いです。
国内のミラーソースに変更し、yum 清華ソース、Alibaba ソースを使用すると接続が速くなります
以下に置き換え方法を紹介します。

前提条件: コマンドラインを開く

以下に示すように、コマンド ライン
CnetOS7、仮想マシン コマンド ライン:
ここに画像の説明を挿入します
ssh を開きます。
ここに画像の説明を挿入します

1. 元のファイルをバックアップする

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

結果:
ここに画像の説明を挿入します

2.編集

vim /etc/yum.repos.d/CentOS-Base.repo

設定ファイルの内容 (Alibaba のもの):

# 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.
#
#

[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

設定ファイルの内容 (清華大学):

# 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.
#
#

[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

3.yumキャッシュをクリアする

yum clean all

このコマンドを実行すると、yum は /var/cache/yum ディレクトリからキャッシュをクリアします。

4. yum キャッシュ ファイルを再生成する

yum makecache

このコマンドは、サーバーのパッケージ情報をローカル コンピューターにダウンロードしてキャッシュします。コマンドの実行後、次のようになります。
ここに画像の説明を挿入します

5. アップデートとアップグレード

yum update

説明: すべてのパッケージをアップグレードすると、ソフトウェアとシステム カーネルもアップグレードされます。

yum upgrade

説明: ソフトウェアとシステムカーネルではなく、すべてのパッケージのみをアップグレードしてください。
ここに画像の説明を挿入します

yum check-update

説明: これは、利用可能なアップデートを確認するために使用される yum コマンドです。現在の yum 構成について構成されているすべてのリポジトリをチェックし、利用可能なすべてのアップデートとインストールされているパッケージをリストします。

6. 特定のパッケージがインストールされているかどうかを確認します

yum list | grep openjdk

説明: yum list コマンドは、インストールまたは更新でき、リソースライブラリーにインストールされている特定の rpm パッケージをリストします。コンテンツが
多いため、次のようなフィルタリングに grep を使用できます。 openjdk キーワードを含むパッケージをリストする
ここに画像の説明を挿入します

おすすめ

転載: blog.csdn.net/p309654858/article/details/132311349