LoginSignup
2
3

More than 5 years have passed since last update.

[メモ] CentOS 4.x を VMWareにインストール(いまさら..)

Last updated at Posted at 2016-06-21

CentOS4_1.png

概要

  • VMWare(ESXi 6)のゲストOSとして、CentOS 4.9をインストール
  • CentOS-4.8-i386-binDVD.isoを使用

手順

VM Guest

  1. CentOS 4.8のインストールISOを入手する (4.8を入れてから、あとで4.9にアップデートする)
  2. VMを作成
    • ネットワークアダプタを E1000
    • CDは、IDE1.0
  3. ISOから起動してインストール
    • Firewall は、[カスタマイズ]を選んで、sshを通すようにする

CentOS 4.9

ログインして設定

  1. アップデート - vault.centos.orgのみで取得可能なもよう。

    sed -i 's/mirrorlist=h /#mirrorlist=h/g' /etc/yum.repos.d/CentOS-Base.repo
    sed -i  's/#baseurl=http:\/\/mirror.centos.org\/centos\/$releasever/baseurl=http:\/\/vault.centos.org\/4.9/g'  /etc/yum.repos.d/CentOS-Base.repo
    yum update -y
    reboot
    
  2. ユーザ追加など

    adduser newusername
    passwd newusername
    visudo
    
    /etc/sudoers-visudoで編集
    ...
    # User privilege specification
    root    ALL=(ALL) ALL
    newusername    ALL=(ALL) ALL
    # Uncomment to allow people in group wheel to run all commands
    ...
    

 SRPMからビルドの準備

  1. sudo vi /etc/yum.repos.d/srpm.repo
    SRPMのレポジトリ設定

    /etc/yum.repos.d/srpm.repoファイル作成
    [os-srpm-centos]
    name=CentOS OS $releasever - $basearch - Source from centos
    baseurl=http://vault.centos.org/4.9/os/SRPMS/
    enabled=1
    priority=1[updates-srpm-centos]
    name=CentOS UPDATES $releasever - $basearch - Source from centos
    baseurl=http://vault.centos.org/4.9/updates/SRPMS/
    enabled=1
    priority=1
    [extras-srpm-centos]
    name=CentOS EXTRAS $releasever - $basearch - Source from centos
    baseurl=http://vault.centos.org/4.9/extras/SRPMS/
    enabled=1
    priority=1
    [centosplus-srpm-centos]
    name=CentOS CENTOSPLUS $releasever - $basearch - Source from centos
    baseurl=http://vault.centos.org/4.9/centosplus/SRPMS/
    enabled=0
    priority=1
    [contrib-srpm-centos]
    name=CentOS CONTRIB $releasever - $basearch - Source from centos
    baseurl=http://vault.centos.org/4.9/contrib/SRPMS/
    enabled=0
    priority=1
    [fasttrack-srpm-centos]
    name=CentOS FASTTRACK $releasever - $basearch - Source from centos
    baseurl=http://vault.centos.org/4.9/fasttrack/SRPMS/
    enabled=0
    priority=1
    [cr-srpm-centos]
    name=CentOS CR $releasever - $basearch - Source from centos
    baseurl=http://vault.centos.org/4.9/cr/SRPMS/
    enabled=0
    priority=1
    
  2. ビルド関係のツール

    sudo yum groupinstall "Development Tools"
    sudo yum install yum-utils
    

EPEL

wget http://download.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm
rpm -ivh ./epel-release-4-10.noarch.rpm
# デフォルトでは使わない
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/epel.repo
# アップデート
yum --enablerepo=epel -y update epel-release
  • yum install --enablerepo=epel htop
    (例) htop
htopをインストール
[root@localhost ~]# yum install htop   ##通常のレポだとない
Setting up Install Process
Setting up repositories
not using ftp, http[s], or file for repos, skipping - Invalid release
...
Reading repository metadata in from local files
Parsing package install arguments
No Match for argument: htop
Nothing to do

[root@localhost ~]# yum install --enablerepo=epel htop  ##EPELのレポから取得
Setting up Install Process
Setting up repositories
not using ftp, http[s], or file for repos, skipping - Invalid release
...
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for htop to pack into transaction set.
htop-0.8.3-1.el4.i386.rpm 100% |=========================| 5.1 kB    00:00     
---> Package htop.i386 0:0.8.3-1.el4 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Installing:
 htop                    i386       0.8.3-1.el4      epel               62 k

Transaction Summary
=============================================================================
Install      1 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         
Total download size: 62 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): htop-0.8.3-1.el4.i 100% |=========================|  62 kB    00:00     
warning: rpmts_HdrFromFdno: V3 DSA signature: NOKEY, key ID 217521f6
Public key for htop-0.8.3-1.el4.i386.rpm is not installed
Retrieving GPG key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
Importing GPG key 0x217521F6 "Fedora EPEL <epel@fedoraproject.org>"
Is this ok [y/N]: y
Key imported successfully
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: htop                         ######################### [1/1] 

Installed: htop.i386 0:0.8.3-1.el4
Complete!
[root@localhost ~]

VMWare Tools

カーネルを最新(2.6.9-103)にUpgradeしてからやる

  1. Insert VMTools
  2. ファイル解凍

    cd /tmp
    sudo mount -o ro /media/cdrecorder
    tar zxf /media/cdrecorder/VMwareTools-10.0.6-3560309.tar.gz
    sudo umount /media/cdrecorder
    cd vmware-tools-distrib
    sudo ./vmware-install.pl
    

    いろいろ聞かれるが、↓以外は、すべて、[Enter]キーおして、デフォルトを選んだ。

    Would you like to enable VMware automatic kernel modules?
    [no] yes
    
  3. sudo reboot

  4. ホストから、VM Guestの、IPみれたり、シャットダウンとか、選択できるようになる。

wgetのビルド

cd 
mkdir -p dev/wget
cd dev/wget
# ソースのダウンロード
yumdownloader --source wget
# => CentOS 4.9:: wget-1.10.2-1.el4_8.1.src.rpm
#ビルドに必要なパッケージ
sudo yum-builddep ./wget-1.10.2-1.el4_8.1.src.rpm
#
# ソース解凍、ビルド
echo '%_topdir %(echo $HOME)/dev/wget/rpmbuild' > ~/.rpmmacros
mkdir -p ./rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
rpm -i ./wget-1.10.2-1.el4_8.1.src.rpm
cd rpmbuild/SPECS/
rpmbuild -bb --target=`uname -m` ./wget.spec
##
cd ../RPMS/`uname -m`
ls -la

カーネルのビルド

cd 
mkdir -p dev/kernel
cd dev/kernel
# ソースのダウンロード
yumdownloader --source kernel
# => CentOS 4.9:: kernel-2.6.9-103.EL.src.rpm 
sudo yum-builddep ./kernel-2.6.9-103.EL.src.rpm
#
# ソース解凍、ビルド
echo '%_topdir %(echo $HOME)/dev/kernel/rpmbuild' > ~/.rpmmacros
mkdir -p ./rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
rpm -i ./kernel-2.6.9-103.EL.src.rpm
cd rpmbuild/SPECS/
rpmbuild -bb --target=`uname -m` kernel-2.6.spec
##
cd ../RPMS/`uname -m`
ls -la

その他

VMtoolsのインストールログ

[mt08@centos4 vmware-tools-distrib]$ sudo ./vmware-install.pl 

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these two things:

    #1) Respect the privacy of others.
    #2) Think before you type.

Password:
Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools.

In which directory do you want to install the binary files? 
[/usr/bin] 

What is the directory that contains the init directories (rc0.d/ to rc6.d/)? 
[/etc/rc.d] 

What is the directory that contains the init scripts? 
[/etc/rc.d/init.d] 

In which directory do you want to install the daemon files? 
[/usr/sbin] 

In which directory do you want to install the library files? 
[/usr/lib/vmware-tools] 

The path "/usr/lib/vmware-tools" does not exist currently. This program is 
going to create it, including needed parent directories. Is this what you want?
[yes] 

In which directory do you want to install the common agent library files? 
[/usr/lib] 

In which directory do you want to install the common agent transient files? 
[/var/lib] 

In which directory do you want to install the documentation files? 
[/usr/share/doc/vmware-tools] 

The path "/usr/share/doc/vmware-tools" does not exist currently. This program 
is going to create it, including needed parent directories. Is this what you 
want? [yes] 

The installation of VMware Tools 10.0.6 build-3560309 for Linux completed 
successfully. You can decide to remove this software from your system at any 
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by 
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want 
this program to invoke the command for you now? [yes] 

Initializing...


Making sure services for VMware Tools are stopped.

Stopping VMware Tools services in the virtual machine:
   Guest operating system daemon:                          [  OK  ]
   VMware User Agent (vmware-user):                        [  OK  ]
   Unmounting HGFS shares:                                 [  OK  ]
   Guest filesystem driver:                                [  OK  ]


The VMware FileSystem Sync Driver (vmsync) allows external third-party backup 
software that is integrated with vSphere to create backups of the virtual 
machine. Do you wish to enable this feature? [no] 

Found a compatible pre-built module for vmci.  Installing it...


Found a compatible pre-built module for vsock.  Installing it...


You are running Linux version 2.6.9.  The driver for the VMXNET 3 virtual 
network card is only available for 2.6.10 and later kernels.
[ Press Enter key to continue ] 

The VMware pvscsi module is only supported on kernel version 2.6.32 and newer, 
or rhel5 distributions.
Found a compatible pre-built module for vmmemctl.  Installing it...


The VMware Host-Guest Filesystem allows for shared folders between the host OS 
and the guest OS in a Fusion or Workstation virtual environment.  Do you wish 
to enable this feature? [no] 

Found a compatible pre-built module for vmxnet.  Installing it...


The vmblock enables dragging or copying files between host and guest in a 
Fusion or Workstation virtual environment.  Do you wish to enable this feature?
[no] 

VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can
be enabled/disabled by re-running vmware-config-tools.pl.

Would you like to enable VMware automatic kernel modules?
[no] yes

Do you want to enable Guest Authentication (vgauth)? Enabling vgauth is needed 
if you want to enable Common Agent (caf). [yes] 

No X install found.

Creating a new initrd boot image for the kernel.
Generating the key and certificate files.
Successfully generated the key and certificate files.
   Checking acpi hot plug                                  [  OK  ]
Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:                       [  OK  ]
   VMware Automatic Kmods:                                 [  OK  ]
   Guest memory manager:                                   [  OK  ]
   VM communication interface:                             [  OK  ]
   VM communication interface socket family:               [  OK  ]
   Guest operating system daemon:                          [  OK  ]
   VGAuthService:                                          [  OK  ]
The configuration of VMware Tools 10.0.6 build-3560309 for Linux for this 
running kernel completed successfully.

You must restart your X session before any mouse or graphics changes take 
effect.

You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the
command line.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and 
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.

Enjoy,

--the VMware team

[mt08@centos4 vmware-tools-distrib]$ 
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3