{"id":26448,"date":"2023-10-17T13:16:20","date_gmt":"2022-11-24T03:00:39","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/"},"modified":"2025-08-11T21:20:49","modified_gmt":"2025-08-11T13:20:49","slug":"%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/","title":{"rendered":"\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4"},"content":{"rendered":"<h1>\u9996\u5148Vagrant\u662f\u4e00\u4e2a\u7528\u4e8e\u8f7b\u677e\u521b\u5efa\u865a\u62df\u73af\u5883\u7684\u5de5\u5177\u3002<\/p>\n<p>\u8fd9\u6b21\u4f5c\u4e3a\u6211\u7684\u5907\u5fd8\u5f55\uff0c\u6211\u5c06\u603b\u7ed3\u4f7f\u7528Vagrant\u5728Mac\u7535\u8111\u4e0a\u521b\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4\u3002<\/p>\n<p>\u5047\u8bbe\u524d\u63d0\u662fMac\u7535\u8111\u5df2\u7ecf\u5b89\u88c5\u4e86VirtualBox\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u94fe\u63a5\u7684\u7f51\u7ad9\u4e0a\u4e0b\u8f7dVirtualBox\uff1ahttps:\/\/www.virtualbox.org\/<\/p>\n<h1>2. \u51c6\u5907\u5de5\u4f5c\u9996\u5148\uff0c\u5728Mac PC\u4e0a\u5b89\u88c5Vagrant\u3002<\/p>\n<h2>2-1. \u4e0b\u8f7d\u4ece\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7dVagrant\u3002<\/p>\n<p>\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u94fe\u63a5\u83b7\u53d6\u4e0b\u8f7d\u56fe\u50cf\u3002<\/p>\n<p>\u6d41\u6d6a\u8005\uff1a\u4e0b\u8f7dVagrant<br \/>\nhttps:\/\/www.vagrantup.com\/downloads.html<\/p>\n<p>\u6253\u5f00URL\u540e\uff0c\u4f1a\u663e\u793a\u5982\u4e0b\u9875\u9762\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657c24bbd0c9c81e0f5c8ea8\/12-0.png\" alt=\"image.png\" \/>\u8fd9\u6b21\u6211\u4eec\u5c06\u5728Mac PC\u4e0a\u5b89\u88c5Vagrant\uff0c\u6240\u4ee5\u9009\u62e9macOS\u7684\u955c\u50cf\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657c24bbd0c9c81e0f5c8ea8\/14-0.png\" alt=\"image.png\" \/>\u203b\u672c\u6b21\u5f15\u51652.2.7\u7248\u672c\u3002<\/p>\n<h2>2-2. \u5b89\u88c5(1) \u6253\u5f00\u5b89\u88c5\u7a0b\u5e8f<\/p>\n<p>\u6253\u5f00\u4e0b\u8f7d\u7684Vagrant\u5b89\u88c5\u7a0b\u5e8f\uff0c\u4f1a\u663e\u793a\u5982\u4e0b\u7a97\u53e3\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657c24bbd0c9c81e0f5c8ea8\/19-0.png\" alt=\"image.png\" \/>\u70b9\u51fb&#8221;\u7ee7\u7eed&#8221;<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657c24bbd0c9c81e0f5c8ea8\/21-0.png\" alt=\"image.png\" \/>\u9009\u62e9\u8981\u5b89\u88c5\u7684\u78c1\u76d8\uff0c\u5e76\u70b9\u51fb\u201c\u7ee7\u7eed\u201d\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657c24bbd0c9c81e0f5c8ea8\/23-0.png\" alt=\"image.png\" \/>\u70b9\u51fb[\u5b89\u88c5]\uff0c\u5f00\u59cb\u5b89\u88c5\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657c24bbd0c9c81e0f5c8ea8\/25-0.png\" alt=\"image.png\" \/>\u5f00\u59cb\u5b89\u88c5\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657c24bbd0c9c81e0f5c8ea8\/27-0.png\" alt=\"image.png\" \/>\u70b9\u51fb[\u5173\u95ed]\uff0c\u5b8c\u6210\u5b89\u88c5\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657c24bbd0c9c81e0f5c8ea8\/29-0.png\" alt=\"image.png\" \/><\/p>\n<h2>2-3. \u7248\u672c\u68c0\u67e5\u6253\u5f00\u7ec8\u7aef\u5e76\u68c0\u67e5\u5b89\u88c5\u7684Vagrant\u7248\u672c\u3002<\/p>\n<p>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u786e\u8ba4\u7248\u672c:<br \/>\n&lt;\u547d\u4ee4&gt;<\/p>\n<pre class=\"post-pre\"><code>vagrant --version\r\n<\/code><\/pre>\n<p>\u6267\u884c\u4ee5\u4e0a\u547d\u4ee4\u3002&lt;\u6267\u884c&gt;<\/p>\n<pre class=\"post-pre\"><code>$ vagrant --version\r\nVagrant 2.2.7\r\n<\/code><\/pre>\n<p>\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u8fd9\u6b21\u5f15\u5165\u4e86Vagrant\u7248\u672c2.2.7\u3002<\/p>\n<h1>3. \u521b\u5efa\u865a\u62df\u673a\u4f7f\u7528Vagrant\u5728Mac\u7535\u8111\u4e0a\u521b\u5efaCentOS 7\u865a\u62df\u673a\u3002<\/p>\n<h2>\u65b0\u589e\u4e00\u4e2aBOX\u76d2\u5b50\u662f\u865a\u62df\u673a\u7684\u6a21\u677f\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u7f51\u7ad9\u7b49\u5730\u65b9\u627e\u5230BOX\u3002<\/p>\n<p>Vagrantbox.es\u662f\u4e00\u4e2a\u7f51\u7ad9\uff0c\u63d0\u4f9b\u5404\u79cd\u53ef\u7528\u7684\u865a\u62df\u673a\u8f6f\u4ef6\u3002<\/p>\n<p>Vagrant \u4e91\uff1a\u53d1\u73b0 Vagrant \u76d2\u5b50<br \/>\nhttps:\/\/app.vagrantup.com\/boxes\/search<\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u6dfb\u52a0\u548c\u786e\u8ba4 Box\u3002<br \/>\n&lt;\u547d\u4ee4&gt;<\/p>\n<p>\u30fb\u589e\u52a0\u76d2\u5b50<\/p>\n<pre class=\"post-pre\"><code>vagrant box add {BOXNAME} {URL}\r\n<\/code><\/pre>\n<p>\u786e\u8ba4\u76d2\u5b50<\/p>\n<pre class=\"post-pre\"><code>vagrant box list\r\n<\/code><\/pre>\n<p>\u6267\u884c\u4e0a\u8ff0\u547d\u4ee4\u3002<\/p>\n<p>\u30fb\u589e\u52a0\u7bb1\u5b50<\/p>\n<p>\u4e3a\u4e86\u6dfb\u52a0 CentOS7 \u7684 Box\uff0c\u672c\u6b21\u6211\u4eec\u5c06\u53c2\u8003\u4ee5\u4e0b\u94fe\u63a5\u5e76\u6267\u884c\u547d\u4ee4\u3002<br \/>\nhttps:\/\/app.vagrantup.com\/centos\/boxes\/7<\/p>\n<p>\u203b \u4f9b\u5e94\u5546\u5c06\u9009\u62e9[3) virtualbox]\u3002<\/p>\n<pre class=\"post-pre\"><code>$ vagrant box add centos\/7\u00a0\r\n==&gt; box: Loading metadata for box 'centos\/7'\r\n\u00a0 \u00a0 box: URL: https:\/\/vagrantcloud.com\/centos\/7\r\nThis box can work with multiple providers! The providers that it\r\ncan work with are listed below. Please review the list and choose\r\nthe provider you will be working with.\r\n\r\n1) hyperv\r\n2) libvirt\r\n3) virtualbox\r\n4) vmware_desktop\r\n\r\nEnter your choice: 3\r\n==&gt; box: Adding box 'centos\/7' (v1905.1) for provider: virtualbox\r\n\u00a0 \u00a0 box: Downloading: https:\/\/vagrantcloud.com\/centos\/boxes\/7\/versions\/1905.1\/providers\/virtualbox.box\r\n\u00a0 \u00a0 box: Download redirected to host: cloud.centos.org\r\n==&gt; box: Successfully added box 'centos\/7' (v1905.1) for 'virtualbox'!\r\n\r\n<\/code><\/pre>\n<p>\u30fb\u786e\u8ba4\u76d2\u5b50<\/p>\n<p>\u786e\u8ba4CentOS7\u7684Box\u5df2\u7ecf\u88ab\u6dfb\u52a0\u3002<\/p>\n<pre class=\"post-pre\"><code>$ vagrant box list\r\ncentos\/7\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (virtualbox, 1905.1)\r\n<\/code><\/pre>\n<h2>3-2. \u865a\u62df\u673a\u521d\u59cb\u5316<br \/>\n\u901a\u8fc7\u8fdb\u884c\u865a\u62df\u673a\u521d\u59cb\u5316\uff0c\u521b\u5efa\u4e00\u4e2a\u8bbe\u7f6e\u6587\u4ef6\uff08Vagrantfile\uff09\u3002<\/p>\n<p>\u5728\u8fdb\u884c\u865a\u62df\u673a\u521d\u59cb\u5316\u65f6\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a&lt;\u547d\u4ee4&gt;<\/p>\n<p>\u30fb\u865a\u62df\u673a\u521d\u59cb\u5316<\/p>\n<pre class=\"post-pre\"><code>vagrant init {BOXNAME}\r\n<\/code><\/pre>\n<p>\u6267\u884c\u4e0a\u8ff0\u547d\u4ee4\u3002<\/p>\n<p>\u30fb(\u51c6\u5907)\u521b\u5efa\u548c\u79fb\u52a8\u76ee\u5f55<\/p>\n<p>\u6309\u7167\u865a\u62df\u673a\u7684\u4e0d\u540c\uff0c\u521b\u5efa\u5bf9\u5e94\u7684\u6587\u4ef6\u5939\uff0c\u5728\u5176\u4e2d\u521b\u5efa\u914d\u7f6e\u6587\u4ef6\uff08Vagrantfile\uff09\u3002<\/p>\n<p>\u521b\u5efa\u5e76\u79fb\u52a8\u5230\u4e00\u4e2a\u4ee5\u4efb\u610f\u540d\u79f0\u547d\u540d\u7684\u76ee\u5f55\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code>$ cd ~\/vagrant\/\r\n$ mkdir centos7\r\n$ cd centos7\/\r\n<\/code><\/pre>\n<p>\u30fb\u865a\u62df\u673a\u521d\u59cb\u5316<\/p>\n<p>\u901a\u8fc7\u6307\u5b9a\u5728\u5148\u524d\u7684\u9879\u76ee\u4e2d\u6dfb\u52a0\u7684BOX &#8216;centos\/7&#8217;\uff0c\u8fdb\u884c\u865a\u62df\u673a\u521d\u59cb\u5316\uff0c\u4ece\u800c\u5728\u76ee\u5f55\u4e2d\u521b\u5efa\u865a\u62df\u673a\u7684\u521d\u59cb\u8bbe\u7f6e\u6587\u4ef6\uff08\u521d\u59cbVagrantfile\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>$ vagrant init centos\/7\r\nA `Vagrantfile` has been placed in this directory. You are now\r\nready to `vagrant up` your first virtual environment! Please read\r\nthe comments in the Vagrantfile as well as documentation on\r\n`vagrantup.com` for more information on using Vagrant.\r\n\r\n<\/code><\/pre>\n<p>\u4f60\u53ef\u4ee5\u786e\u8ba4\u5728\u6267\u884c\u547d\u4ee4\u7684\u5f53\u524d\u76ee\u5f55\u4e2d\u5df2\u521b\u5efa\u4e86Vagrantfile\u3002<\/p>\n<pre class=\"post-pre\"><code>$ ls\r\nVagrantfile\r\n<\/code><\/pre>\n<p>\uff08\u68c0\u67e5 Vagrantfile \u7684\u5185\u5bb9\uff09<\/p>\n<pre class=\"post-pre\"><code>$ cat Vagrantfile \r\n# -*- mode: ruby -*-\r\n# vi: set ft=ruby :\r\n\r\n# All Vagrant configuration is done below. The \"2\" in Vagrant.configure\r\n# configures the configuration version (we support older styles for\r\n# backwards compatibility). Please don't change it unless you know what\r\n# you're doing.\r\nVagrant.configure(\"2\") do |config|\r\n  # The most common configuration options are documented and commented below.\r\n  # For a complete reference, please see the online documentation at\r\n  # https:\/\/docs.vagrantup.com.\r\n\r\n  # Every Vagrant development environment requires a box. You can search for\r\n  # boxes at https:\/\/vagrantcloud.com\/search.\r\n  config.vm.box = \"centos\/7\"\r\n\r\n  # Disable automatic box update checking. If you disable this, then\r\n  # boxes will only be checked for updates when the user runs\r\n  # `vagrant box outdated`. This is not recommended.\r\n  # config.vm.box_check_update = false\r\n\r\n  # Create a forwarded port mapping which allows access to a specific port\r\n  # within the machine from a port on the host machine. In the example below,\r\n  # accessing \"localhost:8080\" will access port 80 on the guest machine.\r\n  # NOTE: This will enable public access to the opened port\r\n  # config.vm.network \"forwarded_port\", guest: 80, host: 8080\r\n\r\n  # Create a forwarded port mapping which allows access to a specific port\r\n  # within the machine from a port on the host machine and only allow access\r\n  # via 127.0.0.1 to disable public access\r\n  # config.vm.network \"forwarded_port\", guest: 80, host: 8080, host_ip: \"127.0.0.1\"\r\n\r\n  # Create a private network, which allows host-only access to the machine\r\n  # using a specific IP.\r\n  # config.vm.network \"private_network\", ip: \"192.168.33.10\"\r\n\r\n  # Create a public network, which generally matched to bridged network.\r\n  # Bridged networks make the machine appear as another physical device on\r\n  # your network.\r\n  # config.vm.network \"public_network\"\r\n\r\n  # Share an additional folder to the guest VM. The first argument is\r\n  # the path on the host to the actual folder. The second argument is\r\n  # the path on the guest to mount the folder. And the optional third\r\n  # argument is a set of non-required options.\r\n  # config.vm.synced_folder \"..\/data\", \"\/vagrant_data\"\r\n\r\n  # Provider-specific configuration so you can fine-tune various\r\n  # backing providers for Vagrant. These expose provider-specific options.\r\n  # Example for VirtualBox:\r\n  #\r\n  # config.vm.provider \"virtualbox\" do |vb|\r\n  #   # Display the VirtualBox GUI when booting the machine\r\n  #   vb.gui = true\r\n  #\r\n  #   # Customize the amount of memory on the VM:\r\n  #   vb.memory = \"1024\"\r\n  # end\r\n  #\r\n  # View the documentation for the provider you are using for more\r\n  # information on available options.\r\n\r\n  # Enable provisioning with a shell script. Additional provisioners such as\r\n  # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the\r\n  # documentation for more information about their specific syntax and use.\r\n  # config.vm.provision \"shell\", inline: &lt;&lt;-SHELL\r\n  #   apt-get update\r\n  #   apt-get install -y apache2\r\n  # SHELL\r\nend\r\n\r\n<\/code><\/pre>\n<h2>3-3. \u51c6\u5907\u865a\u62df\u673a<br \/>\n\u542f\u52a8\u521b\u5efa\u7684\u865a\u62df\u673a\u3002<\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff0c\u542f\u52a8\u5e76\u786e\u8ba4\u865a\u62df\u673a\u7684\u72b6\u6001\u3002<br \/>\n&lt;\u547d\u4ee4&gt;<\/p>\n<p>\u2022 \u542f\u52a8\u865a\u62df\u673a<\/p>\n<pre class=\"post-pre\"><code>vagrant up\r\n<\/code><\/pre>\n<p>\u30fb\u786e\u8ba4\u865a\u62df\u673a\u7684\u72b6\u6001<\/p>\n<pre class=\"post-pre\"><code>vagrant status\r\n<\/code><\/pre>\n<p>\u6267\u884c\u4e0a\u8ff0\u547d\u4ee4\u3002<\/p>\n<p>\u79fb\u52d5\u5230\u914d\u7f6e\u4e86Vagrantfile\u7684\u76ee\u5f55\u5e76\u8fdb\u884c\u786e\u8ba4\u3002<\/p>\n<pre class=\"post-pre\"><code>$ cd ~\/vagrant\/centos7\/\r\n$ ls\r\nVagrantfile\r\n<\/code><\/pre>\n<p>\u30fb\u542f\u52a8\u865a\u62df\u673a<\/p>\n<pre class=\"post-pre\"><code>$ vagrant up\r\nBringing machine 'default' up with 'virtualbox' provider...\r\n==&gt; default: Importing base box 'centos\/7'...\r\n==&gt; default: Matching MAC address for NAT networking...\r\n==&gt; default: Checking if box 'centos\/7' version '1905.1' is up to date...\r\n==&gt; default: Setting the name of the VM: centos7_default_1587971622673_54447\r\n==&gt; default: Clearing any previously set network interfaces...\r\n==&gt; default: Preparing network interfaces based on configuration...\r\n    default: Adapter 1: nat\r\n==&gt; default: Forwarding ports...\r\n    default: 22 (guest) =&gt; 2222 (host) (adapter 1)\r\n==&gt; default: Booting VM...\r\n==&gt; default: Waiting for machine to boot. This may take a few minutes...\r\n    default: SSH address: 127.0.0.1:2222\r\n    default: SSH username: vagrant\r\n    default: SSH auth method: private key\r\n    default: \r\n    default: Vagrant insecure key detected. Vagrant will automatically replace\r\n    default: this with a newly generated keypair for better security.\r\n    default: \r\n    default: Inserting generated public key within guest...\r\n    default: Removing insecure key from the guest if it's present...\r\n    default: Key inserted! Disconnecting and reconnecting using new SSH key...\r\n==&gt; default: Machine booted and ready!\r\n==&gt; default: Checking for guest additions in VM...\r\n    default: No guest additions were detected on the base box for this VM! Guest\r\n    default: additions are required for forwarded ports, shared folders, host only\r\n    default: networking, and more. If SSH fails on this machine, please install\r\n    default: the guest additions and repackage the box to continue.\r\n    default: \r\n    default: This is not an error message; everything may continue to work properly,\r\n    default: in which case you may ignore this message.\r\n==&gt; default: Rsyncing folder: \/XXXXX\/vagrant\/centos7\/ =&gt; \/vagrant\r\n\r\n<\/code><\/pre>\n<p>\u67e5\u770b\u865a\u62df\u673a\u72b6\u6001<\/p>\n<pre class=\"post-pre\"><code>$ vagrant status\r\nCurrent machine states:\r\n\r\ndefault                   running (virtualbox)\r\n\r\nThe VM is running. To stop this VM, you can run `vagrant halt` to\r\nshut it down forcefully, or you can run `vagrant suspend` to simply\r\nsuspend the virtual machine. In either case, to restart it again,\r\nsimply run `vagrant up`.\r\n<\/code><\/pre>\n<h2>3-4. \u865a\u62df\u673a\u8fde\u63a5\u8fde\u63a5\u5230\u542f\u52a8\u7684\u865a\u62df\u673a\u8fdb\u884cSSH\u8fde\u63a5\u3002<\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u8fde\u63a5\u865a\u62df\u673a\uff1a &lt;\u547d\u4ee4&gt;<\/p>\n<p>\u30fb\u865a\u62df\u673a\u8fde\u63a5<\/p>\n<pre class=\"post-pre\"><code>vagrant ssh\r\n<\/code><\/pre>\n<p>\u6267\u884c\u4e0a\u8ff0\u547d\u4ee4\u3002<\/p>\n<p>\u8fdb\u5165\u5e76\u786e\u8ba4Vagrantfile\u6240\u5728\u7684\u76ee\u5f55<\/p>\n<pre class=\"post-pre\"><code>$ cd ~\/vagrant\/centos7\/\r\n$ ls\r\nVagrantfile\r\n<\/code><\/pre>\n<p>\u30fb\u865a\u62df\u673a\u8fde\u63a5<\/p>\n<p>\u6267\u884c\u547d\u4ee4\u5e76\u8fde\u63a5\u5230CentOS 7\u865a\u62df\u673a\u3002<\/p>\n<pre class=\"post-pre\"><code>$ vagrant ssh\r\n[vagrant@localhost ~]$ \r\n<\/code><\/pre>\n<h1>4. \u865a\u62df\u673a\u64cd\u4f5c\u5728\u64cd\u4f5c\u865a\u62df\u673a\u65f6\uff0c\u6211\u4eec\u5c06\u5217\u51fa\u4e00\u4e9b\u5e38\u7528\u7684\u547d\u4ee4\u4f9b\u60a8\u53c2\u8003\u3002<\/p>\n<div>\n<div class=\"post-table\">\u30b3\u30de\u30f3\u30c9\u8aac\u660evagrant up\u4eee\u60f3\u30de\u30b7\u30f3\u3092\u8d77\u52d5\u3059\u308bvagrant halt\u4eee\u60f3\u30de\u30b7\u30f3\u3092\u505c\u6b62\u3059\u308bvagrant status\u4eee\u60f3\u30de\u30b7\u30f3\u306e\u72b6\u614b\u3092\u8868\u793a\u3059\u308bvagrant ssh\u4eee\u60f3\u30de\u30b7\u30f3\u306b\u63a5\u7d9a\u3059\u308bvagrant destroy\u4eee\u60f3\u30de\u30b7\u30f3\u3092\u524a\u9664\u3059\u308b\u6709\u5173\u5176\u4ed6\u547d\u4ee4\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u4ee5\u4e0b\u94fe\u63a5\u3002<\/p>\n<p>\u6d41\u6d6a\u8005\uff1a\u547d\u4ee4\u884c\u63a5\u53e3<br \/>\nhttps:\/\/www.vagrantup.com\/docs\/cli\/<\/p>\n<h1>5. \u7ed3\u675f\u8fd9\u6b21\u6211\u4eec\u6574\u7406\u4e86\u4f7f\u7528Vagrant\u5728Mac PC\u4e0a\u521b\u5efaCentOS7\u865a\u62df\u73af\u5883\u7684\u6b65\u9aa4\u3002<\/p>\n<p>\u4f7f\u7528\u624b\u5de5\u5efa\u7acb\u73af\u5883\u9700\u8981\u76f8\u5f53\u957f\u7684\u65f6\u95f4\uff0c\u4f46\u662f\u4f7f\u7528Vagrant\u53ef\u4ee5\u5728\u5927\u7ea610\u5206\u949f\u5de6\u53f3\u5b8c\u6210\u73af\u5883\u6784\u5efa\u3002<\/p>\n<p>\u6211\u89c9\u5f97\u80fd\u591f\u5feb\u901f\u51c6\u5907\u81ea\u5df1\u7528\u4e8e\u9a8c\u8bc1\u548c\u5f00\u53d1\u7684\u73af\u5883\u975e\u5e38\u65b9\u4fbf\uff0c\u8fd9\u79cd\u4fbf\u6377\u6027\u975e\u5e38\u5b9e\u7528\u3002<\/p>\n<h1>\u8bf7\u63d0\u4f9b\u76f8\u5173\u8d44\u6599(Reference information)<\/p>\n<p>Vagrant \u5b98\u65b9\u7f51\u7ad9<br \/>\nhttps:\/\/www.vagrantup.com\/<\/p>\n<p>\u3010\u4e2d\u6587\u7ffb\u8bd1\u3011<br \/>\n\u70b9\u901a\u8bfe\u7a0b\uff1aVagrant\u5165\u95e8<br \/>\nhttps:\/\/dotinstall.com\/lessons\/basic_vagrant<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148Vagrant\u662f\u4e00\u4e2a\u7528\u4e8e\u8f7b\u677e\u521b\u5efa\u865a\u62df\u73af\u5883\u7684\u5de5\u5177\u3002 \u8fd9\u6b21\u4f5c\u4e3a\u6211\u7684\u5907\u5fd8\u5f55\uff0c\u6211\u5c06\u603b\u7ed3\u4f7f\u7528Vagrant\u5728Mac\u7535 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[227],"class_list":["post-26448","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8e\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528vagrant-\u6784\u5efacentos7\u73af\u5883\u7684\u6b65\u9aa4\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8e\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528vagrant-\u6784\u5efacentos7\u73af\u5883\u7684\u6b65\u9aa4\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-24T03:00:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-11T13:20:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657c24bbd0c9c81e0f5c8ea8\/12-0.png\" \/>\n<meta name=\"author\" content=\"\u97f5, \u79d1\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u97f5, \u79d1\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/\",\"name\":\"\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2022-11-24T03:00:39+00:00\",\"dateModified\":\"2025-08-11T13:20:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e\"},\"description\":\"\u5173\u4e8e\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4\u7684\u6280\u672f\u6587\u7ae0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e\",\"name\":\"\u97f5, \u79d1\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g\",\"caption\":\"\u97f5, \u79d1\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunke\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4 - Blog - Silicon Cloud","description":"\u5173\u4e8e\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4\u7684\u6280\u672f\u6587\u7ae0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528vagrant-\u6784\u5efacentos7\u73af\u5883\u7684\u6b65\u9aa4\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4","og_description":"\u5173\u4e8e\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4\u7684\u6280\u672f\u6587\u7ae0","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528vagrant-\u6784\u5efacentos7\u73af\u5883\u7684\u6b65\u9aa4\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-11-24T03:00:39+00:00","article_modified_time":"2025-08-11T13:20:49+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657c24bbd0c9c81e0f5c8ea8\/12-0.png"}],"author":"\u97f5, \u79d1","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u97f5, \u79d1","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/","name":"\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2022-11-24T03:00:39+00:00","dateModified":"2025-08-11T13:20:49+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e"},"description":"\u5173\u4e8e\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4\u7684\u6280\u672f\u6587\u7ae0","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u3010\u5907\u5fd8\u5f55\u3011\u4f7f\u7528Vagrant \u6784\u5efaCentOS7\u73af\u5883\u7684\u6b65\u9aa4"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e","name":"\u97f5, \u79d1","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g","caption":"\u97f5, \u79d1"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunke\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90%e5%a4%87%e5%bf%98%e5%bd%95%e3%80%91%e4%bd%bf%e7%94%a8vagrant-%e6%9e%84%e5%bb%bacentos7%e7%8e%af%e5%a2%83%e7%9a%84%e6%ad%a5%e9%aa%a4%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/26448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=26448"}],"version-history":[{"count":3,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/26448\/revisions"}],"predecessor-version":[{"id":110977,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/26448\/revisions\/110977"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=26448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=26448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=26448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}