Frankly, while I’m super happy user of Ubuntu on desktop and servers, I’ve been quite unsatisfied with Ubuntu for Raspberry Pi. Mostly, cause it ruined a few of my SD cards. I’ve realised that writing file access info to the card was one of the key factor here. Unfortunately, Ubuntu for RPi won’t but with noatime… while latest Rasbian has it by defualt.
What I like a lot about Raspbian Stretch Lite, is that beside natively supporting all Raspberry Pi features, it’s also cross platform compatible – it works super well on both, RPi2 and RPi3.
And yes, this blog among few other things is server from RPi2 🙂
After rather successful year of using WordPress, I have decided to move my blog to AWS. I was considering the move for long time, motivated by Free Tier and finally I found some time to do it.
At first, I have created WordPress Stack using CloudFormation, but personally I prefer Ubuntu over Amazon Linux and I will focus on configuration of Ubuntu EC2 instance here.
- Export your existing blog
WP-Admin > Tools > Export
- Login to AWS console and Create Key Pair
- Launch EC2 instance
I use Ubuntu HVM. I recommend t2.micro, as it’s free for the first year. You should specify created/uploaded key.
- Login to your EC2 instance using Public DNS or IP and your key
ssh -i .aws/your_key.pem firstname.lastname@example.org
NOTE: you key should be readable only by you. To achieve that, you can do:
chmod 600 .aws/your_key.pem
- Configure Ubuntu
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install apache2 php5 php5-mysql libapache2-mod-php5 libapache2-mod-auth-mysql mysql-server
- Configure MySQL
mysql -uroot -p
CREATE DATABASE wordpress;
CREATE USER 'wordpress' IDENTIFIED BY 'SOMEPASS';
GRANT ALL ON wordpress.* TO 'wordpress';
- Configure wordpress
tar xpfz latest.tar.gz
mv wp-config-sample.php wp-config.php
sudo chown -R www-data:www-data /var/www/html
# edit wp-config.php
- Configure Apache
# edit /etc/apache2/sites-available/wordpress.conf
Allow from all
# enable wordpress in apache2
sudo a2ensite wordpress
sudo service apache2 restart
- Enable HTTP access to your EC2 instance
Go to EC2 console > Instances > Select you instance > Description >
Click on your `Security group` > Select Inbound > Edit > Add rule > HTTP > Save
- Point your webrowser to your EC2 instance: http://ec2xxxxx.compute.amazonaws.com/
- Setup your wordpress account
- Upload dumped wordpress data
WP-Admin > Tools > Import > WordPress > > Upload file import
You will need to install WordPress Importer plugin.
- Assign post to correct user.
Don’t forget to Import Attachments!
- Install your favourite plugins and themes
As for plugins, I strongly recommend: JetPack, SyntaxHighlighter Evolved, Google Analytics Dashboard for WP and BackUpWordPress or ajax-load-more.
- Add favicon
Copy selected favicon.ico to /var/www/html/wordpress
BTW: You may want to increase security of your instance and setup swap just in case memory usage exceeds your EC2 instance size.
# configure 2GB swap (1M x 1024 blocks)
sudo dd if=/dev/zero of=/swapfile bs=1M count=2048
sudo mkswap /swapfile
sudo swapon /swapfile
# add swap info to /etc/fstab
/swapfile swap swap defaults 0 0