Setup WordPress VM with LAMP Stack on RHEL/CentOS or Debian/Ubuntu using Ansible as provisioner on Vagrant
- Make sure your machine supports Virtualization
- VirtualBox installed - get it from https://www.virtualbox.org/wiki/Downloads
- Vagrant installed - get it from http://www.vagrantup.com/downloads.html
TL;DR
- Clone this repo to your machine
cd
into this repo and runvagrant up
- Update hosts file and add
10.0.0.10 wordpress.vm
- Access project at
http://wordpress.vm
To start using wordpress-vm, do the following:
-
Clone this repo to a preferred directory in your machine
-
cd
into this repo and updateconfig.yml
according to your preferencesA few variables you can play in
config.yml
vm_box
- You can try any distro verions under RHEL or Debian (e.g.ubuntu/trusty64
,geerlingguy/centos7
)vm_ip
- Change to any private IP you prefer or leave as isvm_name
- Set your VM's namevm_hostname
- Set the hostname of your VM. This is also used as WordPress' base url.wp_project_dir_name
- Directory name where wordpress is installedwp_db_name
- Database name used by WordPress and provisioned bygeerlingguy.mysql
ansible role.wp_db_user
- Database user used by WordPress and provisioned bygeerlingguy.mysql
ansible role.wp_db_pass
- Database password used by WordPress and provisioned bygeerlingguy.mysql
ansible role.
-
Run
vagrant up
-
Update your hosts file
In order for your project to be accessible, you need to edit your hosts file and add the following:
10.0.0.10 wordpress.vm
The IP should correspond to the
vm_ip
provided onconfig.yml
in case you modify it.-
Editing hosts file on Windows
For Windows host machine, you can edit your hosts file by doing the ff:
- Run cmd as administrator > search for cmd in start menu > right click > run as administrator
- Once in cmd, type and enter
notepad drivers\etc\hosts
- Add
10.0.0.10 wordpress.vm
and save
-
Editing hosts file on Linux
For Linux host machine, you can edit your hosts file by doing the ff:
- Launch terminal
- Once in terminal, type and enter
sudo vi /etc/hosts
- Add
10.0.0.10 wordpress.vm
and save
-
Automating edit on hosts file
If you want to automate the editing of your hosts file, install the
vagrant-hostsupdater
plugin by runningvagrant plugin install vagrant-hostsupdater
You will need to run your CMD as admin on Windows when doing this.
-
-
Once you've updated your hosts file, you can now access your project at http://wordpress.vm
The default username
and password
for wp-admin
is admin
for both.
- ansible-role-repo-epel - Installs EPEL repo
- ansible-role-mysql - Installs MySQL database server
- ansible-role-apache - Installs Apache server
- ansible-role-php - Installs PHP and some of its common modules
- ansible-role-ppa-ondrej - Installs ondrej/php ppa for Debian/Ubuntu
- ansible-role-repo-webtatic - Installs the Webtatic repository on RHEL/CentOS
- config-repos - Install repos based on distribution
- sbaerlocher.wp-cli - Install wp-cli
- wordpress - Configure and Install WordPress core and plugins
- Make VM more customizable through config (e.g. cpu, memory)
- Add test suite for Travis-CI
MIT