LoginSignup
40
45

More than 5 years have passed since last update.

Vagrant+Parallels上でCentOSを動かす

Last updated at Posted at 2015-08-07

vagrantでvirtualboxを使ってCentOSをsetupする例は多いが、providerにparallelsを使った情報(というよりVagrantfileの例)が少なかったのでメモ.
まぁ無料じゃないですしね…

バージョン情報

  • vagrant 1.7.4
  • Parallels 10.2.1
  • CentOS 7.1

参考URL

セットアップ

vagrant-parallesインストール

Vagrantでparallelsが使えるように、vagrant-parallesを追加する

$ vagrant plugin install vagrant-parallels

Vagrantfileを準備する

$ mkdir -p $HOME/vagrant/centos7.1
$ cd $HOME/vagrant/centos7.1
$ vi Vagrantfile

環境に合わせて設定する.

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  config.vm.box = "parallels/centos-7.1"
  config.vm.network "forwarded_port", guest: 80, host: 8080
  config.vm.network "private_network", ip: "192.168.33.11"
  config.vm.synced_folder ".", "/data"

  config.vm.provider "parallels" do |v|
    v.name = "canvas"
    v.update_guest_tools = true # parallels toolsの自動updateを許可するか
    v.optimize_power_consumption = false # パフォーマンスかバッテリー優先か(デフォルトはfalse)
    v.customize [ "set", :id,
                  "--cpus", 4,
                  "--memsize", 1536,
                  "--autostart", "off",   # parallelsを起動させた時の挙動(デフォルトはoff)
                  "--autostop", "suspend" # parallelsを停止させた時の挙動を指定
                ]
  end
end

起動

vagrant upで起動させて完了
※ Vagrantfileで指定してるので--provider=parallesは無くてもOK

$ vagrant up
Bringing machine 'default' up with 'parallels' provider...
==> default: Checking if box 'parallels/centos-7.1' is up to date...
==> default: Setting the name of the VM: canvas
==> default: Preparing network interfaces based on configuration...
    default: Adapter 0: shared
    default: Adapter 1: hostonly
==> default: Clearing any previously set network interfaces...
==> default: Forwarding ports...
    default: 80 => 8080
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 10.211.55.6:22
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection refused. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for Parallels Tools installed on the VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /data => /Users/user/vagrant/centos7.1

Vagrantでできなかった設定

macの優先度をあげたかったけど、以下の設定に該当する部分がprtctlになかったのでVagrantfileで弄れなかった…。手で弄って最終的に変更したけどここはできないのかな?

スクリーンショット 2015-08-07 12.21.37.png

40
45
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
40
45