How to Set Up a Vagrant WordPress Development Environment

0
  This is the Vagrant homepage. [19659007] Vagrant homepage.

There are many ways to set up your local development environment so that you can test your new WordPress project. However, many tools use a lot of resources. On the other hand, setting up a lighter test environment manually can be tricky. If you use Vagrant WordPress ‘box’ you're in the middle.

Vagrant allows you to set up a test environment with little overhead. So even on small hardware, you can run different unique environments side by side with different configurations.

This article introduces the Vagrant environment and how the box system works. Then I will tell you how to set up your Vagrant WordPress environment.

Let's work!

What is Vagrant and why it's a great tool for WordPress development

  This is the Vagrant homepage. [19659007] Vagrant homepage.

Vagrant is basically a virtual machine management tool. You can provision machines using online services such as VirtualBox, VMware, and even Amazon Web Services (AWS).

Vagrant works by setting up & # 39; containers & # 39; or & # 39; boxes & # 39; using the command line. In addition to interacting with these boxes through the command line, you can use your favorite text editors, browsers, and other tools you have installed on your computer.

Vantant environments tend to be very light compared to full virtual machines. In addition, you can quickly set up an out-of-the-box experience using boxes shared by other users, with many options to choose from.

  Some examples of Vagrant WordPress boxes

The best part of using Vagrant is that you can easily share configuration files or boxes with other team members. In other words, you can use the same development environment even if you use different operating systems (OSs) or settings.

There are a lot of prebuilt Vagrant environments you can use with WordPress. Let's look at how the process works.

How to Set Up Your Vagrant WordPress Development Environment (Step 3)

Vagrant, as mentioned earlier, is a command-line tool available for Linux, Mac, and Windows. However, some dependencies are required. Let's begin.

Step 1: Install VirtualBox and Vagrant

To use Vagrant locally, you need a program that can set up a new virtual machine. VirtualBox is the software that Vagrant recommends, and both programs work together by default.

First you need to install the appropriate VirtualBox version for your OS. Once the software is set up, install Vagrant. When finished, open a command line and enter:

vagrant -v

This is a simple test to verify that Vagrant is running correctly. If you are not prompted to confirm the current version of Vagrant installed on your system, reboot your computer and try again.

After verifying that Vagrant is working, it's time to set up your WordPress environment.

Step 2: Install Vagrant WordPress Box

Instead of setting up the whole environment from scratch, you can start working right away using a pre-built WordPress configuration. The Vagrant WordPress box has many options, but I recommend using VCCW, an environment built for themes and plugin development.

  The VCCW homepage.

VCCW includes Ubuntu. , Git version control, the latest version of WordPress, WP-CLI, PHP 7, MySQL, Apache, and more. In other words, it has everything you need.

You need two things to get started.

  1. VCCW Vagrant box
  2. Installation file

First run the following command in your terminal:

vagrant box add vcc-team / xenial64

Now download the latest configuration instructions for your new Vagrant WordPress environment. It weighs less than 20Kb and shows how easy it is to clone your environment using Vagrant. If the file

exists, set a new local directory for the environment and move the zip file inside. Next go to this environment using command line (replace placeholder text used):

cd name of the new directory

When you are inside the environment from the command line:

vagrant up

vagrant up Instructs the new virtual machine to start using instructions from a file within the directory. Since the machine is spinning for the first time, it may take some time for Vagrant to set everything up.

When the Vagrant WordPress box is ready, you can use the command line again to test that everything works correctly.

Step 3: Test your new WordPress local installation

Once the VCCW box is installed, it should be accessible from your browser using one of the following addresses:

  1. http: //vccw.test
  2. http: //192.168.33.10

If everything works, enter & # 39; admin & You can use # 39; to log in to WordPress. This is not a recommended combination in normal situations, but it is not a big problem in a local test environment.

VCCW automatically sets up the MySQL database for the local web site as we saw earlier. To access, go to the browser 3306 port 127.0.0.1 . The default login credentials are as follows:

  • username: & # 39; wordpress & # 39; or & # 39; root & # 39;
  • password: wordpress

Vagrant provides the user with a visual interface For virtual machines, you need to use SSH to edit files outside of WordPress.

You can access the box via SSH using one of the URLs as the host name.

  Connecting to the VCCW Box via SSH

you can use the command line to make changes as desired. If you can't edit the file comfortably this way, you have a complete test environment and it will be a good time to learn!

Conclusion

Vagrant is not the only tool available. Local WordPress Development. Other popular options are:

The Vagrant WordPress environment is very lightweight and easy to reproduce, ideal for collaboration.

After setting up and running the Vagrant WordPress environment, you can use it for staging purposes. Have questions about the Vagrant WordPress environment?

Do you have questions about the Vagrant WordPress environment? Let's take a look at the comments section below!

Free Guide

5 Essential Tips
WordPress Site

Reduce load time 50-80% by following simple instructions
Tips.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.