Varying Vagrant Vagrants (VVV) is an open source project based on Vagrant which helps you set up a local development environment preconfigured with everything you need to start doing WordPress development on a modern LEMP stack that mimics the configuration of several popular hosting environments.
Follow the setup instructions on the project’s Github page to get everything setup, which includes installations of the latest stable and bleeding edge versions of WordPress, and a development setup for working on WordPress core. After you’ve completed the installation process you can administer your environment through the command line, or if you’re on a Mac, use Vagrant Manager to control VVV directly from the menu bar.
An updated dashboard
VVV comes with a very basic dashboard to get started, which can be found by pointing your browser to http://vvv.dev. The default dashboard gives you quick access to the essentials, but not much more.
For a better dashboard experience, including easy access to any of additional sites you may have set up, I recommend using VVV-Dashboard by Jeff Behnke.
Install it by cloning the repository into your vvv/www/ directory and copying dashboard-custom.php and style.css into your vvv/www/default/ directory.
Setting up additional sites on VVV
One of the great features of VVV is the auto site setup which can be used to create a new development site by modifying a couple of config files. Simon Wheatley has a nice example. I also recently ran across Alison Barrett’s terrific vvv-site-wizard, which automates the whole process of setting up new sites from the command line and even allows you to mirror the media directory of a live site, which comes in really handy.
By using VVV to get a local development environment in place, you can stop worrying about complicated server administration tasks and focus your attention on that next great WordPress project you’ve been thinking about.
I’ve recently had the need to explore a few different hosting environments and decided to give DigitalOcean a spin. Here’s a quick look at the steps involved in getting WordPress set up on a LEMP Ubuntu 14.04 droplet.
The droplet took about a minute to spin up and then I logged in via SSH to complete the setup.
Setting Up MySQL
Before installing WordPress, you’ll need to create a new database and a new user with privileges to that database. When you first log in to the droplet via SSH, your root MySQL password will be displayed as part of the welcome banner. You’ll need that password to login to MySQL, using the following command:
mysql -u root -p
After logging in, you will create a new database like this:
CREATE DATABASE dbname;
Next, create a user with access to that database. First, create the user:
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
Then, grant privileges on your database to the user you just created like this:
GRANT ALL PRIVILEGES ON dbname.* TO 'username'@'localhost';
And finally, reload privileges by running:
Create a non-root user
I like to log in using a non-root user to administer the server. The process I followed can generally be found here: starting at step 3.
Add a new user by typing the following command:
Follow the prompts to set the username and additional info.
Add sudo privileges for the new user using
Look for the line that looks like this:
# User privilege specification
root ALL=(ALL:ALL) ALL
And add the following just below:
username ALL=(ALL:ALL) ALL
I like to be able to log in without putting in a password, so I copy the contents of my public key (~/.ssh/id_rsa.pub) from my computer into a the authorized_keys file (~/.ssh/authorized_keys) in the user directory of the new user I just created on the droplet.
If everything went well, I should be able to log into the droplet from my terminal by typing a command that looks much like the following:
I love the power of managing WordPress from the command line using WP-CLI. I follow the installation process on their website to get up and running.
sudo service nginx restart
sudo service php5-fpm restart
Once you’ve completed these steps, you should be able to point the DNS for your domain (e.g. mydomain.com) or set up a hosts file entry that points at the IP address for your droplet. If all is well, you should see your new site served when you visit from your browser.
There are a couple of additional packages I would suggest installing before finishing up.
WordPress uses postfix to send out emails (e.g., password reminders, notifications, etc.). I use apt-get to install postfix, following these instructions to complete the process.
I would also suggest installing an opcode cache. I chose APC: