LoginSignup
6
5

More than 5 years have passed since last update.

Ubuntu 16.04 を VMware にインストール

Last updated at Posted at 2016-07-23

Ubuntu 16.04 LTS を VMware にインストールしたメモ

所感

  1. 普通に apt-get update すると起動時にエラーが出る(無視できるものかも)
  2. 普通にインストールしただけでは共有フォルダ機能が動かない
    1. 昔からトラブル多い機能だけど、ちょっとお粗末

環境

  1. Mac OS X 10.11.5 (英語)
  2. VMware Fusion 8.1.1
  3. ubuntu-16.04-server-amd64.iso

手順

  1. VMware の File メニューから New

    1. Install from disc or image を選んで Continue Screen Shot 2016-07-23 at 09.08.21.png
  2. ISO を選択
    Screen Shot 2016-07-23 at 09.09.32.png

  3. Use Easy Install は OFF にする
    Screen Shot 2016-07-23 at 09.21.04.png

    1. 毎回デフォルトで ON にするのホントに止めてほしい
    2. Ubuntu 16.04 では Easy Install ちゃんと動いたが、最近でも CentOS でインストーラーが止まってたことがあった
      1. 入社数年目だけど VMware 慣れてない人が結構な時間を無駄にしてた
        1. その人自体のスキルレベル云々という話もあるけど
        2. そもそも OS インストーラー程度の細部を隠そうという Microsoft 的な余計なお世話が開発者にとっては邪魔
        3. 大量に VM を作る時に手順を省略するには kickstart 使えば良い (マニュアル)
  4. Customize Settings でネットワークを Bridged へ変更し、 Printer, Sound Card, Camera などサーバーに不要なデバイスを削除する
    Screen Shot 2016-07-23 at 09.31.29.png

    1. 一旦セーブする必要がある Screen Shot 2016-07-23 at 09.32.28.png
    2. Settings 画面 Screen Shot 2016-07-23 at 09.33.16.png
    3. ホストや別マシンから ssh や http アクセスできるように Network Adapter 画面でデフォルトの Share with my Mac (NAT) から Bridged Networking へ変更 Screen Shot 2016-07-26 at 09.39.20.png
      1. NAT の Port Forwarding でも実現できるけれどパッチを適用しないとならないらしい8.1.1 で修正された とアナウンスされたが治ってない?)
    4. Remove Printer Port Screen Shot 2016-07-23 at 09.38.52.png
    5. Remove Sound Card Screen Shot 2016-07-23 at 09.38.13.png
    6. Remove Camera Screen Shot 2016-07-23 at 09.40.43.png
    7. Advanced で Power Options の Shut Down を Power Off (hard) に変更 Screen Shot 2016-07-23 at 09.46.21.png
      1. 最近の VMware Fusion では Virtual Machine メニューを開いて Option キーを押さないとPower Off ができなくなった
      2. Shut Down は OS 内部からできるし Power Off は Snapshot に戻る時に使いたい
  5. VM を起動
    Screen Shot 2016-07-23 at 09.51.28.png

  6. Language は English のまま
    Screen Shot 2016-07-23 at 09.51.49.png

    1. エラーメッセージなど English の方が Google し易い
  7. Install Ubuntu Server
    Screen Shot 2016-07-23 at 09.52.15.png

  8. 再度言語を聞かれるので English のまま
    Screen Shot 2016-07-23 at 09.54.03.png

  9. Region を United States から Japan に変更 (other -> Asia -> Japan)
    Screen Shot 2016-07-23 at 09.55.29.png

  10. Locale も英語のまま
    Screen Shot 2016-07-23 at 09.56.59.png

  11. キーボードは Japanese に変更しないと記号が打ちにくい
    Screen Shot 2016-07-23 at 09.57.38.png
    Screen Shot 2016-07-23 at 09.58.16.png
    Screen Shot 2016-07-23 at 09.59.33.png

  12. ここでデバイスやネットワーク情報が自動検出される
    Screen Shot 2016-07-23 at 09.59.54.png

  13. ホスト名を設定
    Screen Shot 2016-07-23 at 10.01.23.png

  14. ユーザ姓名、アカウント名、パスワードを設定
    Screen Shot 2016-07-23 at 10.02.20.png
    Screen Shot 2016-07-23 at 10.05.41.png
    Screen Shot 2016-07-23 at 10.08.25.png
    Screen Shot 2016-07-23 at 10.08.51.png

  15. ホームディレクトリの暗号化はしない(デフォルト)
    Screen Shot 2016-07-23 at 10.10.33.png

  16. 正しいタイムゾーンが自動的に検出された
    Screen Shot 2016-07-23 at 10.12.36.png

  17. LVM を使わないように変更
    Screen Shot 2016-07-23 at 11.10.56.png

    1. 仮にこの VM を ESXi に持ってったとしても LVM なしでリサイズできるらしいし
    2. 構成がシンプルになる
  18. ディスクを選択
    Screen Shot 2016-07-23 at 11.11.41.png

  19. 大きなパーティション1個とスワップ用のパーティションができるので Yes
    Screen Shot 2016-07-23 at 11.13.37.png

    1. No を選ぶとパーティション設定を調整できる
  20. 今回の環境ではプロキシは不要
    Screen Shot 2016-07-23 at 11.18.01.png

  21. 自動更新はしない(デフォルト)
    Screen Shot 2016-07-23 at 11.19.35.png

  22. standard system utilities がデフォルトで選択されている。 OpenSSH Server を追加選択(矢印とスペースキーを使う)
    Screen Shot 2016-07-26 at 09.59.07.png

    1. Server 用 ISO なんだから、デフォルトで ssh サーバーはインストールして欲しかった。
  23. ブートローダーを MBR へインストール(デフォルト)
    Screen Shot 2016-07-23 at 11.24.08.png

  24. インストール完了
    Screen Shot 2016-07-23 at 11.26.02.png

    1. 自動的に再起動するが、再起動後に素早く Power Off してスナップショットを取りたい
  25. 起動画面
    Screen Shot 2016-07-23 at 22.28.58.png

  26. バージョン情報
    Screen Shot 2016-07-23 at 22.30.03.png

    1. root ではログインできない
  27. パッケージを更新(依存関係が変化しているものも含めて)

    $ sudo apt-get dist-upgrade
    
    1. Mac から ssh 経由で実行すると Locale の選択画面が出てきてデフォルトの UTF8 を選択すると以下のエラーが出る

      locale: Cannot set LC_CTYPE to default locale: No such file or directory
      locale: Cannot set LC_ALL to default locale: No such file or directory
      
      1. これは Mac の LC_CTYPE 環境変数が UTF-8 だが Linux 側ではその名前の locale が存在しないため( en_US.UTF-8 なら存在する)
      2. 接続元 (Mac) の LC_CTYPE を接続先 (Linux) へ設定しないようにする

        1. /etc/ssh/sshd_config 内の AcceptEnv LANG LC_* をコメントアウトして ssh サーバーを再起動、 ssh 再接続してから apt-get を実行

          $ sudo systemctl restart ssh
          
      3. VMware 画面で実行すると、そもそも Locale の選択画面が出てこない

  28. パッケージ更新後の起動時のエラー [FAILED] Failed to start LXD - container startup/shutdown を回避

    1. 一度 root で lxd を再起動してやれば良い

      $ sudo service lxd restart
      
  29. dmesg で確認出来る起動時のエラー piix4_smbus 0000:00:007.3: SMBus Host controller not enabled! を回避

    1. Ubuntu が使おうとしている CPU の機能を VMware が提供していない

      1. $ sudo cp -p /etc/modprobe.d/blacklist.conf /etc/modprobe.d/blacklist.conf.dist
      2. $ sudo vi /etc/modprobe.d/blacklist.conf
      3. 以下を追加

        blacklist i2c-piix4
        
      4. 再起動

  30. VMware Tools をアップデート

    1. open-vm-tools がインストール済みなのに Enable Shared Folders を ON にするとエラー
      Screen Shot 2016-07-24 at 00.02.10.png
      Screen Shot 2016-07-24 at 00.01.46.png

      $ vmware-toolbox-cmd -v
      10.0.7.52125 (build-3227872)
      
    2. VMware のドキュメントに従って vmhgfs ドライバーをインストールしても改善しなかった (VMwareTools-10.0.6-3595377)

      1. VMware の Virtual Machine メニューから Reinstall VMware Tools を選び Install ボタンを押してから

        $ sudo mount /dev/cdrom /media/cdrom
        $ tar xzf /media/cdrom/VMwareTools-10.0.6-3595377.tar.gz
        $ sudo vmware-tools-distrib/vmware-install.pl
        
      2. 全てのデフォルト値を受け入れる

      3. このステップを飛ばすと自動マウントされない

      4. インストール済みの open-vm-tools を上書きはしないらしい

    3. github の open-vm-tools から最新の vmhgfs カーネルモジュールをビルドしてインストール(ただし open-vm-tools-desktop はインストールしない)

      $ sudo apt-get install git build-essential autoconf libtool
      $ sudo apt-get install libmspack-dev libglib2.0-dev libprocps4-dev libdumbnet-dev
      $ git clone https://github.com/vmware/open-vm-tools.git
      $ cd open-vm-tools/open-vm-tools/
      $ git log -n 1
      commit 4b745c70aaeaab4adb35fd682a3e60fc7a315ec9
      Author: Ravindra Kumar <ravindrakumar@vmware.com>
      Date:   Wed Jun 15 13:14:07 2016 -0700
      
          Added details about open-vm-tools-desktop
      
      $ autoreconf -i
      $ ./configure --without-x --without-pam --without-ssl --without-icu
      $ make MODULES=vmhgfs
      $ sudo insmod modules/linux/vmhgfs/vmhgfs.ko
      $ reboot
      
    4. これで共有フォルダが /mnt/hgfs に自動マウントされる

参考: vmware-install.pl の出力

$ sudo vmware-tools-distrib/vmware-install.pl
The installer has detected an existing installation of open-vm-tools on this 
system and will not attempt to remove and replace these user-space 
applications. It is recommended to use the open-vm-tools packages provided by 
the operating system. If you do not want to use the existing installation of 
open-vm-tools and attempt to install VMware Tools, you must uninstall the 
open-vm-tools packages and re-run this installer.
The packages that need to be removed are:
open-vm-tools
The installer will next check if there are any missing kernel drivers. Type yes
if you want to do this, otherwise type no [yes] 

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] 

What is the directory that contains the init scripts? 
[/etc/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 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-3595377 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] 

The file /usr/bin/vmware-hgfsclient that this program was about to install 
already exists.  Overwrite? [no] 

The file /usr/bin/vmhgfs-fuse that this program was about to install already 
exists.  Overwrite? [no] 

The file /sbin/mount.vmhgfs that this program was about to install already 
exists.  Overwrite? [no] 

Initializing...


Making sure services for VMware Tools are stopped.

Stopping VMware Tools services in the virtual machine:
   VMware User Agent (vmware-user):                                    done
   Unmounting HGFS shares:                                             done
   Guest filesystem driver:                                            done
Stopping Thinprint services in the virtual machine:
   Stopping Virtual Printing daemon:                                   done


update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
insserv: Service cups has to be enabled to start service vmware-tools-thinprint
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
WARNING: The installer initially used the 'udpate-rc.d' to setup the 
vmware-tools service.  That command cannot be found.  Please re-install the 
'sysv-rc' package.  This script will now attempt to manually setup the 
vmware-tools service.The module vmci has already been installed on this system by another installer 
or package and will not be modified by this installer.

The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.

The module vmxnet3 has already been installed on this system by another 
installer or package and will not be modified by this installer.

The module pvscsi has already been installed on this system by another 
installer or package and will not be modified by this installer.

The module vmmemctl has already been installed on this system by another 
installer or package and will not be modified by this installer.

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? [yes] 

The vmxnet driver is no longer supported on kernels 3.3 and greater. Please 
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)

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] 

Creating a new initrd boot image for the kernel.
update-initramfs: Generating /boot/initrd.img-4.4.0-31-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
   Checking acpi hot plug                                              done
Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:                                   done
   Guest filesystem driver:                                            done
   Mounting HGFS shares:                                               done
   Starting Virtual Printing daemon:                                   done
The configuration of VMware Tools 10.0.6 build-3595377 for Linux for this 
running kernel completed successfully.

Enjoy,

--the VMware team

Found VMware Tools CDROM mounted at /media/cdrom. Ejecting device /dev/sr0 ...
6
5
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
6
5