Step 6 – EASY
Downloading WordPress is super easy, and so is copying it to your server. But you may run into some small issues when “starting up” WordPress for the first time.
First, download the WordPress software from this page: Download | WordPress.org. This is the blog software that we’ll be running on our server. With it we can create blog entries, post pictures, moderate comments, etc. This software is the reason we’re all following this tutorial.
Then, download the FileZilla FTP Client from this page: FileZilla – The free FTP solution. This will be used copy the WordPress software to our server. It’s a simple drag and drop operation. Once downloaded, get this installed.
Second, launch the FileZilla FTP client and connect it to your EC2 cloud server instance. To connect, you’ll need to add your server by clicking the little icon in the upper left corner. This will open the Site Manager dialog.
From the Site Manager dialog, you need to make a few entries as described below:
- Host: your EC2 instance domain name, either the Amazon domain name like I’ve done below, the IP address, or the host name.
- Protocol: select “SFTP – SSH File Transfer Protocol”
- Logon Type: select “Key File”
- User: “ubuntu”
- Key file: the path to your key file from step 2: /home/MY_SERVER_KEY_PAIR.pem
- Also, on the left under “My Sites” you can click the server icon and give your site a memorable name. I tend to keep mine short, as you can see. Sometimes I have multiple sites for testing, so you may see something like SAMP-PROD and SAMP-TEST listed.
Once entered, click OK or Connect. On subsequent connection, click the icon we used to open this dialog, select your server from “My Sites” and click “Connect”.
The first time you connect, you’ll be asked if the server is something you trust. Of course, you trust your own server. So check the box provided and click Ok. This will be the last time you’ll see this dialog when connecting.
If everything goes well, you’ll connect and see “Remote site: /home/ubuntu” in the right column, and the contents of the /home/ubuntu folder below that. From here, you want to navigate to /var/www/html. This is where you will upload your WordPress files from earlier. You can navigate to this folder by typing “/var/www/html” in the “Remote site:” text field, or clicking on the folder icons in the “Remote site” window pane. Once you arrive at the /html folder, you’ll see that it has a single html file. This is the Ubuntu Apache start page we observed when connecting to our server in our web browsers in step 4.
Delete this index.html file from the directory.
If you get a permission denied error (which I have), follow these steps:
Connect via terminal, similar to prior steps. Next, execute these two commands. The first command says: “as a root user, I want to change ownership of all files in the html folder from their current owner to “www-data.www-data” owner. The second command says we should be able to fully control the files in the html folder.
sudo chown -Rf www-data.www-data /var/www/html/ sudo chmod 777 /var/www/html
Now you can delete the index.html file.
After deleting, run the chmod command one more time. 775 is a much better permission setting than 777, as it isn’t as broad:
sudo chmod 775 /var/www/html
Third, upload the WordPress software into the /var/www/html directory you’ve navigated to. Do so by unzipping the WordPress file, navigating into the WordPress folder. The contents in this folder are what you want to upload, and not the “WordPress” folder itself.
You can perform the upload by dragging the files into the “Filename” window right below the “Remote site” window (lower right corner). This file transfer will take a while, because we’re uploading a LOT of files. Even though the total file size doesn’t add up to much (9.5MB is small), there are a lot of transfer operations. So grab a coffee and relax.
Once complete, your /var/www/html folder should look similar to mine. If you visit your server via web browser now, you will no longer see the Ubuntu/Apache start page. Instead you’ll see a directory listing generated by the server. Shown below on the left is our FileZilla window, while on the right we see our web browser. They both show the same content.
Fourth step is to run the WordPress installation process. We can start this by visiting our website at the following URL. Note yours will look different because you have a different server than this sample:
Visiting this page will display the WordPress welcome page. Click “Let’s go!”
You will now be asked to enter your database connection details. These are the same details we entered into MySQL Workbench earlier. Feel free to keep the Table Prefix value as “wp_”, and hit Submit.
After submitting, WordPress will connect to your RDS database instance, create a number of tables required by the WordPress software, initialize a new index file, and perform whatever additional bootstrapping is required. This will result in a success message:
Click “Run the installation” and you’ll move to the next step in which you name your blog, setup a user name and password for the blog owner, and set the email. If you’re excited like me, you may even misspell the title of your blog! What was meant to be “Infinite Dab Sample Blog” came out as “Samples”. Lol. Thankfully we can change this later from the WordPress controls if needed.
Once you’ve made your entries and written down your password, click “Install WordPress”.
From the above “Success!” screen, you can pat your self on the back for a job well done, then click the “Log In” button to start using the WordPress software.
Note: the login screen you see here is a page that you’ll want to bookmark. It’s location at wp-login.php is probably not something you’ll remember at a later time. So do yourself a favor.
Also, note: if you’re logging in with the many different URLs that you have available, the logins DO NOT carry over to each other! In other words, if you login at www.yourblog.com/wp-login.php, that same login will not apply to a link to your blog at 127.0.0.1/wp-login.php, and will not apply to a link to your blog at 12345.us-west-2.compute.amazonaws.com/wp-login.php. So make sure the URL you’re bookmarking here is the URL you want your users to see, and that it’s the same URL you’re logging into consistently.
Why is this important? Well, when blogging, it’s very common to create a post that links to another post. If you’re logged into the WordPress software via your blog IP address (e.g. 127.0.0.1), the WordPress software will generate URLs for you which look like: 127.0.0.1/index.php/<date>/<your post name>/. These are valid, but ugly. If you log into yourblog.com, you’ll get something much prettier: yourblog.com/index.php/<date>/<your post name>.
Now visit your blog! As you can see below, WordPress generates a beautiful sample theme for you. Look at the top, you’ll see tools (because you’re logged in). Scroll down, you’ll see a sample post.
You’ve completed step 6, which is ranked at EASY difficulty. Now your blog is ready to go!
Because you’ve followed these steps, you have full flexibility to control your branding and monetize your blog however you wish! Start posting and have fun. Drop me a comment or a link if this series of articles was helpful for you!