Closed1

CentOS 6.9にてEPELリポジトリの有効化 & open-vm-toolsの導入

Ryo YamadaRyo Yamada

東京都産業労働局 注意喚起サイト
https://www.cybersecurity.metro.tokyo.lg.jp/security/cyberthreat/259/index.html

1. 概要

とある機会にVMware ESXi環境で稼働している「CentOS 6.9(または6.6)」に対し、
open-vm-toolsを導入する作業を実施しました。

大半の環境は Rocky LinuxAlmaLinux に移行済みと思いますが、
古い環境ゆえ情報が少ないと感じたので手順を作業ログとして残します。

2. テスト環境

  • テスト環境は64bit版のみ動作確認を実施

  • 事前に外部ネットワーク宛の通信が可能か確認すること

  • パッケージインストールは 管理者権限 が必要です

    OS CentOS release 6.9
    CPU Architecture x86_64
    Kernel 2.6.32-696.el6

3. Baseリポジトリの変更

CentOS 6のBaseリポジトリは**2020年11月30日** にサポートが終了しているため、現在は参照不可となります。

yumコマンドの挙動として、/etc/yum.repos.d/で有効されているリポジトリは、ダウンロードの可否に関わらず参照します。

参照不可のリポジトリが含まれている場合、「yum update」コマンドが途中で中断されるため先に旧リポジトリを無効化します。

3.1. リポジトリファイルをバックアップ

念の為、バックアップファイルを作成します。

cp -ip /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

3.2. 旧リポジトリ無効化

リポジトリファイルの各セクションにenabled=0 (無効化)を追記。

vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra#
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0 ← 「enabled=1」から変更
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra#
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0 ← 「enabled=1」から変更
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra#
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0 ← 「enabled=1」から変更

3.2. アーカイブリポジトリ有効化

アーカイブリポジトリを有効化したリポジトリファイルを新規作成します。
リポジトリは vault.centos.org を指定しました。

  • リポジトリファイルを新規作成
cat <<EOF > /etc/yum.repos.d/CentOS-Vault.repo
[base]
name=CentOS-\$releasever - Base
baseurl=http://vault.centos.org/centos/\$releasever/os/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1

[updates]
name=CentOS-\$releasever - Updates
baseurl=http://vault.centos.org/centos/\$releasever/updates/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1

[extras]
name=CentOS-\$releasever - Extras
baseurl=http://vault.centos.org/centos/\$releasever/extras/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
EOF

3.3. yum キャッシュ削除 & アップデート確認

  • yum キャッシュ削除
# yum clean all
  • 設定したリポジトリからアップデート可能なパッケージを取得
# yum check-update

4. EPELアーカイブリポジトリ 有効化

CentOS6デフォルトのyumリポジトリにはopen-vm-toolsが含まれていません。
そのため、Fedoraの有志が作成・メンテナンスしている EPELリポジトリ を有効化する必要があります。

EPELは、RHELでサポートされていないサードパーティ製パッケージを互換ディストリビューション上で利用可能にすることを目的としています。

詳細は 日本語wikiのサイトが参考になりました。
https://fedoraproject.org/wiki/About_EPEL/ja

4.1. repoファイルのダウンロード

# rpm -ivh https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm

4.2. EPELリポジトリの有効化を確認

# yum repolist all | grep -i epel
  • 実行ログ

    epel                   Extra Packages for Enterprise Linux 6 - x enabled: 12,581
    epel-debuginfo         Extra Packages for Enterprise Linux 6 - x disabled
    epel-source            Extra Packages for Enterprise Linux 6 - x disabled
    epel-testing           Extra Packages for Enterprise Linux 6 - T disabled
    epel-testing-debuginfo Extra Packages for Enterprise Linux 6 - T disabled
    epel-testing-source    Extra Packages for Enterprise Linux 6 - T disabled
    

※ epelリポジトリが 「enabled」と出力されていること。debugやtest系は「disabled」で問題ない。

4.3. yum キャッシュ削除

yumは実行時に一時ファイルとして/var/cache/yum/$basearch/$releasever/ に作成します。

キャッシュデータ参照を抑制するため、インストール前にキャッシュクリアを実行しておきましょう。

# yum clean all

5. open-vm-tools インストール

インストール可能なパッケージは筆者確認時では open-vm-tools 10.1.5 でした。

5.1. パッケージ情報を確認

# yum info open-vm-tools
  • 実行ログ

    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * epel: mirror.math.princeton.edu
    Available Packages
    Name        : open-vm-tools
    Arch        : i686
    Version     : 10.1.5
    Release     : 6.el6
    Size        : 639 k
    Repo        : epel
    Summary     : Open Virtual Machine Tools for virtual machines hosted on VMware
    URL         : https://github.com/vmware/open-vm-tools
    License     : GPLv2
    Description : The open-vm-tools project is an open source implementation of VMware Tools. It
                : is a suite of open source virtualization utilities and drivers to improve the
                : functionality, user experience and administration of VMware virtual machines.
                : This package contains only the core user-space programs and libraries of
                : open-vm-tools.
    Name        : open-vm-tools
    Arch        : x86_64
    Version     : 10.1.5
    Release     : 6.el6
    Size        : 628 k
    Repo        : epel
    Summary     : Open Virtual Machine Tools for virtual machines hosted on VMware
    URL         : https://github.com/vmware/open-vm-tools
    License     : GPLv2
    Description : The open-vm-tools project is an open source implementation of VMware Tools. It
                : is a suite of open source virtualization utilities and drivers to improve the
                : functionality, user experience and administration of VMware virtual machines.
                : This package contains only the core user-space programs and libraries of
                : open-vm-tools.
    

5.2. インストール

通信断無しで導入可能です。

(テスト環境では再起動や電源断も発生しませんでした。)
インストール時の実行ログは下記トグルから要参照。

# yum install open-vm-tools
  • 実行ログ

    Loaded plugins: fastestmirror
    Setting up Install Process
    Loading mirror speeds from cached hostfile
     * epel: mirror.math.princeton.edu
    Resolving Dependencies
    --> Running transaction check
    ---> Package open-vm-tools.x86_64 0:10.1.5-6.el6 will be installed
    --> Processing Dependency: libfuse.so.2(FUSE_2.5)(64bit) for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Processing Dependency: libfuse.so.2(FUSE_2.6)(64bit) for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Processing Dependency: xmlsec1-openssl for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Processing Dependency: libdnet.so.1()(64bit) for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Processing Dependency: libfuse.so.2()(64bit) for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Processing Dependency: libicudata.so.42()(64bit) for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Processing Dependency: libicui18n.so.42()(64bit) for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Processing Dependency: libicuuc.so.42()(64bit) for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Processing Dependency: libltdl.so.7()(64bit) for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Processing Dependency: libmspack.so.0()(64bit) for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Processing Dependency: libxmlsec1.so.1()(64bit) for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Processing Dependency: libxslt.so.1()(64bit) for package: open-vm-tools-10.1.5-6.el6.x86_64
    --> Running transaction check
    ---> Package fuse-libs.x86_64 0:2.8.3-5.el6 will be installed
    ---> Package libdnet.x86_64 0:1.12-6.el6 will be installed
    ---> Package libicu.x86_64 0:4.2.1-14.el6 will be installed
    ---> Package libmspack.x86_64 0:0.6-0.1.alpha.el6 will be installed
    ---> Package libtool-ltdl.x86_64 0:2.2.6-15.5.el6 will be installed
    ---> Package libxslt.x86_64 0:1.1.26-2.el6_3.1 will be installed
    ---> Package xmlsec1.x86_64 0:1.2.20-4.el6 will be installed
    ---> Package xmlsec1-openssl.x86_64 0:1.2.20-4.el6 will be installed
    --> Finished Dependency Resolution
    Dependencies Resolved
    ============================================================================================ Package                 Arch           Version                     Repository         Size
    ============================================================================================Installing: open-vm-tools           x86_64         10.1.5-6.el6                epel              628 k
    Installing for dependencies:
     fuse-libs               x86_64         2.8.3-5.el6                 C6.9-base          74 k
     libdnet                 x86_64         1.12-6.el6                  epel               28 k
     libicu                  x86_64         4.2.1-14.el6                C6.9-base         4.9 M
     libmspack               x86_64         0.6-0.1.alpha.el6           epel               68 k
     libtool-ltdl            x86_64         2.2.6-15.5.el6              C6.9-base          44 k
     libxslt                 x86_64         1.1.26-2.el6_3.1            C6.9-base         452 k
     xmlsec1                 x86_64         1.2.20-4.el6                C6.9-base         174 k
     xmlsec1-openssl         x86_64         1.2.20-4.el6                C6.9-base          75 k
    Transaction Summary
    ============================================================================================Install       9 Package(s)Total download size: 6.4 M
    Installed size: 24 M
    Is this ok [y/N]: y
    Downloading Packages:
    (1/9): fuse-libs-2.8.3-5.el6.x86_64.rpm                              |  74 kB     00:00
    (2/9): libdnet-1.12-6.el6.x86_64.rpm                                 |  28 kB     00:00
    (3/9): libicu-4.2.1-14.el6.x86_64.rpm                                | 4.9 MB     00:01
    (4/9): libmspack-0.6-0.1.alpha.el6.x86_64.rpm                        |  68 kB     00:00
    (5/9): libtool-ltdl-2.2.6-15.5.el6.x86_64.rpm                        |  44 kB     00:00
    (6/9): libxslt-1.1.26-2.el6_3.1.x86_64.rpm                           | 452 kB     00:00
    (7/9): open-vm-tools-10.1.5-6.el6.x86_64.rpm                         | 628 kB     00:00
    (8/9): xmlsec1-1.2.20-4.el6.x86_64.rpm                               | 174 kB     00:00
    (9/9): xmlsec1-openssl-1.2.20-4.el6.x86_64.rpm                       |  75 kB     00:00
    --------------------------------------------------------------------------------------------Total                                                       731 kB/s | 6.4 MB     00:09
    warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
    Importing GPG key 0x0608B895:
     Userid : EPEL (6) <epel@fedoraproject.org> Package: epel-release-6-8.noarch (installed) From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
    Is this ok [y/N]: y
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : libxslt-1.1.26-2.el6_3.1.x86_64                                          1/9
      Installing : libtool-ltdl-2.2.6-15.5.el6.x86_64                                       2/9
      Installing : xmlsec1-1.2.20-4.el6.x86_64                                              3/9
      Installing : xmlsec1-openssl-1.2.20-4.el6.x86_64                                      4/9
      Installing : libmspack-0.6-0.1.alpha.el6.x86_64                                       5/9
      Installing : fuse-libs-2.8.3-5.el6.x86_64                                             6/9
      Installing : libdnet-1.12-6.el6.x86_64                                                7/9
      Installing : libicu-4.2.1-14.el6.x86_64                                               8/9
      Installing : open-vm-tools-10.1.5-6.el6.x86_64                                        9/9
      Verifying  : xmlsec1-openssl-1.2.20-4.el6.x86_64                                      1/9
      Verifying  : libicu-4.2.1-14.el6.x86_64                                               2/9
      Verifying  : libdnet-1.12-6.el6.x86_64                                                3/9
      Verifying  : open-vm-tools-10.1.5-6.el6.x86_64                                        4/9
      Verifying  : xmlsec1-1.2.20-4.el6.x86_64                                              5/9
      Verifying  : libtool-ltdl-2.2.6-15.5.el6.x86_64                                       6/9
      Verifying  : libxslt-1.1.26-2.el6_3.1.x86_64                                          7/9
      Verifying  : fuse-libs-2.8.3-5.el6.x86_64                                             8/9
      Verifying  : libmspack-0.6-0.1.alpha.el6.x86_64                                       9/9
    Installed:  open-vm-tools.x86_64 0:10.1.5-6.el6
    Dependency Installed:
      fuse-libs.x86_64 0:2.8.3-5.el6               libdnet.x86_64 0:1.12-6.el6
      libicu.x86_64 0:4.2.1-14.el6                 libmspack.x86_64 0:0.6-0.1.alpha.el6
      libtool-ltdl.x86_64 0:2.2.6-15.5.el6         libxslt.x86_64 0:1.1.26-2.el6_3.1
      xmlsec1.x86_64 0:1.2.20-4.el6                xmlsec1-openssl.x86_64 0:1.2.20-4.el6
    Complete!
    

5.3. サービス有効化

  • サービス起動
# service vmtoolsd start

※ 実行結果が「OK」と出力されていることを確認

  • ステータス確認
# service vmtoolsd status
  • プロセス確認
# ps -ef | grep [v]mtools

※ 実行プロセス「/usr/sbin/vmtoolsd」が出力されていること

  • プロセスの自動起動が有効化されていることを確認
# chkconfig --list vmtoolsd

マルチユーザーモード(2, 3) が 「on」になっていること

(※ X Window Systemが稼働している場合は 5 もonである必要がある。)
サービス起動後、vshere clientからvmtoolsdステータスが有効であることを確認し作業終了です。

6. 参考

このスクラップは3日前にクローズされました