Setting up a vagrant with a digitalocean image

前端 未结 2 1829
情歌与酒
情歌与酒 2021-02-19 20:37

I dont know if this should be posted here or on another stack community so please let me know if its wrong posting it here.

How do I get a local (i.e. on my laptop) VM t

2条回答
  •  无人及你
    2021-02-19 21:10

    It should be possible, I never tried myself (as I switch to EC2) but I saw there was a digital ocean plugin, you can refer to the following page https://www.digitalocean.com/community/tutorials/how-to-use-digitalocean-as-your-provider-in-vagrant-on-an-ubuntu-12-10-vps

    Basically you would need the following:

    1. install the plugin and download the base box

      vagrant plugin install vagrant-digitalocean
      vagrant box add digital_ocean https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box
      
    2. create the SSH keys needed for authentication with DigitalOcean. Run the following command to generate your SSH key pair:

      ssh-keygen -t rsa
      

      You can accept the defaults by pressing enter. This will place the SSH private and public keys to the path we will specify below in the Vagrantfile configuration.

    3. create your Vagrantfile with following minimal configuration

      config.vm.box = "digital_ocean"
      config.ssh.private_key_path = "~/.ssh/id_rsa"
      config.vm.provider :digital_ocean do |provider|
          provider.client_id = "YOUR CLIENT ID"
          provider.api_key = "YOUR API KEY"
          provider.image = "Ubuntu 12.10 x64"
          provider.region = "New York 2"
        end
      
    4. run vagrant

      vagrant up --provider=digital_ocean
      

    You can refer to above link for additional parameters and fix for some issues you could face

提交回复
热议问题