yumアップデートが機能しない(ストレージの問題)

yumアップデートが機能しない(ストレージの問題)
# yum update -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Update Process
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ft, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/×86 64/6/base/mirrorli st.txt
Error: Cannot find a valid baseurl for repo: base [root@localhost Desktop]# cd/etc/yum. repos.d/ bash: cd/etc/yum.repos.d/: No such file or directory [root@localhost Desktop]# cd /etc/yum. repos. d/ [root@localhost yum. repos.d]# ll total 32
- M-Г--г=
- Пу-Г--г-.
1 root root 1991 May 19 2016 CentOS-Base.repo
1 root root 1991 May
9 14:14 Cent0S-base. repo.old
1 root root
647 May 19 2016 CentOs-Debuginfo.repo
1 root root
289 May 19
2016 Cent0S-fasttrack.repo
- M-r--г.
1 root root 630 May 19 2016 CentOS-Media.repo
- [/-Г-- Г-
. 1 root root 6259 May 19
2016 CentOS-Vault. repo
-rw-r--r--. 1 root root 259 Sep 30 2015 virtualbox. repo [root@localhost yum. repos.d]# cp Centos-Base. repo CentOs-Base.repo.old [rootalocalhost yum. repos.d]# ll total 36
- T-T---- . 1 root root 1991 May 19
2016 Cent0S-Base. repo
1 root root 1991 May
9 14:14 CentOS-base.repo.old
- To re
1 root root 1991 May
9 14:22 Centos -Base. repo.old
1 root root
647 May 19 2016 CentOS -Debuginfo.repo
- П-Г-
1 root root
289 May 19 2016 CentOS-fasttrack.repo
-rw-r--r--, 1 root root 630 May 19 2016 CentOS-Media. repo
-rw-r--r--. 1 root root 6259 May 19 2016 Cents-Vault. repo
-rw-r--r--. 1 root root 259 Sep 30 2015 virtualbox. repo [root@localhost yum. repos.d]# vi CentOs- Base. repo [root@localhost yum. repos.d]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Error: File contains no section headers.
file: file:///etc/yum.repos.d/CentOS-Base.repo, line: 4
'update status of each mirror to pick mirrors that are updated to and\n' [root@localhost yum. repos.d]#

ベストアンサー1

ファイルは/etc/yum.repos.d/CentOS-Base.repo次のようにする必要があります(たとえば、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-7 - Base
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

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

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

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

角括弧([base]、、、 )内の行は次[updates][extras]とおりです。セクションタイトル、各設定ブロックは、次のセクションヘッダー行(またはファイルの終わり)になるまでセクションヘッダーで始まります。部分。各セクションは、パッケージをダウンロードできるリポジトリを定義します。

この行がリポジトリセクションで使用されている場合は、まず指定されたURLからリポジトリミラーURLのリストをダウンロードしてから、これらのミラーのいずれかを使用するように求められますmirrorlist=。このセクションでyumこのbaseurl=行を使用する場合は、パッケージストアのURLを直接指定してください。

セキュリティレベルの高いファイアウォール環境では、mirrorlist=ミラーリストが時間の経過とともに変更される可能性があり、次のものが含まれる可能性があるため、システムが接続できるパッケージストアのIPアドレスを事前に確認できないため、これらの行は問題を引き起こす可能性があります。コンテンツ配信ネットワークたとえば、アカマイはインターネット全体に存在します。これにより、ファイアウォールアクセスリストが長くなり、管理が困難になります。

mirrorlist=したがって、その行をコメントアウトし、その行のコメントを削除するのが一般的でbaseurl=あり、かなり近い場所にある信頼できるミラーサイトを参照するカスタムストアURLを指定したり、セキュリティレベルの高い組織の場合も同様です。これにより、ファイアウォール管理者はファイアウォールアクセスリストの長さを最小限に抑えることができ、セキュリティ監査人が満足できるようになります。

エラーメッセージ

Error: File contains no section headers.
file: file:///etc/yum.repos.d/CentOS-Base.repo, line: 4
'update status of each mirror to pick mirrors that are updated to and\n'

ファイルの4行目にyum理解できない内容があることを示しますCentOS-Base.repo。行の内容も表示されます。

#例と比較すると、誰かが行の先頭からコメント記号(文字)を削除したようです。残りの行は人が読める自由形式のテキストなので、当然yum理解する方法はありません。

誰かが自動化されたツールを使用してファイルを修正しようとしましたが、ツールが意図しない場所からコメント記号を削除する間違いを犯しましたか?

/etc/yum.repos.d/CentOS-Base.repoファイルの内容を見て、何が起こっているのかを理解しようとする必要があります。ファイルの先頭にあるテキスト行にコメントマークがない場合は、その行を置き換えるか、自由形式のテキスト行を削除する必要があります。

構成セクション(それぞれ括弧で囲まれたセクションヘッダー行で始まる)だけが実際の意味を持ちますyum。これらのファイルが見つからないか破損している場合は、バックアップまたはGoogleで破損していないファイルのコピーを見つけて、特定のCentOSバージョンのファイルの例を取得し、ファイルを回復するために使用する必要があります。基本的に、インターネットを介してHTTPサーバーへの発信接続を許可しない高セキュリティシステムを使用している場合は、システムがどのように更新されるべきかを知る必要があります(特定のミラーを使用する必要がありますか?内部ミラー)。インターネットプロキシ? ) それに応じて再構成設定を調整します。

おすすめ記事