Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Last active April 9, 2017 11:45
Show Gist options
  • Save claudiosanches/4f307a545b33286e2e4a to your computer and use it in GitHub Desktop.
Save claudiosanches/4f307a545b33286e2e4a to your computer and use it in GitHub Desktop.
WordPress - Simple Ubuntu dev bootstrap
# It's dangerous to go alone! Take this
sudo su
# Update
apt-get update
apt-get upgrade
# Install Apache2
apt-get install -y apache2
# Install MySQL
apt-get install -y mysql-server
# Install PHP
apt-get install -y curl php-pear php-cli php-curl php-dev php-gd php-imagick php-imap php-mcrypt php-pspell php-tidy php-xmlrpc php-mysql libapache2-mod-php
# PHPMyAdmin
apt-get install -y phpmyadmin
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-enabled/phpmyadmin.conf
# Setup vhosts
curl -sS -O https://gist.githubusercontent.com/claudiosmweb/ab41b5e8693eea7c02b8/raw/392305085efa1347c26498a1a5027037ae9c73be/000-default.conf
rm /etc/apache2/sites-available/000-default.conf
mv 000-default.conf /etc/apache2/sites-available
# Enable rewrite
a2enmod rewrite
# Restart Apache2
service apache2 restart
# Install WP-CLI
curl -sS -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
# Download the WordPress
cd /var/www
wp core download
# Config the WordPress and create the database using WP-CLI
wp core config --dbname="wordpress" --dbuser="root"
wp db create
# All done :)
# Now just open on your browser: http://localhost/

Use gmail to send emails from your dev environment

Install SSMTP

sudo apt-get install -y ssmtp

Setup

Edit /etc/ssmtp/ssmtp.conf file:

mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
AuthUser=<YOUR-EMAIL>@gmail.com
AuthPass=<YOUR-PASSWORD>

And make sure that your /etc/php5/apache2/php.ini have the sendmail_path configure like:

sendmail_path = /usr/sbin/sendmail -t

Then reload the apache:

sudo service apache2 reload

Test

wp eval 'wp_mail( "your@email.com", "Testing...", "Testing it!" );'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment