Linux

Configuring a new Debian Rackspace Cloud Server for Drupal

I had to set up a new Rackspace Cloud Debian Linux server today for a rather large Drupal project. Since this is the second Rackspace server I have set up for Drupal in the past couple months, I thought it might be handy to take notes on every command I ran so that this is easier next time, or for someone else.

The first step is to set up your server instance, which is done through their web interface. It is as easy as clicking a button to add a server instance , select the OS type (Debian, of course), and choose the amount of Ram and a name.

Once the server instance is set up, you can log in via SSH. I recommend using a terminal as their web command line is clunky. Everything following this sentence are commands I ran through the command line via ssh.

Adding a non-root user with root privileges (sudo)

  • useradd username
  • passwd username secretPassword
  • mkdir /home/username
  • chown username /home/username
  • vim /etc/sudoers

Add the line: username ALL=(ALL) ALL

The majority of the work I did from this point was guided by these phenominal instructions. Feel free to follow along there, as they much more detailed, but the instructions below are Rackspace specific and a little more current.

Installing the webserver software to run Drupal (Apache2, PHP5)

  • sudo apt-get update
  • sudo apt-get install apache2 php5 libapache2-mod-php5

Test the install of Apache in a browser: http://ipaddress. If everything worked out, you will see a white screen saying It Works.

Once Apache is working you can test PHP. First setp is to create a php file:

  • vim /var/www/test.php

Enter the following text: <?php phpinfo(); ?> and save the file.

Next, open your web browser and navigate to: http://ipaddress/test.php. For some reason, my browser asked me to save the php file instead of executing it. I wasn't sure why this was so I tried restarting apache:

  • sudo /etc/init.d/apache2 restart

and refreshed my browser. It worked.

Installing the database software to run Drupal (MySQL5)

  • sudo apt-get install mysql-server mysql-client php5-mysql

I was prompted for a password through a fancy schmancy command line GUI, so I assigned one and copied it some place safe.

Installing PhpMyAdmin to manage MySQL

This step is entirely optional, as the MySQL client is already installed.

  • sudo apt-get install phpmyadmin

During the install, I was given a chance to specify that the setup should use apache2. Last time I did this I had to edit a config file and restart apahce. PhpMyAdmin should now be available at:

http://ipaddress/phpmyadmin

Congratulations; your server should now be set up to host a single Drupal install at /var/www/.

...

Unless your SQL dump is too large, and mine was. I edited the php.ini file (at /etc/php5/apache2/php.in), by modifying the memory_limit, upload_max_filesize, and post_max_size variables. Don't forget to restart the server: /etc/init.d/apache2 restart.

...

I keep thinking this post is done, but I wasn't able to import my sql dump through PhpMyAdmin at all. Just too big, I s'pose. So I scp'd the file over and ran this command:

mysql databasename -u username --password=secretPass < sql_dump.sql

Powered by Drupal, an open source content management system