Install WordPress
Purchase a pre-installed image of this tutorial and check out our new knowledge base WordPress Now.
Install WordPress
It’s time for the fun part of installing WordPress. Full instructions are supplied in more detail at WordPress’ Codex.
Upgrade to the latest Ubuntu distribution and its packages:
sudo apt-get dist-upgrade
Create a www directory with permissions for the Apache web server:
sudo mkdir /var/www sudo chown www-data:www-data /var/www cd /var/www
Download the latest version of WordPress, expand the archive and set permissions:
sudo wget http://wordpress.org/latest.tar.gz sudo tar -xzvf latest.tar.gz sudo chown -R www-data:www-data wordpress
Install MySQL Server
Install the MySQL Server package:
sudo apt-get install mysql-server
You’ll be asked to provide a user name and password. Make note of your choices for use during the setup process.
Configure the MySQL Database. Change user name and password below to whatever you selected during the installation:
mysql -u root -p create database wordpress; grant all privileges on wordpress.* TO "your-mysql-username"@"localhost" identified by "your-mysql-password"; flush privileges; exit;
Setup Your WordPress Apache Site
If you did not choose an Amazon AWS AMI which pre-installed Apache, you may need to install it now:
sudo apt-get install php5 libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql
Now, it’s time to create a site configuration file for your Apache server to host WordPress:
cd /etc/apache2/sites-available
Let’s create a new file to edit:
sudo nano wordpress
Paste in the sample site file below and be sure to replace the naming convention for your domain name:
<VirtualHost *:80> ServerName YOURDOMAIN.COM DocumentRoot /var/www/wordpress DirectoryIndex index.php <Directory /var/www/wordpress/> AllowOverride All Order Deny,Allow Allow from all </Directory> </VirtualHost>
Tell Apache to enable the site and reload:
sudo a2ensite wordpress sudo service apache2 restart
Configure WordPress
Now, we’re ready to tell WordPress about the database and your blog. First, we’ll temporarily change the permissions on your wordpress directory:
cd /var/www sudo chmod -R 777 wordpress
Open a web browser and navigate to your domain name e.g. http://yourdomain.com.
Fill out the database information that WordPress requests using your choices above. The process will look something like this:
Now, let’s lock down the permissions for the WordPress installation for security:
sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \; sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \;
Let’s also make manual updates to the wp-config.php file:
sudo nano /var/www/wordpress/wp-config.php
Add the following configuration lines above the stop editing line:
define('FS_METHOD', 'direct'); // for automatic plugin installation /* That's all, stop editing! Happy blogging. */
Try logging into the WordPress Administration system. Visit http://yourdomain.com/wp-admin and enter the user name and password you chose during the installation process:
If you’re successful, it should look something like this:
Congratulations on your new WordPress installation. Now, it’s time to build the foundation for super fast performance.
Please feel free to post corrections, questions or comments below. You can also follow me on Twitter @reifman or email me directly.
Hi Gilbert, I don’t have a firm recommendation but if you can afford an RDS instance – that will provide more flexibility and easier redundancy…especially if you need a lot of scaling down the road.
Hi Jeff
Congratulations with this excellent guide for setting up wordpress on Amazone servers! I have some servers running on Amazone and the Firewall can be very tricky. I prefer myself to use Red Hat / CentOs and in that OS I have to deal also with the Firewall of the OS itself. I guess that counts for Ubuntu as well? Maybe also worthwhile of mentioning DNS records? Like this the site will be visible if you know the IP address. WordPress allows you to use one installation for multiple sites. That comes out very handy if you want to host several sites on only one instance of WordPress. You will be able to save recourses of the server.
Thanks Guido. Do you have a specific question you want me to address? I decided not to deeply describe DNS records as there are many other tutorials on the web for that.
Hi Jeff
You wrote “You’ll be asked to provide a user name and password”. However, I was only asked to change the root password. I have not been asked to provide a user name.
Did I do something wrong with the installation of mysql server?
Thanks.
Has any of you were able to show a featured image? My featured images are not showing on wordpress hosted via amazon. I also followed the steps you above, but it still won’t show a featured image. I am able to upload a featured image, but it cannot be seen on the homepage and on the post. I also used the same theme on wordpress hosted under bluehost, and the featured image is showing perfectly. Any ideas?
In order to get it work, we need to enable the port 80 for HTTP first. It’s not in default >.<
This stuck me for long…. so noob
Jeff –
Old package ?
error “Package libapache2-mod-auth-mysql is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source”
Apparently it’s no longer necessary, per
http://stackoverflow.com/questions/20458641/package-libapache2-mod-auth-mysql-is-not-available
– (I installed the other three packages individually, and phpmyadmin – and it worked)
This is a phenomenal service you’ve provided. I am very grateful.
I’m walking through this and was stopped at the stage when we put sudo ap2ensite wordpress . recievied the error Site wordpress does not exist! Can’t figure out why.
You may want to double check that your `wordpress` file is in the proper folder: `/etc/apache2/sites-available`. Otherwise, I’m not too sure. Good luck!
Rename the ‘wordpress’ file needs to ‘wordpress.conf’.
Depends on your version of Apache/Ubuntu. Later versions require .conf extension on site config files.
On the following step under “Configure WordPress”: `Open a web browser and navigate to your domain name e.g. http://yourdomain.com.`
I get the following message: `You don’t have permission to access / on this server.`
Should this be changed to `http://yourdomain.com/wordpresss/`? It would make sense, because WordPress is extracted under the `/var/www/wordpress` folder, not the root directory `/var/www`, right? Or should we extract WordPress to `/var/www/`?
Or am I missing something?