wordpress on amazon ec2 in 5 minutes

Setup an EC2 instance

  1. sign up for amazon ec2 – http://aws.amazon.com/ec2/
  2. go to AWS management console https://console.aws.amazon.com/console/home

  1. Choose EC2 from AWS management console
  2. Click on Launch Instance
  3. Choose Classic Wizard and hit Continue
  4. Select Amazon Linux AMI (there are several other options)
  5. Choose Micro (t1 micro, 163 MiB) which is the free tier EC2
  6. Make sure you enter a short description for “User Data”
  7. Review the details on the next page and hit Continue
  8. Make sure you enter something for the Tag
  9. Create a new key pair for authentication
  10. create a new security group and make sure general ports such as 22(SSH), 80(HTTP), 443(HTTPS) and 8080(TOMCAT) are open
  11. hit “Launch” and you’re done with setting up an EC2 instance
  12. Create an Elastic IP (EIP) – select EIP used in “EC2″
  13. Associate the EIP to the EC2 instance that you just launched
  14. connect to the instance as “ec2-user” There are couple ways to do sofrom management console, simply right click on the instance and choose “connect”
    • or you can simply use SSH client like putty. Make sure you convert PEM file to PPK which is supported by putty
  15. install packages you need with yum 
    • # yum install httpd
    • # yum install php
    • # yum install php-mysql
    • # yum install php-gd (php GD graphic library)
    • # yum install mysql-server
  16. Start services
    • # service httpd start
    • # service mysqld start
  17. Download and extract wordpress
    • # cd /var/www/
    • # wget http://wordpress.org/latest.tar.gz
    • # tar -xvzf latest.tar.gz
    • # rm -rf html
    • # mv wordpress html
    • # chown -R apache:root html
  18. Create mysql database
    • # mysqladmin -uroot create blog
    • # mysql_secure_installation
      • Set root password? [Y/n] y
      • Remove anonymous users? [Y/n] y
      • Disallow root login remotely? [Y/n] n
      • Remove test database and access to it? [Y/n] y
      • Reload privilege tables now? [Y/n] y
  19. Configure wordpress
    • # cd /var/www/html
    • # mv wp-config-sample.php wp-config.php
    • # vi wp-config.php
      • define(‘DB_NAME’, ‘blog’);
        define(‘DB_USER’, ‘root’);
        define(‘DB_PASSWORD’, ‘YOUPASSWORD‘);
        define(‘DB_HOST’, ‘localhost’);
  20. Install wordpress from browser http://YOUR_ELASTIC_IP (which will be redirected to http://YOUR_ELASTIC_IP/wp-admin/install.php
  21. To enable permlinks, be sure to modify /etc/httpd/conf/httpd.conf and enable override option:
    •     AllowOverride All
    • sample .htaccess for wordpress:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
  1. Optional step: Point your domain name to the EC2. For example I am a godaddy subscriber. what I need to do is simply pointing “A” record to the elastic IP

  1. ALL SET!!
  2. 中文化
  • 通過 FTP、SSH 等方式打开并编辑站点根目录下的 wp-config.php
  • 查找 define('WPLANG', ''); 一行,在第二个参数处填入 zh_TW,变成 define('WPLANG', 'zh_TW'); 并保存文件
  • 进入站点控制板(dashboard),看到更新提示后进行升级即可。WordPress 会自动从官方网站下载中文语言包并安装
  • 多語言版下載 http://codex.wordpress.org/WordPress_in_Your_Language

Well you didn't break it. I did :-)