bash: vagrant

tech2022-09-06  112

bash: vagrant

I often get asked to recommend beginner resources for people new to PHP. And, it’s true, we don’t have many truly newbie friendly ones. I’d like to change that by first talking about the basics of environment configuration. In this post, you’ll learn about the very first thing you should do before starting to work with PHP (or any other language, for that matter).

我经常被要求为PHP新手推荐初学者资源。 而且,的确如此,我们没有很多真正的新手友好用户。 我想通过首先谈论环境配置的基础来改变这一点。 在本文中,您将了解开始使用PHP(或其他任何语言)之前应该做的第一件事。

We’ll be re-introducing Vagrant powered development.

我们将重新引入Vagrant支持的开发。

Note that this topic (among other best practices) is covered in much more depth in SitePoint’s Jump Start PHP Environment Book.

请注意, SitePoint的《 Jump Start PHP Environment Book》更深入地介绍了该主题(包括其他最佳实践)。

Please take the time to read through the entire article – I realize it’s a wall of text, but it’s an important wall of text. By following the advice within, you’ll be doing not only yourself one hell of a favor, but you’ll be benefitting countless other developers in the future as well. The post will be mainly theory, but in the end we’ll link to a quick 5-minute tutorial designed to get you up and running with Vagrant in almost no time. It’s recommended you absorb the theory behind it before you do that, though.

请花些时间阅读整篇文章–我意识到这是一堵文字墙,但这是一本重要的文字墙。 通过遵循其中的建议,您不仅会自己受宠若惊,而且将来也会使无数其他开发人员受益。 这篇文章主要是理论知识,但最后我们将链接到一个简短的5分钟教程,该教程旨在使您几乎很快就可以开始使用Vagrant。 但是,建议您在这样做之前先吸收其背后的理论。

Just in case you’d like to rush ahead and get something tangible up and running before getting into theory, here’s the link to that tutorial.

万一您想着手研究并在理论上学到一些东西并开始运行, 这里是该教程的链接 。

什么? (What?)

Let’s start with the obvious question – what is Vagrant? To explain this, we need to explain the following 3 terms first:

让我们从一个显而易见的问题开始-什么是流浪汉? 为了解释这一点,我们首先需要解释以下三个术语:

Virtual Machine

虚拟机 VirtualBox

虚拟盒子 Provisioning

供应

虚拟机 (Virtual Machine)

In definitions as simple as I can conjure them, a Virtual Machine (VM) is an isolated part of your main computer which thinks it’s a computer on its own. For example, if you have a CPU with 4 cores, 12 GB of RAM and 500 GB of hard drive space, you could turn 1 core, 4 GB or RAM and 20GB or hard drive space into a VM. That VM then thinks it’s a computer with that many resources, and is completely unaware of its “parent” system – it thinks it’s a computer in its own right. That allows you to have a “computer within a computer” (yes, even a new “monitor”, which is essentially a window inside a window – see image below):

在我能想到的简单定义中,虚拟机(VM)是您的主计算机的独立部分,认为它是一台独立的计算机。 例如,如果您的CPU具有4个核心,12 GB的RAM和500 GB的硬盘驱动器空间,则可以将1个核心,4 GB的RAM或20GB或硬盘驱动器空间转换为VM。 然后,该VM认为这是一台拥有这么多资源的计算机,并且完全不知道其“父”系统-它认为它本身就是一台计算机。 这样一来,您就可以拥有一台“计算机中的一台计算机”(是的,甚至是一个新的“显示器”,它实际上是一个窗口中的一个窗口–参见下图):

A Windows VM inside a Mac OS X system

Mac OS X系统中的Windows VM

This has several advantages:

这有几个优点:

you can mess up anything you want, and nothing breaks on your main machine. Imagine accidentally downloading a virus – on your main machine, that could be catastrophic. Your entire computer would be at risk. But if you downloaded a virus inside a VM, only the VM is at risk because it has no real connection to the parent system it lives off of. Thus, the VM, when infected, can simply be destroyed and re-configured back into existence, clean as a whistle, no consequences.

您可以弄乱您想要的任何东西,而主机上没有任何损坏。 想象一下,如果您不小心在主机上下载了病毒,那可能是灾难性的。 您的整个计算机将受到威胁。 但是,如果您在VM内下载了病毒,则只有VM处于危险之中,因为它与生存的父系统没有真正的连接。 因此,VM被感染后,可以简单地销毁并重新配置为存在,吹口哨,没有任何后果。 you can test out applications for other operating systems. For example, you have an Apple computer, but you really want that one specific Windows application that Apple doesn’t have. Just power up a Windows VM, and run the application inside it (like in the image above)!

您可以测试其他操作系统的应用程序。 例如,您有一台Apple计算机,但您确实想要Apple没有的特定Windows应用程序。 只需启动Windows VM,然后在其中运行应用程序即可(如上图所示)! you keep your main OS free of junk. By installing stuff onto your virtual machine, you avoid having to install anything on your main machine (the one on which the VM is running), keeping the main OS clean, fast, and as close to its “brand new” state as possible for a long time.

您可以使主操作系统保持无垃圾状态。 通过将内容安装到虚拟机上,可以避免在主机(运行VM的主机)上安装任何内容,从而保持主机OS整洁,快速并尽可能接近其“全新”状态,很长时间。

You might wonder – if I dedicate that much of my host computer to the VM (an entire CPU core, 4GB of RAM, etc), won’t that:

您可能想知道–如果我将我的大部分主机专用于VM(整个CPU内核,4GB RAM等),会不会:

make my main computer slower?

使我的主计算机变慢? make the VM slow, because that’s kind of a weak machine?

使VM变慢,因为那是一台性能较弱的机器?

The answer to both is “yes” – but here’s why this isn’t a big deal. You only run the VM when you need it – when you don’t, you “power it down”, which is just like shutting down a physical computer. The resources (your CPU core, etc.) are then instantly freed up. The VM being slow is not a problem because it’s not meant to be a main machine – you have the host for that, your main computer. So the VM is there only for a specific purpose, and for that purpose, those resources are far more than enough. If you really need a VM more powerful than the host OS, then just give the VM more resources – like if you want to play a powerful game on your Windows machine and you’re on a Mac computer with 4 CPU cores, give the VM 3 cores and 70-80% of your RAM – the VM instantly becomes powerful enough to run your game!

两者的答案都是“是”,但这就是为什么这没什么大不了的。 您仅在需要时运行VM –不需要时,您可以“关闭它的电源”,就像关闭物理计算机一样。 然后立即释放资源(您的CPU内核等)。 VM慢不是问题,因为它并不意味着要成为一台主机-您拥有该主机,即主机。 因此,VM仅用于特定目的,而这些资源远远不够。 如果您确实需要比主机操作系统更强大的VM,则只需为VM提供更多资源–例如,如果您想在Windows计算机上玩功能强大的游戏,并且您在具有4个CPU内核的Mac计算机上,请给VM 3核和70-80%的RAM – VM立即变得足够强大,可以运行您的游戏!

But, how do you “make” a virtual machine? This is where software like VirtualBox comes in.

但是,如何“制作”虚拟机? 这是VirtualBox之类的软件出现的地方。

虚拟盒子 (VirtualBox)

VirtualBox is a program which lets you quickly and easily create virtual machines. An alternative to VirtualBox is VMware. You can (and should immediately) install VirtualBox here.

VirtualBox是一个程序,可让您快速轻松地创建虚拟机。 VMware替代VirtualBox。 您可以(并且应该立即) 在此处安装VirtualBox。

VirtualBox provides an easy to use graphical interface for configuring new virtual machines. It’ll let you select the number of CPU cores, disk space, and more. To use it, you need an existing image (an installation CD, for example) of the operating system you want running on the VM you’re building. For example, if you want a Windows VM as in the image above, you’ll need a Windows installation DVD handy. Same for the different flavors of Linux, OS X, and so on.

VirtualBox提供了易于使用的图形界面,用于配置新的虚拟机。 它可以让您选择CPU核心数,磁盘空间等。 要使用它,您需要要在要构建的VM上运行的操作系统的现有映像(例如,安装CD)。 例如,如果要使用上图所示的Windows VM,则需要Windows安装DVD。 对于Linux,OS X等不同口味的应用程序相同。

供应 (Provisioning)

When a new VM is created, it’s bare-bones. It contains nothing but the installed operating system – no additional applications, no drivers, nothing. You still need to configure it as if it were a brand new computer you just bought. This takes a lot of time, and people came up with different ways around it. One such way is provisioning, or the act of using a pre-written script to install everything for you.

当创建一个新的虚拟机时,它是准系统。 它只包含已安装的操作系统,不包含任何其他应用程序,驱动程序和内容。 您仍然需要对其进行配置,就好像它是刚购买的全新计算机一样。 这需要很多时间,人们想出了不同的解决方法。 一种这样的方法是Provisioning ,即使用预写脚本为您安装所有内容的行为。

With a provisioning process, you only need to create a new VM and launch the provisioner (a provisioner is a special program that takes special instructions) and everything will be taken care of automatically for you. Some popular provisioners are: Ansible, Chef, Puppet, etc – each has a special syntax in the configuration “recipe” that you need to learn. But have no fear – this, too, can be skipped. Keep reading.

通过预配过程,您只需创建一个新的VM并启动预配器(预配器是一个带有特殊说明的特殊程序),一切将自动为您处理。 一些流行的供应商包括:Ansible,Chef,Puppet等–每个在您需要学习的配置“食谱”中都有特殊的语法。 但是不要害怕-这也可以跳过。 继续阅读。

流浪汉 (Vagrant)

This is where we get to Vagrant. Vagrant is another program that combines the powers of a provisioner and VirtualBox to configure a VM for you.

这是我们去无业游民的地方。 Vagrant是另一个程序,结合了预配器和VirtualBox的功能来为您配置VM。

You can (and should immediately) install Vagrant here.

您可以(并且应该立即) 在此处安装Vagrant。

Vagrant, however, takes a different approach to VMs. Where traditional VMs have a graphical user interface (GUI) with windows, folders and whatnot, thus taking a long time to boot up and become usable once configured, Vagrant-powered VMs don’t. Vagrant strips out the stuff you don’t need because it’s development oriented, meaning it helps with the creation of development friendly VMs.

但是,Vagrant对VM采用了不同的方法。 传统的VM具有带有窗口,文件夹和诸如此类的图形用户界面(GUI),因此启动需要很长时间才能启动,并且一旦配置就可以使用,而Vagrant支持的VM则没有。 Vagrant去除了不需要的东西,因为它是面向开发的 ,这意味着它有助于创建易于开发的VM。

Vagrant machines will have no graphical elements, no windows, no taskbars, nothing to use a mouse on. They are used exclusively through the terminal (or command line on Windows – but for the sake of simplicity, I’ll refer to it as the terminal from now on). This has several advantages over standard VMs:

无业游民的机器将没有图形元素,没有窗口,没有任务栏,也不需要使用鼠标。 它们仅通过终端使用(或Windows上的命令行-但为简单起见,从现在开始,我将其称为终端)。 与标准VM相比,它具有以下优点:

Vagrant VMs are brutally fast to boot up. It takes literally seconds to turn on a VM and start developing on it. Look how quickly it happens for me – 25 seconds flat from start to finish:

无用的VM可以快速启动。 打开虚拟机并开始在其上进行开发几乎需要几秒钟。 看看这对我有多快-从开始到结束平均间隔25秒:

Vagrant VMs are brutally fast to boot up. It takes literally seconds to turn on a VM and start developing on it. Look how quickly it happens for me – 25 seconds flat from start to finish:

无用的VM可以快速启动。 打开虚拟机并开始在其上进行开发几乎需要几秒钟。 看看这对我有多快-从开始到结束平均间隔25秒:

Vagrant VMs are brutally fast to use – with no graphical elements to take up valuable CPU cycles and RAM, the VM is as fast as a regular computer

Vagrant VM的使用速度非常快–无需图形元素即可占用宝贵的CPU周期和RAM,因此该VM与普通计算机一样快 Vagrant VMs resemble real servers. If you know how to use a Vagrant VM, you’re well on your way to being able to find your way around a real server, too.

无业游民的虚拟机类似于真实服务器。 如果您知道如何使用Vagrant VM,那么您也将能够在真实服务器周围找到自己的方式。 Vagrant VMs are very light due to their stripped out nature, so their configuration can typically be much weaker than that of regular, graphics-powered VMs. A single CPU core and 1GB of RAM is more than enough in the vast majority of use cases when developing with PHP. That means you can not only boot up a Vagrant VM on a very weak computer, you can also boot up several and still not have to worry about running out of resources.

流浪VM由于具有剥离特性,因此非常轻便,因此它们的配置通常会比常规的基于图形的VM弱得多。 在使用PHP开发的绝大多数用例中,单个CPU内核和1GB RAM绰绰有余。 这意味着您不仅可以在非常弱的计算机上启动Vagrant VM,还可以启动多个Vagrant VM,而不必担心资源不足。

Perhaps most importantly, Vagrant VMs are destructible. If something goes wrong on your VM – you install something malicious, you remove something essential by accident, or any other calamity occurs, all you need to do to get back to the original state is run two commands: vagrant destroy which will destroy the VM and everything that was installed on it after the provisioning process (which happens right after booting up), and vagrant up which rebuilds it from scratch and re-runs the provisioning process afterwards, effectively turning back time to before you messed things up.

也许最重要的是,Vagrant VM是可破坏的。 如果您的VM出了问题–安装了恶意软件,意外删除了一些重要内容,或者发生了其他任何灾难,您只需执行以下两个命令即可恢复到原始状态: vagrant destroy ,它将破坏VM以及配置过程之后(启动后立即发生)上安装的所有内容,以及vagrant up的流程,从头开始对其进行重新构建,然后重新运行配置过程,从而有效地将时间倒回了混乱之前。

With Vagrant, you have a highly forgiving environment that can restore everything to its original state in minutes, saving you hours upon hours of debugging and reinstallation procedures.

使用Vagrant,您将拥有一个高度宽容的环境,可以在数分钟内将所有内容恢复到原始状态,从而节省了数小时的调试和重新安装过程。

为什么? (Why?)

So, why do this for PHP development in particular?

那么,为什么要特别针对PHP开发呢?

The ability to test on several versions of PHP, or PHP with different extensions installed. One VM can be running PHP 5.5, one can be running PHP 5.6, one can be running PHP 7. Test your code on each – no need to reinstall anything. Instantly be sure your code is cross-version compatible.

可以在多个版本PHP或具有不同扩展名PHP上进行测试。 一台VM可以运行PHP 5.5,一台可以运行PHP 5.6,一台可以运行PHP7。在每台VM上测试代码-无需重新安装任何程序。 立即确保您的代码是跨版本兼容的。 The ability to test on several servers. Test on Apache in one VM, test on Nginx in another, or on Lighttpd on yet another – same thing as above: make sure your code works on all server configurations.

在多台服务器上进行测试的能力。 在一个VM上测试Apache,在另一个VM上测试Nginx,或在另一个VM上测试Lighttpd –与上面相同:确保您的代码在所有服务器配置上均可工作。 Benchmark your code’s execution speed on different combinations of servers + PHP versions. Maybe the code will execute twice as fast on Nginx + PHP 7, allowing you to optimize further and alert potential users to possible speed gains.

在服务器+ PHP版本的不同组合上基准测试代码的执行速度。 也许代码将在Nginx + PHP 7上以两倍的速度执行,从而使您可以进一步优化并提醒潜在用户可能的速度提高。

Share the same environment with other team members, avoiding the “it works on my machine” excuses. All it takes is sharing a single Vagrantfile (which contains all of the necessary configuration) and everyone has the exact same setup as you do.

与其他团队成员共享相同的环境,避免“在我的机器上工作”的借口。 只需共享一个Vagrantfile(包含所有必需的配置),每个人都具有与您完全相同的设置 。

Get dev/prod parity: configure your Vagrant VM to use the same software (and versions) as your production (live) server. For example, if you have Nginx and PHP 5.6.11 running on the live server, set the Vagrant VM up in the exact same way. That way, you’re 100% certain your code will instantly work when you deploy it to production, meaning no downtime for your visitors!

获得开发/产品奇偶校验:将Vagrant VM配置为使用与生产(活动)服务器相同的软件(和版本)。 例如,如果您在实时服务器上运行了Nginx和PHP 5.6.11,则以完全相同的方式设置Vagrant VM。 这样,您可以100%确信将代码部署到生产环境后即可立即工作,这意味着您的访问者不会停机 !

These are the main but not the only reasons.

这些是主要原因,但不是唯一的原因。

But why not XAMPP? XAMPP is a pre-built package of PHP, Apache, MySQL (and Perl, for the three people in the world who need it) that makes a working PHP environment just one click away. Surely this is better than Vagrant, no? I mean, a single click versus learning about terminal, Git cloning, virtual machines, hosts, etc…? Well actually, it’s much worse, for the following reasons:

但是为什么不使用XAMPP ? XAMPP是PHP,Apache,MySQL(和Per​​l,针对世界上三个需要它的人)的预构建包,只需单击一下即可创建有效PHP环境。 当然这比流浪汉更好,不是吗? 我的意思是,单击一下与了解终端,Git克隆,虚拟机,主机等有关? 实际上,由于以下原因,情况更糟:

With XAMPP, you absorb zero server-config know-how, staying 100% clueless about terminal, manual software installations, SSH usage, and everything else you’ll one day desperately need to deploy a real application.

借助XAMPP,您可以吸收零服务器配置知识,对终端,手动软件安装,SSH使用以及一天中迫切需要部署真实应用程序的所有其他事情一无所知。

With XAMPP, you’re never on the most recent version of the software. It being a pre-configured stack of software, updating an individual part takes time and effort so it’s usually not done unless a major version change is involved. As such, you’re always operating on something at least a little bit outdated.

使用XAMPP,您将永远不会使用该软件的最新版本。 它是预先配置的软件堆栈,更新单个零件需要花费时间和精力,因此除非涉及重大版本更改,否则通常不会完成。 因此,您总是会在至少有些过时的地方进行操作。 XAMPP forces you to use Apache. Not that Nginx is the alpha and omega of server software, but being able to at least test on it would be highly beneficial. With XAMPP and similar packages, you have no option to do this.

XAMPP强制您使用Apache。 并不是说Nginx是服务器软件的alpha和omega,但是至少能够对其进行测试将是非常有益的。 对于XAMPP和类似的软件包,您没有选择这样做。

XAMPP forces you to use MySQL. Same as above, being able to switch databases at will is a great perk of VM-based development, because it lets you not only learn new technologies, but also use those that fit the use case. For example, you won’t be building a social network with MySQL – you’ll use a graph database – but with packages like XAMPP, you can kiss that option goodbye unless you get into additional shenanigans of installing it on your machine, which brings along a host of new problems.

XAMPP强制您使用MySQL。 与上述相同,能够随意切换数据库是基于VM的开发的一大优势,因为它不仅使您可以学习新技术,而且可以使用适合用例的技术。 例如,您不会使用MySQL建立社交网络-您将使用图形数据库 -但使用XAMPP之类的软件包,您可以再见该选项,除非您陷入将其安装到计算机上的其他恶作剧,伴随着许多新问题。

XAMPP installs on your host OS, meaning it pollutes your main system’s space. Every time your computer boots up, it’ll be a little bit slower because of this because the software will load whether or not you’re planning to do some development that day. With VMs, you only power them on when you need them.

XAMPP安装在您的主机OS上,这意味着它会污染您主系统的空间。 每次启动计算机时,它都会变慢一点,因为无论您是否打算当天进行一些开发,该软件都会加载。 使用VM,仅在需要它们时才打开它们的电源。 XAMPP is version locked – you can’t switch out a version of PHP for another, or a version of MySQL for another. All you can do is use what you’re given, and while this may be fine for someone who is 100% new to PHP, it’s harmful in the long run because it gives a false sense of safety and certainty.

XAMPP已被版本锁定–您不能将PHP版本切换为另一个版本,或将MySQL版本切换为另一个版本。 您所能做的就是使用所提供的功能,尽管这对于100%刚接触PHP的人可能很好,但是从长远来看,这是有害的,因为它给人以错误的安全感和确定性。 XAMPP is OS-specific. If you use Windows and install XAMPP, you have to put up with the various problems PHP has on Windows. Code that works on Windows might not work on Linux, and vice versa. Since the vast, vast majority of PHP sites are running on Linux servers, developing on a Linux VM (powered by Vagrant) makes sense.

XAMPP特定于操作系统。 如果使用Windows并安装XAMPP,则必须忍受PHP在Windows上遇到的各种问题。 在Windows上运行的代码在Linux上可能无法运行,反之亦然。 由于绝大多数PHP站点都在Linux服务器上运行,因此在Linux VM(由Vagrant支持)上进行开发是有意义的。

There are many more reasons not to use XAMPP (and similar packages like MAMP, WAMP, etc), but these are the main ones.

还有更多不使用XAMPP的原因(以及类似的软件包,如MAMP,WAMP等),但这是主要的原因。

怎么样? (How?)

So how does one power up a Vagrant box?

那么,一个流浪者盒子如何通电呢?

The first way, which involves a bit of experimentation and downloading of copious amounts of data is going to Hashicorp’s Vagrant Box list here, finding one you like, and executing the command you can find in the box’s details. For example, to power up a 64bit Ubuntu 14.04 VM, you run: vagrant init ubuntu/trusty64 in a folder of your choice after you installed Vagrant, as per instructions. This will download the box into your local Vagrant copy, keeping it for future use (you only have to download once) so future VMs based off of this one are set up faster.

第一种方式,这涉及一个实验位和丰富的数据下载的打算Hashicorp的游民文件夹列表在这里 ,找到一个你喜欢的,和执行可以在框的细节发现的命令。 :例如,功率高达64位的Ubuntu 14.04 VM,运行vagrant init ubuntu/trusty64安装放浪后,按您选择的文件夹中的指令 。 这会将盒子下载到您的本地Vagrant副本中,以备将来使用(您只需下载一次),因此基于此版本的未来VM的设置速度会更快。

Note that the Hashicorp (which, by the way, is the company behind Vagrant) boxes don’t have to be bare-bones VMs. Some come with software pre-installed, making everything that much faster. For example, the laravel/homestead box comes with the newest PHP, MySQL, Nginx, PostgreSQL, etc pre-installed, so you can get to work almost immediately (more on that in the next section).

请注意,Hashicorp(顺便说一下,这是Vagrant背后的公司)盒子不一定是准VM。 有些软件预装了软件,使一切变得更快。 例如, laravel / homestead盒预装了最新PHP,MySQL,Nginx,PostgreSQL等,因此您几乎可以立即开始工作(在下一节中有更多介绍)。

Another way is grabbing someone’s pre-configured Vagrant box from Github. The boxes from the list in the link above are decent enough but don’t have everything you might want installed or configured. For example, the homestead box does come with PHP and Nginx, but if you boot it up you won’t have a server configured, and you won’t be able to visit your site in a browser. To get this, you need a provisioner, and that’s where Vagrantfiles come into play. When you fetch someone’s Vagrantfile off of Github, you get the configuration, too – everything gets set up for you. That brings us into HI.

另一种方法是从Github获取某人的预先配置的Vagrant盒子。 上方链接中列表中的框足够不错,但没有您想要安装或配置的所有内容。 例如,PHP和Nginx附带了宅基盒,但是如果启动它,则不会配置服务器,也无法在浏览器中访问站点。 为此,您需要一个预配器,这就是Vagrantfiles发挥作用的地方。 当您从Github中获取某人的Vagrantfile时,您也将获得配置-一切都已为您完成。 这使我们进入HI。

嗨! (Hi!)

HI (short for Homestead Improved) is a version of laravel/homestead. We use this box at SitePoint extensively to bootstrap new projects and tutorials quickly, so that all readers have the same development environment to work with. Why a version and not the original homestead you may wonder? Because the original requires you to have PHP installed on your host machine (the one on which you’ll boot up your VM) and I’m a big supporter of cross-platform development in that you don’t need to change anything on your host OS when switching machines. By using Homestead Improved, you get an environment ready for absolutely any operating system with almost zero effort.

HI(Homestead Improvement的缩写 )是laravel / homestead的版本。 我们在SitePoint广泛使用此框来快速引导新项目和教程,以便所有读者都可以使用相同的开发环境。 您可能想知道为什么要选择一个版本而不是原始的宅基地? 因为原始版本要求您在主机上安装PHP(用于启动VM的主机),并且我是跨平台开发的大力支持者,因此您无需更改主机上的任何内容切换机器时使用主机操作系统。 通过使用Homestead Improvement,您几乎可以以零的努力为几乎任何操作系统准备好环境。

The gif above where I boot up a VM in 25 seconds – that’s a HI VM, one I use for a specific project.

上面的gif文件是我在25秒内启动VM的地方-这是HI VM,我用于特定项目 。

I recommend you go through this quick tip to get it up and running quickly. The first run might take a little longer, due to the box having to download, but subsequent runs should be as fast as the one in my gif above.

我建议您通过此快速技巧来使其快速启动和运行。 由于必须下载该框,因此第一次运行可能需要更长的时间,但后续运行应与上述gif中的运行速度一样快。

Please do this now – if at any point you get stuck, please let me know and I’ll come running to help you out; I really want everyone to transition to Vagrant-driven-development as soon as possible.

请立即执行此操作-如果您在任何时候遇到困难,请让我知道,我们将竭尽全力为您提供帮助; 我真的希望每个人都尽快过渡到Vagrant驱动的开发。

结论 (Conclusion)

By using HI (and Vagrant in general), you’re paving the way for your own cross-platform development experience and keeping your host OS clean and isolated from all your development efforts.

通过使用HI(通常是Vagrant),您可以为自己的跨平台开发经验铺平道路,并使主机OS保持清洁并与所有开发工作隔离。

Below you’ll find a list of other useful resources to supercharge your new Vagrant powers:

在下面,您将找到其他有用的资源列表,可以增强您的新游民力量:

SitePoint Vagrant posts many tutorials on lots of different aspects of developing with Vagrant, some explaining the links below, some going beyond that and diving into manually provisioning a box or even creating your own, and so on.

SitePoint Vagrant发布了许多教程,这些教程涉及使用Vagrant开发的许多不同方面,其中一些解释了以下链接,一些超出了这些范围,然后深入到手动设置框甚至创建自己的框,等等。

StackOverflow Vagrant Tag for questions and answers about Vagrant, if you run into problems setting it up

如果您遇到设置Vagrant的问题和答案,请使用StackOverflow Vagrant标签

PuPHPet – a way to graphically configure the provisioning of a new Vagrant box to your needs – select a server, a version of PHP, a database, and much more. Uses the Puppet provisioner. Knowledge of Puppet not required.

PuPHPet –一种以图形方式配置新的Vagrant框以满足您的需求的方法–选择服务器,PHP版本,数据库等等。 使用Puppet供应商。 不需要木偶知识。

Phansible – same as PuPHPet but uses the Ansible provisioner. Knowledge of Ansible not required.

Phansible –与PuPHPet相同,但是使用Ansible提供者。 不需要Ansible的知识。

Vaprobash a set of Bash scripts you can download (no provisioner – raw terminal commands in various files that just get executed) as an alternative to the above two. Requires a bit more manual work, but usually results in less bloated VMs due to finetuneability.

Vaprobash可以下载一组Bash脚本(无预配器 –刚执行的各种文件中的原始终端命令),以替代上述两个脚本。 需要更多的手动工作,但由于可微调性 ,通常会减少虚张声势的VM。

5 ways to get started with Vagrant – lists the above resources, plus some others.

Vagrant入门的5种方法 –列出上述资源,以及其他一些资源。

Do you have any questions? Is anything unclear? Would you like me to go into more depth with any of the topics mentioned above? Please let me know in the comments below, and I’ll do my best to clear things up.

你有任何问题吗? 不清楚吗? 您是否希望我对上述任何话题进行更深入的了解? 请在下面的评论中让我知道,我会尽力清除问题。

翻译自: https://www.sitepoint.com/re-introducing-vagrant-right-way-start-php/

bash: vagrant

相关资源:jdk-8u281-windows-x64.exe
最新回复(0)