Setting up Magento on Rackspace CouldServer
Posted on December 16th, 2010 in Magento, Ubuntu, Web Development | No Comments »
Objective: Prep a test server for a Magento installation on Ubuntu 10.10
In this example I spun up a quick server on Rackspace that has the bare minimums of Ubuntu installed. So everything needs to get installed. Before getting started, take a look at the server requirements to run Magento and run the magento check utility before attempting to install magento to make sure all required components are installed.
Step 1: Update apt-get
sudo apt-get update
Step 2: Install updatedb. Not necessary, just like having it around.
sudo apt-get install locate
Step 3: Install PHP 5
sudo apt-get install php5
Step 4: Install Apache 2.2
sudo apt-get install apache2
Step 5: Enable Apache Mod Rewrite and restart Apache
sudo a2enmod rewrite sudo /etc/init.d/apache2 restart
Step 6: Install MySQL 5
sudo apt-get install mysql-server
Step 7: Install required PHP extensions and restart Apache
sudo apt-get install php5-mysql php5-mcrypt php5-gd php5-curl php-pear php5-dev libmysqlclient-dev libcurl3-openssl-dev sudo /etc/init.d/apache2 restart
Step 8: Setup a virtualhost for the new test site Further Reading
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/techandhouse_dev
sudo vi /etc/apache2/sites-available/techandhouse_dev
#Change the DocumentRoot to point to the new location. Example: /home/user/techecom_dev/
#Change the Directory directive, replace: <Directory /var/www/> to <Directory /home/user/techecom_dev/>
Sample config:
<!--Change AllowOverride to All for our site for mod rewrite to work--> <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName techandhouse_dev DocumentRoot /home/techecom_dev/public_html/ <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /home/techecom_dev/public_html/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> 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/" <Directory "/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 </Directory> </VirtualHost>
Deactivate the old site, activate the new one, and restart Apache.
sudo a2dissite default && sudo a2ensite techandhouse_dev sudo /etc/init.d/apache2 restart
If you run the magento check utility and go to the IP address or domain of your machine, you should see:
Follow instructions here to move the web site to the test server…
After moving the web site, update a couple values so that the site doesn’t route itself back to the real domain because of the database or cached files:
update core_config_data set value="http://DOMAIN/" where path=’web/unsecure/host’; update core_config_data set value="http://DOMAIN/" where path=’web/secure/host’;
cd /path/to/your/magento/site rm -r var/cache/* var/session/*
