Deploying your own WordPress on Ubuntu 18.04 in AWS: Part 1
Notice: Undefined offset: 1 in /webroots/wp-includes/media.php on line 68
In this tutorial, I’m going to go over the benefits and why you should at least consider the reasons to switch over hosting to your own hosting (or something a little more custom than your generic hosting company). This is going to be a multi-part tutorial, seeing as there is actually a lot to go over, and for those not familiar with the command line at all, there is going to be one steep learning curve. In my documentations of this journey I myself took, I have ran into lots of issues I’ve had to debug and research into, and I will do my best to pass on any of those tips and tricks that I have learned along the way that helped me resolve my issues.
Why AWS (Amazon Web Services)
Well, I tend to put my trust in Amazon, along with millions others in the nation. They haven’t done me wrong and are a great starting point for anybody actually wanting to learn more about hosting or anything web related. AWS offers tons of different services ranging from email services to deep learning. They are an Infrastructure as a Service (IaaS) company, meaning you handle everything on your own. You manipulate, maintain and customize your own servers, databases, AI or whatever service it is you choose to utilize. If you’re new to their services you can pay for their premium support, which I think means you get like x amount of hours of support based on how much you pay. Though AWS has perks for those new to their services and probably one of the greatest advantages they offer. AWS gives you a free year on nearly every service they offer (check this out for more information). Of course they limit your use per service, but they usually give you one instance of whatever it is running for the entire month, every month. For instance, 750 hours of EC2 (basic server) every month, which if you do the math, you will always be covered even on 31 day months. Launching your own Ubuntu instance will be free, however, to actually launch the website on the World Wide Web requires their DNS service Route 53. To route your domain name to your Ubuntu WordPress instance will cost you ~$0.50 a month. Their are data charges that apply on my account, though that might be because I use RDS (external database service). Your cost, even if we were to implement RDS as well, would only reach ~$0.50 – $0.60 a month. But enough of AWS, let’s get into the juicy stuff you’ve all been waiting for!
Setup your AWS Account
Let’s begin with an account at AWS. If you haven’t already created an Amazon account, please head over to Amazon.com and since you’ve never been there before, click the orange “Create an AWS Account” button in the top right corner.
This process is going to be your basic account setup, they do require you to put your credit card in, seeing as they charge you based on your usage. They are very lenient when it comes to accidentally overusing your services, or applying wrong settings, but don’t abuse it. There goal in offering a free year of service is meant for you to get in their and get your hands dirty.
Launching your Ubuntu Server
Now that we have an account, we can start on the fun part. Let’s get your Ubuntu server up and running. There are many advantages to hosting your own WordPress site, one being that you can install any and all optimizations or programs that can improve performance, or address certain issues with WordPress. Though the big guys out there are no doubt good at their job, and even have hosting deals targeted at WordPress, they can’t give your individual server the attention WordPress needs. Every website is different, every business/site has different needs. Having your own server gives you the ability to have immediate control over these things, not in the hands of some corporation that may or may not oblige your wishes in a timely manner.
It likely redirected you to your account dashboard once your account is created. Take a look at the navbar, at the top right you will see a dropdown services menu. click it.
Your first top left option should be “EC2” under “Compute”. that’s where we will create your Ubuntu server.
There should be a number of links first thing you see, one saying “0 running instances” (I already have an instance running, so mine shows 1 running instance). Click on that and it will take you to all your instances, off or on.
If you’ll notice the menu on the left, just to the right of that, above the instance dashboard, you will see the button “launch instance”. Go ahead and click that.
The quick start should automatically pop up, offering you many different versions of linux and windows servers. There is so much more than just the basic clean slate AMI’s listed on amazon. There is a marketplace for people that have come through and already created instances for specific applications, such as VoIP. Today we’re just going to look at the clean slate AMI’s since we’re walking through every step to setup your server. The AMI’s you find likely won’t be optimized for your specific use anyhow.
Scroll on down to the Ubuntu Server 18.04 LTS AMI and hit the select button on the right. Now, this is one of those parts that is going to look scary for the average user, most of the fine tuning details we’re going to ignore and maintain the defaults. If you are interested in learning more about AWS and what all these settings mean, 1). I recommend taking a networking class 2). there are also AWS certification classes that you can audit for free on edx.org if you’re just wanting to be able to make it work and don’t care about the gritty details. Today we’re going to just focus on getting your server up and running and not those details.
The free tier server should automatically be chosen by default (t2.micro). Click “Next: configure instance details”
On the next page, we’re just going to leave the default setting and click “Next: Add Storage”
Unless you plan on storing raw images or having a HUGE WordPress website, you’re just going to want to keep the default 8GB General Purpose SSD. click “Next: Add Tags”
Here you’re going to click on “Add Tag” and under the Key column type “Name”. Under Value you’ll want to put something pertaining to what the name of the server is. Possible suggestions would be the name of your website. Click “Next: Configure Security Group”.
By default SSH access on port 22 is enabled through their firewall (security group). Leave that there as we will need SSH access to our server. You’ll want to go ahead and click “Add Rule”. Find HTTP on the drop-down menu that appears with the new rule. It should open up port 80 from anywhere -> “0.0.0.0/0, ::/0”. That should be everything we need for now, later on you’ll want to enable HTTPS as it is common practice to secure your website. We will go over this part in a later post, Let’s Encrypt offers free security certificates as long as you know you’re way around Linux and Apache, which will be covered later on in this tutorial.
Official Launch Time
Now don’t get too excited! We are nowhere near ready to actually throw WordPress up on our server yet. Your server is going to have to need to install a few dependencies and programs that enable visitors to find our beautiful website that we create. For now just go ahead and click “Review and Launch”.
On the next page it’s just going to show you all the settings you’ve chosen to make sure it all looks right. As long as you followed these steps to the tee, you shouldn’t have anything to worry about here. Go ahead and launch your Ubuntu 18.04 server.
If you make your way back to the EC2 dashboard, you will find that your server is still starting up and hasn’t passed its ready checks. This isn’t too long of a process, but let it do it’s thing and turn green with 2/2 ready checks. After that, You’re going to want to go ahead and shut down your server until we reconvene next time so we don’t use up our resources. You won’t get charged a dime even if you left it on 24/7 for the next 12 months, however, it’s best practice to turn resources off that aren’t being used. But that’s certainly up to you, you can leave it on if you really want to.
Next up in this limited series tutorial, we are going to get our Ubuntu server up and running to support WordPress. The key here is Apache or Nginx, but the trick is WordPress has a number of dependencies and config files that you need to modify before everything will work properly. Next week we will install apache and its dependencies needed for wordpress, along with a couple other tools that will help you along your journey of maintaining your own WordPress server. Until next time.