Linux, Programming, Scripting, Web development

HOWTO: set up a cloud server with WordPress at Rackspace

You’re probably here because you are finally at the point where you need root access to your web server so that you can install applications like MediaWiki or WordPress or Joomla or any other CMS. If you have a website that you want to move away from a hosted environment, this is how to set yourself up so that you control every aspect of your site.

    1. Create an account at Rackspace.com. Go to Cloud Servers and create a new server. If you need help with this, though it’s very self-explanatory and easy on their site, you can always chat with their 24-7 online chat support. Note the administrative password and the IP address of the server you have created.
    2. Open a bash terminal and SSH into your shiny new server. “ssh root@YOURSERVERSIPADDRESS”. Enter the password.
    3. Create a user for yourself. “useradd -m -s /bin/bash yourname” and create a password for yourself  “passwd yourname”.
    4. Enter “su
      yourname”. Now, you are logged in under your name and not as root.
    5. Enter the following:
      sudo apt-get update
      sudo apt-get upgrade
      sudo apt-get install tasksel
      sudo tasksel install lamp-server
      sudo apt-get install php-mail python-software-properties unzip
      sudo a2enmod rewrite
      sudo apt-get autoclean
      sudo apt-get autoremove
      mkdir /home/yourname/yourwebsitename
      mkdir /home/yourname/yourwebsitename/blog
      cd /home/yourname/yourwebsitename/blogsudo
      wget http://wordpress.org/latest.tar.gz
      sudo tar -zxvf latest.tar.gz .
    6. That has cleaned up your server and installed a web server as well as WordPress. Enter passwords for your MySQL database and record them.
    7. “sudo service apache2 restart” #You will get an error that local server has not been set up.
      echo “ServerName localhost” | sudo tee /etc/apache2/conf.d/$servername
      sudo service apache2 restart #Should be no error now
    8. r

    9. cd /etc/apache2/sites-available/
      sudo nano yourwebsitename
    10. Copy this with CTRL+SHIFT+V into the terminal:
    11. ServerAdmin webmaster@localhost
      ServerName www.yourwebsitename.com
      ServerAlias yourwebsitename.com *.yourwebsitename.com
      DocumentRoot /home/yourname/yourwebsitename/
      php_value upload_max_filesize 1M

      Options +FollowSymLinks
      AllowOverride All
      Order allow,deny
      allow from all

      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all

      ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

      AllowOverride None
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
      Order allow,deny
      Allow from all

      ErrorLog ${APACHE_LOG_DIR}/error.log

      # Possible values include: debug, info, notice, warn, error, crit,
      # alert, emerg.
      LogLevel warn

      CustomLog ${APACHE_LOG_DIR}/access.log combined

      Alias /doc/ “/usr/share/doc/”

      Options Indexes
      MultiViews FollowSymLinks
      AllowOverride None
      Order deny,allow
      Deny from all
      Allow from 127.0.0.0/255.0.0.0 ::1/128

       

       

    12. CTRL+X and save the file as yourwebsitename.com.
    13. cd /etc/apache2/sites-enabled/

sudo ln -s /etc/apache2/sites-available/yourwebsitename.com /etc/apache2/sites-enabled/yourwebsitename.com
sudo service apache2 restart

    1. Where have you created your domain name account? If it’s with GoDaddy, login to your GoDaddy account and click on Domain Manager. Click on the website name and enter the dashboard (or follow whatever practice your domain registrar uses to get to where you can edit the zone file). Click on “Edit Zone File”.
    2. Replace the IP address in the zone file with the IP address of your cloud server. Save the zone file.
    3. “nano /home/yourname/yourwebsitename/index.php” and copy this into the file.

/**
*
Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*//**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require(‘./blog/wp-blog-header.php’);
?>;

  • In a few minutes, you should be able to enter your URL into any browser, and see the WordPress installation page. Install using the database name and password you’ve created in PHPMyAdmin or in command line for MySQL.
  • I recommend Elegant Themes to get a beautiful and professional look for your site instantly.

 

9 thoughts on “HOWTO: set up a cloud server with WordPress at Rackspace

    1. Ok, your problem is that your user doesn’t have the ability to use the ‘sudo’ command. ‘Sudo’ is a command that gives you temporary root access. Do you have a way to get root access? Try typing in ‘su’ and use the root password. If you don’t have the root password, then this will be more complicated. If you do, use this command: “adduser username admin” where ‘username’ is your username. If you don’t, let me know.

  1. So I've got a client who is using RackSpace Cloud and has 1 site running on Ubuntu, we're porting an existing WP install but we're doing some work on it first to change the GUI. Hence I need to set up a dev site on this server and while I can mkdir I'm not a Linux expert and I don't know how to get to the directory that I've created without changing the DNS (as described above). I don't want to point to this yet, as we have a few weeks worth of stuff to do first.

    Is there an easy way to get to the installed directory via a browser and FTP client so I can start to work on the template and things? Thanks btw for the instructions they were helpful (though I too had to su to root in order to run all the commands).

  2. So I've got a client who is using RackSpace Cloud and has 1 site running on Ubuntu, we're porting an existing WP install but we're doing some work on it first to change the GUI. Hence I need to set up a dev site on this server and while I can mkdir I'm not a Linux expert and I don't know how to get to the directory that I've created without changing the DNS (as described above). I don't want to point to this yet, as we have a few weeks worth of stuff to do first.

    1. I usually use a spare domain name, set up the virtual host to point to the new development directory, and use that for dev. It's ten bucks for a new domain name and saves you a LOT of time.

    1. Ok, then even easier. The other free way to do it is create dev.yoursite.com in DNS and point to that. You don't want to get into DNS, though. If you're pro bono, you don't want to get into more complicated solutions like node creation, though. Another thought would be to create your dev site as a subfolder of your current site, and point to that in Vhosts. It would be viewable, but as long as the main site doesn't have a link to it, the consequences won't be severe. You'd still need a freebie domain name. If it's a flat site with no DB, use the Public folder of a Dropbox. The instructions are all over the web for that one.

Leave a Reply