Wordpress on Linux in the Amazon Cloud with Mac

Before we beign

I believe this article is of high value to any web developer seeking a better hosting solution, and in particular, cloud hosting. Though somewhat technical, the instructions given here are easy to follow, and you don't need a background in server management or server-side development to follow the tutorial. I'm a designer, and the first time I ever opened terminal was when I was trying to connect to my amazon linux server, so if you don't feel like you're up for setting up your own linux server, then trust me, it's easier than it sounds. Because of it's length and technical nature, I've also made the article available for download in MS Word format.

Amazon EC2 Cloud Hosting

Amazon provides an incredible, ever-expanding service for cloud hosting. Their EC2 service is bundled with a fantastic CDN (S3), Site Monitoring (Cloud Watch), and a myriad of complementary tools and services that make Amazon a great option for moving your site into the cloud. This is a guide to help you take advantage of those services.

Linux vs. Windows

The reason for choosing Linux vs. Windows is simple: cost. It’s much, much cheaper in the long run, well, in any run, to host an EC2 instance with Linux over Windows. Considering the relative operating costs, the choice is easy.

Don’t worry, Be Happy

If you’re like me, you’re mildly daunted at the idea of getting your hands dirty with Linux and Terminal. Don’t worry; it’s easier than it looks. I’m a designer, and until recently knew almost nothing about Linux or Terminal. I found that after you get the basics down, it’s surprisingly easy to get moving with the rest.

Getting Started

The first thing you’ll need on this journey is an account with Amazon Web Services (AWS). Simply head to http://aws.amazon.com, and click the Create an AWS Account link at the top. They’ll have you verify your identity by giving you a PIN over the phone to complete your registration.

Setting up your Instance

After you’ve signed in with your new AWS account, you’ll want to click into the Amazon EC2 tab, and then click the Launch Instance button.

Amazon EC2 offers a multitude of Amazon Machine Image’s (AMI’s) to choose from, including both Linux and Microsoft options, but as stated before, we’ll be working with Linux. Yay!

Select the Basic 32-bit Amazon Linux AMI 2010.11.1 Beta (AMI Id: ami-76f0061f).

Next, on the Instance details section, make sure to select Launch Instances, and then select your instance type. I chose micro, because it not only defines the amount of traffic my site gets, but it’s free for a year.

From here you can also define the number of instances you’d like, and the availability zone, I kept the defaults. Hit continue.

In this section, you can configure Advanced Instance Options, including enabling CloudWatch (very handy monitoring tool), but again I left everything on their defaults.

Now you can add some tags; you can read about using tags here: Using Tags. After you’ve selected your tags, hit continue.

Now we’ll create the Key Pair for this server. Select the name, and hit the Create & Download your Key Pair. Do not loose this file, it’s important, and you can’t download it again. Keep it secret, keep it safe. After you’ve downloaded your key pair, you’ll be brought to the next step.

On the next step, select Create a new Security Group, and then give it a name and description. We’ll want to add at least two rules here, SSH and HTTP, you may want more rules depending on how you’ll be using this server. Make sure you select SSH and HTTP.

That’s it! Just hit the Launch button (makes you feel like your head of mission control for NASA), and wait for your instance to launch. You can just hit close on the next dialog box.

After your server has moved from pending status to running status, move to the left hand menu, and select Elastic IPs, where obviously we’ll be giving our server an IP address.

Click the Allocate New Address button, select the new address, and hit the associate button to assign this IP address to the Instance you created.

Configuring SSH

Now that we have an instance up and running, we can connect through Secure Shell (SSH). This article was written for Mac users, but Windows users can accomplish the same thing using a program like PuTTY. So now we’ll need to grab that .PEM file you saved in a secure spot when you downloaded your Key Pair. Again, don’t loose this file. First we need to copy that .PEM file (mines called calebogden.pem) into the .SSH folder of your mac. Open up terminal and input this command to open that hidden folder.

open ~/.ssh

Drag your .PEM file into the SSH folder.

Now we can test our ssh connection through terminal. Launch terminal, and input this command:

ssh -i ~/.ssh/YOUR_KEYPAIR_FILE.pem ec2-user@YOUR_IP_ADDRESS

When asked about the authenticity of the host, type yes and hit enter. You’ll likely also see a warning that says WARNING: UNPROTECTED PRIVATE KEY FILE!, in which case run this command to give your .PEM file the proper permissions.

sudo chmod 600 ~/.ssh/YOUR_KEYPAIR_FILE.pem

If you had to change the file permissions, then run your connection again. You should see this beautiful welcome text.

Connecting as the Root User

Now that we’re in, we want to work as the root user, but we’ll have to jump through some hoops to be able to connect as the root every time. If you try to connect with root at first, instead of ec2-user, you’ll hit a roadblock. To fix this, become a superuser (I know how awesome that sounds) by running this command.

sudo su

Now we’ll open the SSH config and change some settings. As with all things in Linux, you want to be very careful to only change / edit what’s listed here. To open the config we’ll be using the Linux Vim editor by running this command.

vi /etc/ssh/sshd_config

Find the line that has the setting PermitRootLogin forced-commands-only, comment that out by putting a # sign before it, and then add PermitRootLogin without-password beneath it. This will allow us to connect as a root user.

Note: To start editing, just hit the ‘I’ key while in VIM, to exit the insert mode, it the ESC key.

After you’ve fixed the config file, hit ESC to exit insert mode, and then run the command :w to write, and the :q to quit, alternatively :wq.

Now we have to change the authorized_keys SSH file to not run commands in the first line. Open that config file with the command:

vi /root/.ssh/authorized_keys

Once its open, delete the command command="echo 'Please login as the ec2-user user rather than root user.';echo;sleep 10, all the way until you reach, ssh-rsa. Now it ESC and :wq to leave vim.

We now need to restart the SSH service, this is done by using the command:

service sshd restart

Now open a new terminal window without closing the old one, and test the connection.

ssh -i ~/.ssh/YOUR_KEYPAIR_FILE.pem root@YOUR_IP_ADDRESS

You should see the beautiful welcome message again; you’ll now be connected as a root user. Awesome.

Exhausted yet? Well we’re just getting started. Now, head back to the hidden .SSH folder on your computer, create a new file called config (no extension), you’ll need to use a text editor when making change to this file. We’ll just create a shortcut that will allow us to connect easily with programs like Coda and Transmit, and an easy entrance with SSH through terminal.

In this config file, we’ll define a Host, User, IdentityFile, and HostName

Host HOST_NICKNAME_HERE User root IdentityFile "~/.ssh/YOUR_KEYPAIR_FILE.pem" HostName YOUR_IP_ADDRESS

Now head back to terminal, open a new window, and test the connection with this line:

ssh HOST_NICKNAME_HERE

You’ll see the familiar welcome text, and now we’re now ready to start pumping in software!

Installing Server Software

Programs can be easily installed with the yum command. So lets start by installing Apache with the command line:

yum install httpd

And then start apache with command:

service httpd start

Now we’ll install PHP and some needed libraries:

yum install php libmcrypt libmcrypt-devel php-mcrypt php-mbstring

After which we’ll want to restart Apache:

service httpd restart

Install MySQL

yum install mysql yum install –y mysql-server

Start MySQL Server

service mysqld start

Now we can assign a MySQL Server password

/usr/bin/mysqladmin -u root password ‘SUPERSECUREPASSWORD’

And that’s it! You have your basic webserver, php, and mysql installed. At this point you can see things coming together by browsing to: http://YOUR_IP_ADDRESS. You should see the Amazon Linux AMI Test Page.

Installing phpMyAdmin

Now since phpMyAdmin isn’t in Amazon’s yum, and since some older copies are buggy, we’ll install the latest version by hand.

First lets go to the Document Root (where apaches loads files for the web from), which should be /var/www/html, but you can verify by running the command grep DocumentRoot /etc/httpd/conf/httpd.conf.

Go to Document Root

cd /var/www/html

Download phpMyAdmin 3.3.9.1 (or latest version, if you update a later version, remember to change your folder/file paths to the correct version)

wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.3.9.1/phpMyAdmin-3.3.9.1-all-languages.tar.gz

Extract to Document Root

tar -xzvf phpMyAdmin-3.3.9.1-all-languages.tar.gz -C /var/www/html

Rename folder to phpmyadmin, and delete downloaded file.

mv phpMyAdmin-3.3.9.1-all-languages phpmyadmin rm -rf phpMyAdmin-3.3.9.1-all-languages.tar.gz

We now need to add a user and give that user permission for this folder:

adduser phpmyadmin passwd phpmyadmin

After you set a password, find the user group (should be apache) with this command:

egrep 'User|Group' /etc/httpd/conf/httpd.conf

Which will return:

User apache Group apache

And last, run this command to associate that user with the phpmyadmin folder:

chown -R phpmyadmin.apache phpmyadmin/

Now we need to go the that folder, and set some permissions:

cd /var/www/html/phpmyadmin/ mkdir config chmod o+rw config cp config.sample.inc.php config/config.inc.php chmod o+w config/config.inc.php

And now we should restart Apache…

service httpd restart

Finally! You can head over and configure your phpMyAdmin!

Browse to: http://YOUR_SERVER_IP/phpmyadmin/setup/index.php, and hit the new server button.

The only values you need to input are the Verbose name of the server, and Password for config auth.

Now you can login by browsing to: http://YOUR_SERVER_IP/phpmyadmin/index.php. Username will be root and password is whatever you set as your super secure password for MySQL above.

NOTE: If you see an error that says “Cannot load mysql extension. Please check your PHP configuration”, then run the commands below, and then reload the page. You may have to wait a few seconds after you restart it. If the message still displays, try restarting a final time after waiting a few minutes.

yum -y install php-mysql service httpd restart

After you log in, as the warning near the bottom of the page says, the last step is to remove the config folder we created above, and adjust some other options.

cd /var/www/html/phpmyadmin/ rm -rf config

Now use VIM to rename, and edit the main config file:

mv config.sample.inc.php config.inc.php vi config.inc.php

Add a BlowFish Secret as shown below:

$cfg['blowfish_secret'] = 'SuckBird'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Hit ESC, and then :wq to save and quit.

Now, we head back into the world of GUI, and setup our Wordpress Database. Getting close!

Browse to: http://YOUR_IP_ADDRESS/phpmyadmin/index.php, after you log into phpMyAdmin again, create a new table called wordpress.

After this table is created, head to the privileges tab, and add a new user. Fill in the User name, and password / confirm. For the Database for user section, select the option Grant all privileges on database "wordpress”.

Whew! That was intense. Okay, just a few more minutes and you’ll have your Wordpress Platform running on Linux.

Installing Wordpress

Now the easy (and fun) part of the process, getting wordpress installed. Head back to the root:

cd /

Execute these commands to download wordpress, extract it to your Document Root, and install wordpress in the main root of your site.

wget http://wordpress.org/latest.tar.gz tar -xzvf latest.tar.gz -C /var/www/html cp -avr /var/www/html/wordpress/* /var/www/html rm -rf /var/www/html/wordpress

Lastly, we need to give Apache some permissions for the Document Root folder.

chown -R apache /var/www/html chmod -R 755 /var/www/html

Now lets do a restart on apache, and start setting up Wordpress!

service httpd restart

Browse to your wordpress site: http://YOUR_IP_ADDRESS. You should see a Create Configuration File button, click that, and then click the Lets Go button.

Input your credentials

Input your Wordpress Site information…

Success!

From this point, you can connect easily with programs like Coda and Transmit to start working on your code!

Conclusion

Amazon Cloud is, by far, the best option I’ve found for Cloud Hosting, and this article barley scratches the surface of the power found in the variety of AWS products.

As for hosting on a Linux server, there is a reason Microsoft is so dang expensive to operate; it’s a lot easier to get things started, however, the cost savings with operating on Linux vastly outweighs the rigors of using it.

Once you’ve gone through this process a single time, you can launch additional images based on the AMI you created, which in turn means you can get your clients hosted in the cloud on their own server, free for a year, with a few seconds of work. Now that’s incentive.

Additional Help and Resources Used

This article could not have been possible without the stellar work of the people who own the resources below. In addition I've turned on comments for this article to answer any questions.

JeffreySambells http://jeffreysambells.com/posts/2010/08/04/connecting-to-amazon-ec2-using-transmit

How-To Geek http://www.howtogeek.com/wiki/Fixing_%22WARNING:_UNPROTECTED_PRIVATE_KEY_FILE!%22_on_Linux

The Geek Stuff http://www.thegeekstuff.com/2010/09/install-phpmyadmin/

2Bit Coder http://www.2bit-coder.com/2010/09/wordpress-in-the-cloud-amazon-ec2/

Whirix Blog http://blog.whirix.com/2011/02/root-login-to-amazon-ec2-instance.html

Linux Blog Magazine http://www.jonboy60.com/2010/08/23/howto-install-mcrypt-and-recompile-php/

nixCraft http://www.cyberciti.biz/faq/howto-find-unix-linux-apache-documentroot

9258 Responses to Wordpress on Linux in the Amazon Cloud with Mac

  • Finely done, I was up and running in less than 30 minutes. The time you spent putting this together is highly appreciated!
    viaKyle Schaeffer
  • Still a little scared of linux... but this write-up almost makes me want to try it out. Thanks for the great post!
    viaDave
  • Tried it and have spent over 4 hours working on it. I was able to find my .ssh on my mac but was unable to move forward. Would it be possible to have a skype conversation to learn and maybe have someone take over the controls. Totally willing to pay as this is very important information to launch multiple websites. Thanks is advance. Best regards, Pablo
    viaPablo
  • @Kyle Awesome!

    @Dave Thanks, we should have a linux party at Hard Times :)

    @Pablo To launch multiple sites on the same instance you have to configure a vhost file, which I'm adding to the documentation soon.

    You could SSH into the server from your mac? If you get that far it's very important to make sure you're connecting as the Root user (see Connecting as the Root User section) or you wont be able to move forward.

    If you're still stuck after that shoot me an email.
    viaCaleb Ogden
  • [...] phpMyAdmin by following the steps here (Warning: It’s quite long. You can skip this part if you [...]
  • Very diligent indeed. I spent the whole day trying to figure how to install phpmyadmin on EC2 to no avail. I wish I had seen your post earlier in the day to save me time.

    Your effort is much appreciated.

    Cheers
    viaAmar
  • Hi, I follow all the steps and thank you very much for this details instruction,

    I managed to get wordpress running,
    But how can we point our domain .com to the wordpress installed site?
    viaSantel
  • Hi Caleb,
    Great post, followed it and it worked perfectly. Now, how would you use the same ec2 beta instance to host multiple hosts (vhosts) in apache and have the same phpmyadmin access to all of them. For example, havinging www.site1.com/phpmyadmin, www.site2.com/phpmyadmin, www.site3.com/phpmyadmin

    Thanks,
    Ibrahim
    viaIbrahim KHader
  • @Amar Glad to hear it!
    @Santel Point your DNS A record to the Elastic IP that Amazon provided you (what you connect to with SSH).
    viaCaleb Ogden
  • @Ibrahim I'm following up this post with another on how to do that, but to be short, you have to define a vhost file in your config. You define that by creating a "vhosts.conf" file in your conf.d folder of your config. So the path url would be:

    /etc/httpd/conf.d/vhost.conf

    And then you can define VirtualHosts like this:


    ServerName www.XXX.com
    DocumentRoot /var/www/html/XXX


    ServerName www.YYY.com
    DocumentRoot /var/www/html/YYY


    ServerName www.ZZZ.com
    DocumentRoot /var/www/html/ZZZ


    If you google that syntax you can find more options than I included there.
    viaCaleb Ogden
  • Is the virtual hosts tutorial up yet?
    viaPaul
  • [...] by Caleb Ogden on 13 May 2011 In my previous article outlining how to setup an instance of WordPress on Amazon’s EC2 Cloud hosting a Linux server with Mac, I described a single website setup for the server. In an addendum to that article, I’m going to [...]
  • Here is the virtual host tutorial: http://www.calebogden.com/multiple-websites-amazon-ec2-linux-virtual-hosts/
    viaCaleb Ogden
  • When I type the "vi /etc/ssh/sshd_config" command I do not have the same information provided in your screen shot. All that shows up is a bunch of ~ on each line and blank space. Do you know why this is happening? I believe I followed your directions correctly until this part.
    viaJeffrey
  • Hi Jeffrey, Here's a few things to check:

    - Make sure you have your security groups setup to include SSH (see above), including correct ports.

    - Make sure you're connected as root user, instead of ec2user

    - Make sure you can use VIM in other capacities
    viaCaleb Ogden
  • This post is awsome. It just feels like a designer's writing, great job!
    viachihao
  • Hi Caleb,

    Thank for your clear tutorials. I can now manage to have few blogs hosted on EC2.

    I have another question, By following these steps, where are the root stored? Is it on local Instance or EBS?

    I don't know if we can verify this.
    THanks
    viaSantel
  • superb article !!! thumbs up!!
    viaharshadura
  • Thanks for this article!

    Slight problem when downloading phpMyAdmin using your syntax given.

    It only worked when I changed the version from 3.3.9.1 to 3.4.2 (latest release at time of writing).

    So I assume that for anyone following this guide in future, they should be changing the version number to the latest release?

    Cheers
    viaZihui
  • @Santel What root are you referring to? There's a lot of roots in Linux :-), I *believe* things like Document Root and Root User are stored on your local instance.

    @Zihui Exactly, thanks for the note, I've updated the article to reflect your comment.
    viaCaleb Ogden
  • Thanks so much for your help with this post!

    The only item I tripped up on was changing the permissions for apache, I found that the username was not "apache" but "www-data", so I replaced your above chown to:


    chown -R www-data /var/www/html


    And it works perfectly now!

    Thanks again!!
    viaRyan
  • So, I think I have followed your instructions to a 'T', but when I get to the 'ssh HOST_NICKNAME_HERE' part, to test the connection with the config file, this is what I get:



    David-J-Labourdettes-MacBook-Pro:~ David_Labourdette$ ssh webserver
    /Users/David_Labourdette/.ssh/config: line 1: Bad configuration option: {rtf1ansiansicpg1252cocoartf1038cocoasubrtf350
    /Users/David_Labourdette/.ssh/config: line 2: Bad configuration option: {fonttblf0fswissfcharset0
    /Users/David_Labourdette/.ssh/config: line 3: Bad configuration option: {colortbl;red255green255blue255;}
    /Users/David_Labourdette/.ssh/config: line 4: Bad configuration option: margl1440margr1440vieww9000viewh8400viewkind0
    /Users/David_Labourdette/.ssh/config: line 5: Bad configuration option: pardtx720tx1440tx2160tx2880tx3600tx4320tx5040tx5760tx6480tx7200tx7920tx8640qlqnaturalpardirnatural
    /Users/David_Labourdette/.ssh/config: line 7: Bad configuration option: f0fs24
    /Users/David_Labourdette/.ssh/config: terminating, 6 bad configuration options



    ...any ideas on why? and how I can fix that?
    Thanks!
    viaDavid Labourdette
  • Hi David, That config file is very touchy. I've had issues as you're describing from whitepsace characters being out of place. Make sure you're using a text editor to modify it, and that there's no trailing white space.
    viaCaleb Ogden
  • Can you add how to install FastCGI with this guide?
    viaAlex
  • I've looked, no extra spaces or anything???
    I'm using TextEdit to edit it, is this ok?
    In the config file is there a special nickname that I am supposed to use, or can I just make one up? and is the IP address the one that was assigned to me in the Elastic IP section of the EC2 page?

    ...it's not even letting me get to the welcome screen in terminal anymore- I'm still getting the bad configuration options message, but this time there seems to be 8 errors on 9 lines... so maybe it has nothing to do with the config file???
    viaDavid Labourdette
  • well, I got it to work... i deleted the config, and it let me in. So I opened applescript and wrote it in there, saved it on my desktop as a text .applescript, then I erased the file extension - and instead of showing up as a 'Type: Document', it showed up as a 'Type: SimpleText Format' - and that seems to do the trick for now!!! :-)
    viaDavid Labourdette
  • Hello! An excellent guide, well written, and it was all going so well for me…!

    I get stuck at the "NOTE: If you see an error that says “Cannot load mysql extension. Please check your PHP configuration”, then run the commands below, and then reload the page. You may have to wait a few seconds after you restart it. If the message still displays, try restarting a final time after waiting a few minutes."

    I've tried running the extra 2 lines, and restarted httpd, and mysqld, but still get the error.

    Anything else I could possibly try?
    viajake
  • ok, sorted out my own question, I had to go to

    http://YOUR_IP_ADDRESS/phpmyadmin/ instead of http://YOUR_IP_ADDRESS/phpmyadmin/index.php

    and it worked… I'm guessing it wasn't a coincidence in time waited after a httpd restart!

    Thanks again, all up and running. Will venture into the Virtual Hosts tute next!
    viajake
  • [...] overkill for me, but as I look for a way to offer and manage wordpress to a few clients, this seems like a brilliant idea. by Roberto • March 17, [...]
  • Oh...plz help me

    when i go to http://MYIP/phpmyadmin/index.php

    it said " the mysqli extension is missing.Please check your PHP configuration"

    Can anyone help me?
    viaJordan
  • [...] ended up following this excellent tutorial from Caleb Ogden. Aimed at a mac user, clear, concise, I was up and running in about 30 minutes. [...]
  • Great guide. I followed everything and then when it came to logging in I got a "1045 Cannot Loin in to MySql Server." I tried it two more times and still no luck. I am sure I am following your instructions. Any ideas? Anybody else have this problem?
    viaAT
  • @AT Yes, I got stuck at the same place.

    #1045 Cannot log in to the MySQL server

    But the supersecurepassword I was entering was the one I set for config auth but it has to be your MySqladmin password.
    viaSS
  • @Alex I'll look into adding that

    @David Labourdette Yes I've had the same problem before, and that was the only solution I could find.

    @Jake Glad it worked!

    @Jordan Please see my note in regards to the error "Cannot load mysql extension. Please check your PHP configuration". Follow those instructions and it should work.

    @AT, @SS Yes you need to be careful while setting your passwords, but as SS mentioned you need to use your MySQLAdmin password.

    Keep in mind that typos and spelling mistakes will a lot of problems, everything in my tutorial above should be copy/paste.
    viaCaleb Ogden
  • This worked for me when I got the “1045 Cannot Loin in to MySql Server.” error. From command line:

    ]# mysql -uroot
    >SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your password here');
    >flush privileges;
    q
    then
    ]# mysql -uroot -p
    viaRheses
  • Thanks for this article. Especially the part of installing phpMyAdmin was really helpful for me.
    viaMaBa
  • [...] that are used for phpmyadmin at all, so you’ll need to install it manually. Check out this post by Caleb Ogden about doing just [...]
  • Many thanks for your amazing guide and now I got my first wordpress running on EC2. But I had a problem with permalink > /%postname%-00%post_id%.html. So how to solve this problem, TQ
    viaByrest
  • Hi Caleb! Great job putting this doc together, I will keep this link safe as my primary doc to set up Amazon Ec2 instances!! :)

    One question: after configuring the phpmyadmin, the ip/phpmyadmin/setup/index.html is still available and apparently without a password protection.... Is that the way it is supposed to be?
    viaMarcelo Nascimento
  • i can only say : awesomeness. gracias
    viachi
  • Anyone have any ideas on setting up an SFTP user for uploading documents to the web root?
    viaMark Walker
  • Hi Caleb,
    Great tutorial, very helpful. I have run into a problem though when trying to upload a theme through the admin interface. I get a message saying 'The uploaded file could not be moved to /var/www/html/wp-content/uploads/2011/10.' It is just a regular zip file.

    I've used it before on my other WP install. I've tried changing the owner of the uploads folder and the themes folder. I've tried to delete those folders and have them be recreated automatically, as well as recreated manually.

    I know a new Amazon AMI just came out this week, any chance that has caused something to change (can't think of what though.) Any feedback would be very helpful.

    Thanks,

    Marc
    viaMarc M
  • Hi Marc, Have you tried altering the permissions for the 10 file, not just the 2011? Try setting your 10 to 777.

    I've had similar issues, and I believe that was the fix was getting the correct config on permissions, which, if I remember, was 777 on the month folder.
    viaCaleb Ogden
  • Thanks for the quick reply - unfortunately still no luck. I did chmod -R 777 2011 and 10, the restarted. Same result.

    I am new to WP (and linux, aws etc.) but does it seem odd that it is trying to move the zip of the theme to the uploads folder and not the themes folder?

    One the first installation I uploaded the file manually and unzipped it to the themes folder. It worked (more or less), but when I imported my images from my original WP site (export -> import) I could no longer change the sizes. Not sure if that is a sign that there is an issue with the permissions or what.

    Hmm... other than that, I log in as root. The folders both show apache|apache as Owner|Group. Any other ideas? I mainly want to get this set up so I can do your next tutorial and host my few small websites on AWS on the same server rather than 1 server for each.
    I googled this stuff, and only things I found other than the chmod was checking PHP to make sure it wasn't in safemode, which it isn't.

    Thanks again for the quick reply... any idea's are worth a shot.

    Cheers,

    Marc
    viaMarc M
  • [...] References: Installing FTP on EC2, Socket.io getting started, inspiration for this article, there also a great post here. [...]
  • Very well written article. Started with http://www.2bit-coder.com/2010/09/wordpress-in-the-cloud-amazon-ec2/ and followed through to here when I saw that you'd done this on a Mac.

    Thanks for doing the hard work for me!
    viaSeenu
  • Hi, brillant tutorial.. reached till the end and logged on to http://MY_IP_ADDRESS/phpmyadmin/ - entered the username as 'root' and the password.
    On the next screen i get the following error:
    '#2002 Cannot log in to the MySQL server'

    and at the bottom it shows:
    'Cannot load mcrypt extension. Please check your PHP configuration.'

    I'm completely new to Linus and php so followed the instructions word by word...Please
    viaAmit
  • Hi Amit, I accounted for this exception in the article, did you see this portion?



    NOTE: If you see an error that says “Cannot load mysql extension. Please check your PHP configuration”, then run the commands below, and then reload the page. You may have to wait a few seconds after you restart it. If the message still displays, try restarting a final time after waiting a few minutes.

    yum -y install php-mysql
    service httpd restart


    Try that out, and it should fix your issue. Good Luck!
    viaadmin
  • Yeh, I did try this step out... and not only I tried after few seconds but also an hour later... same result... so not sure what have I missed...

    also what is the error regarding mycrypt extension?

    Thanks
    Amit
    viaAmit
  • Hi Amit, it happens when you don't have the libraries installed correctly. See above for instructions on how to do it.
    viaCaleb Ogden
  • [...] to use any privileged commands then you have to use the sudo command. At this point I discovered this [3] tutorial, which is a bit more up to date. Despite the title it is not specific to Apple [...]
    viaAndrew Johnson's Weblog : Moved
  • Easier way "Connecting as the Root User"...
    after login with ec2-user type:
    sudo sh
    then type:
    passwd:
    set root password
    retype root password

    then

    vi /etc/ssh/sshd_config
    Uncomment PermitRootLogin yes
    then change
    PasswordAuthentication yes
    to
    PasswordAuthentication yes

    done!
    viaHayden
  • Easier way “Connecting as the Root User”…
    after login with ec2-user type:
    sudo sh
    then type:
    passwd
    it will prompt you to set "root"
    set root password
    retype root password

    then

    vi /etc/ssh/sshd_config
    Uncomment PermitRootLogin yes
    then change
    PasswordAuthentication no
    to
    PasswordAuthentication yes

    done!
    viaHayden
  • This is very fascinating, You are a very skilled blogger. I've joined your feed and stay up for looking for more of your magnificent post. Additionally, I have shared your site in my social networks
    viacloudhost.vn
  • Caleb, you are a genius! I was looking for a simple intro to EC2 for a new guy we hired at our company. I had him go through this and your virtual hosts tutorial and he instantly got the concept with EC2. Thank you so so much for saving me hours explaining this to him!! :)
    viaMarcus
  • @Hayden thanks for sharing!
    @cloudhost.vn Grand!
    @Marcus That's awesome! Glad it's easy to follow :-)
    viaadmin
  • I'm really inspired with your writing abilities and also with the format to your weblog. Is this a paid subject matter or did you modify it your self? Either way keep up the excellent high quality writing, it is uncommon to peer a great blog like this one these days..
    viaskype for mac
  • Thanks for the comprehensive guide. Did you check out BitNami? It's basically a one click installation for all sorts of services over EC2, Wordpress included. I couldn't use it because some of my websites require non-english Wordpress installations but otherwise it looks pretty sweet.
    viaEran
  • Great post! One thing however: following your instructions step by step the config.inc.php file never gets copied back out of the config folder - so any modifications made on http://YOUR_SERVER_IP/phpmyadmin/setup/index.php will get lost.
    If you copy that file to the phpmyadmin folder after configuring you won't have to set the blowfish secret anymore - it happens automatically as part of the setup configuration.
    viaBirgit
  • This is a excellent tutorial! Easy to follow and understand. Every step is clear and perfect, without being wordy or trite.

    I had one problem that I am trying to work out. After going through your tutorial, I stopped my EC2 and went to bed. When I restarted the server the next morning and tried to log in with Putty, I received an error message back from the server: "server refused our key." This is the same key I used the night before for both the ec2-user and root.

    There seem to a lot of people that get that error message, but apparently for different reasons, so I was unable to find anything that seem to fit my circumstance.

    Was I supposed to go back and restore the root config files, or did I miss a step that was supposed to prevent this after a reboot?
    viaGil Yoder
  • [...] por pereza, tampoco lo pretende… Para que tengáis referencias, nos hemos basado en las de Cale Bogden y Stephen Ermann, que están bastante bien. Os vamos a contar los matices que hemos introducido [...]
    viaCómo lo hemos hecho | mbmb
  • I have seen millions of tutorials on different website and this was the only one which is so detailed and easy to use. Keep up the good work. You are clearly a talented designer and a great writer/teacher.

    Good job!
    Pez
    viaPez
  • Hello!

    Nice tutorial, thanks!!

    I've done all the stuff but when I try to acces to http://XX.XX.XX.XX/phpmyadmin/ or http://XX.XX.XX.XX/phpmyadmin/index.php or http://XX.XX.XX.XX/phpmyadmin/setup/index.php I get the following error:

    Forbidden
    You don't have permission to access /phpmyadmin/index.php on this server.

    Any idea?

    Thanks!!
    viaOriol
  • Man, this is the tutorial I have been searching for!! You have written this superbly – can't wait to get my hands dirty! Thanks Caleb.
    viaMatt
  • Caleb, can you tell us how to connect via Transmit? I followed the guide you have listed above, to no avail. Transmit gives me the user/pass error all the time. My .pem key works in ssh, so I can't see what the issue is…
    Thanks!
    viaMatt
  • [...] reference from: http://calebogden.com/wordpress-on-linux-in-the-amazon-cloud-with-mac/ [...]
  • [...] http://calebogden.com/wordpress-on-linux-in-the-amazon-cloud-with-mac This entry was written by funhead, posted on January 10, 2012 at 10:20 pm, filed under Amazon EC2. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL. « Hello world! [...]
  • [...] my previous article outlining how to setup an instance of WordPress on Amazon’s EC2 Cloud hosting a Linux server with Mac, I described a single website setup for the server. In an addendum to that article, I’m going to [...]
    via??? | T1
  • Awesome article. I'm curious though. Is there a reason why you chose to go 32-bit instead of 64-bit? Can you still follow your guide if you just swap in the 64-bit versions of everything and use the 64-bit AMIs instead?

    I'm about to follow your guide to migrate my wordpress site to EC2 and was just wondering why you didn't go 64-bit.

    Thanks,
    Dan
    viaDan
  • Hi Dan, There's no convention, steps will work with 64-bit (and is a better choice for most people), I believe when I made this article 32-bit was cheaper, although I'm not aware of the prices as of now.
    viaCaleb
  • Hi Oriol, Make sure your folder has the correct permissions to be able to access from there.
    viaCaleb
  • This guide rocks! After searching for hours I found a ton of guides on how to setup a LAMP stack on EC2 but most of them were out of date or looked incredibly complex.

    It took me about 30 minutes to get the 64-bit instance up and running with wordpress installed by following this guide. Amazing.

    You literally saved me $24/mo. that I was ready to pay for an automated cloud management solution.

    Thank you!
    viaDan
  • [...] http://calebogden.com/wordpress-on-linux-in-the-amazon-cloud-with-mac [...]
  • I was doing fine until I tried to open the phpmyadmin panel, then i get this:

    * @copyright Copyright (c) 2008, Piotr Przybylski * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0 * @version $Id$ */ /** * Core libraries. */ require './lib/common.inc.php'; $page = filter_input(INPUT_GET, 'page'); $page = preg_replace('/[^a-z]/', '', $page); if ($page === '') { $page = 'index'; } if (!file_exists("./setup/frames/$page.inc.php")) { // it will happen only when enterung URL by hand, we don't care for these cases die('Wrong GET file attribute value'); } // send no-cache headers require './libraries/header_http.inc.php'; ?>
    phpMyAdmin get('PMA_VERSION'); ?> setup
    viaGP
  • Well I reinstalled phpmyadmin and how it "works" but I get a 403: Forbidden error. I followed your instructions to the letter so I don't know what my permissions issue is...
    viaGP
  • Alright, I fixed it by doing this:
    http://corpocrat.com/2008/09/28/how-to-fix-phpmyadmin-403-forbidden-error/
    viaGP
  • Great fix, thanks for sharing!
    viaCaleb
  • Thanks for the awesome post Caleb, worked right off the bat for me issue free :D
    viaMichael Raffaele
  • Fantastic article, the only one i've found to work so far. one hiccup though. When i turn permalinks on i'm given a 404 error page not found. I've been searching and searching for answers and have tried changing the .htaccess file ect but still can't figure it out. Any advice?
    viaNic Granleese
  • ok figured it out. The Apache file httpd.conf had to be edited. On my server it is located here /etc/httpd/conf. I followed the these instructions http://codex.wordpress.org/Using_Permalinks#Fixing_.htaccess_Generation_Issues on the topic of AllowOverride Not Enabled. Remember to restart apache for this change to take affect. (service httpd restart)
    viaNic Granleese
  • [...] WordPress on Linux in the Amazon Cloud with Mac [...]
  • [...] WordPress on Linux in the Amazon Cloud with Mac [...]
  • Thanks for this wonderful article to install phpMyAdmin and wordpress together on ec2 with every detail. I could do it.
    viaChief Editor
  • This is AWESOME. OMG I spent 8 hours doing this, and I could have done it in less than an hour if I would have seen this AWESOME article! Thanks a lot!
    viaCorbin
  • Nice work!

    I believe your procedure can be simplified a bit by installing wordpress before adding phpMyAdmin. You might want to add the command: mysql_secure_installation to lock down the database. I've also heard it is a good idea to remove the Admin user --- after first giving admin privileges to another account.

    The steps for adding phpMyAdmin were very helpful for me.
    Thank you!
    viaGary L
  • It's remarkable to go to see this site and reading the views of all mates on the topic of this article, while I am also keen of getting know-how.
    viacpanel web hosting
  • [...] http://calebogden.com/wordpress-on-linux-in-the-amazon-cloud-with-mac/   0 Kudos /* [...]
  • Hi Mark, you shouldn't need to use SFTP with this approach (SSH should work just fine), but in case you still need it, simply install it from yum:

    sudo yum install vsftpd -y
    viacaleb
  • You saved my life. Great post!
    viatienpham
  • This was excellent. I knew nothing about command line before I started and I've got an EC2 website up now. Very much appreciate, I would be happy to donate something for your time.

    -Andrew
    viaAndrew
  • Dear Caleb,
    Wonderful guide! I know you have answered a bunch of questions, but Would you mind answering one more question?
    I get as far as:

    adduser phpmyadmin passwd phpmyadmin

    After you set a password, find the user group (should be apache) with this command:

    egrep 'User|Group' /etc/httpd/conf/httpd.conf


    For the adduser phpmyadminpasswd phpmyadmin I get permission denied

    And for the egrep 'User|Group' /etc/httpd/conf/httpd.conf
    I get this:
    ser/Group: The name (or #number) of the user/group to run httpd as.
    # . On SCO (ODT 3) use "User nouser" and "Group nogroup".
    # NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
    # when the value of (unsigned)Group is above 60000;
    # don't use Group #-1 on these systems!
    User apache
    Group apache
    # UserDir: The name of the directory that is appended onto a user's home
    # UserDir is disabled by default since it can confirm the presence
    UserDir disabled
    # directory, remove the "UserDir disabled" line above, and uncomment
    #UserDir public_html
    # Control access to UserDir directories. The following is an example
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined


    Please help? :)
    viaAli from Dubai
  • Hi, I got this warning -

    Please create web server writable folder config in phpMyAdmin top level directory as described in documentation. Otherwise you will be only able to download or display it.
    viaCampus Nigeria
  • Everything was going well until I got to the host SSH. I keep receiving this error.

    ssh: Could not resolve hostname carllanders: nodename nor servname provided, or not known

    I have verified that the preceding steps were followed correctly, but otherwise no luck. Help would be appreciated.
    viaD Gray
  • I very, very rarely comment on blogs. But I must say, thank you SO much for putting this together. This whole process was looking extremely intimidating and you made it fairly simple.

    Although, I had a lot of trouble getting inside of phpmyadmin. I was totally confused with the user settings, auth settings, and what info to use to actually log in. It didn't help that I was using the newest version of PHP either.

    However, I didn't realize that the SUPERSECUREPASSWORD we created earlier was the login info for phpmyadmin using HTTP or Cookie authorization. I was trying to use the user and password I was making in the config.inc.php file. Other than that, everything was super simple. Thanks again.
    viaRyan
  • I am getting the same message as Campus Nigeria above. (p.s. that name has spammer written all over it, but that's the exact message I get, so...

    I ran into snags on the giving user permissions to access the phpMyAdmin folder, and so I imagine that's what it is. has something changed in the newer version of mysql that is messing with this stuff?

    Thanks so much for a great tutorial, I too would love to donate a little coin for your time. you need a paypal button on this post.
    viaBen
  • Awesome tutorial, and very inspirational, thank you very much!
    viaRamon
  • Hi,

    This tutorial looks extremely useful, thanks you for posting this !

    I'm considering moving from a cheapo vps to ec2, seems like a no brainer for both cost and performance reasons..

    The only thing that concerns me is on various sites I've seen comments such as " you shut down the instance (or it crashes), your data is gone." Is this still correct ? What are the related costs to make the data persistent ?

    Thanks,
    sTu
    viasTu

Leave a comment

  • You may use these HTML tags and attributes
    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>