VPS! Getting Drupal up and running on a linode (revisited)

I can hardly believe it, but it's been almost three years since I wrote the original VPS! Getting Drupal up and running on a linode article. These days, I'm still with http://linode.com, where a lot of my clients end up hosting their web app sites; and I'm still installing everything by hand, which is still the best way in all but a few cases, since it gives me what I came to a VPS for in the first place: control over what's going on, and avoiding locking myself into immediately obsolete schemes unless I choose to do so. Of course, there are some excellent install scripts, which Linode calls Stack Scripts, with many of them dedicated to getting Drupal up and running in a variety of excellent manners, even including Pantheon Mercury and Aegir turnkey "single click" scripts. Certainly a great way to go in certain alternatives.

I can hardly believe it, but it’s been almost three years since I wrote the original VPS! Getting Drupal up and running on a linode article. These days, I’m still with http://linode.com, where a lot of my clients end up hosting their web app sites; and I’m still installing everything by hand, which is still the best way in all but a few cases, since it gives me what I came to a VPS for in the first place: control over what’s going on, and avoiding locking myself into immediately obsolete schemes unless I choose to do so. Of course, there are some excellent install scripts, which Linode calls Stack Scripts, with many of them dedicated to getting Drupal up and running in a variety of excellent manners, even including Pantheon Mercury and Aegir turnkey “single click” scripts. Certainly a great way to go in certain alternatives. But if you still wish to control everything yourself and run a tight ship, however, this article is for you.

For Ubuntu, stick with 9.10

This is to make sure you get a nice 5.2.x Php for your Drupal 6 web app. This is what you want to see:

 

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.10
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu 9.10"

 

Set hostname

/bin/hostname example.com
echo example.com > /etc/hostname

and reboot (by clicking Reboot where the Boot button had originally been on the dashboard); took about one minute. And I logged in through ssh again, and did:
uname -a
  
and there I was: example.com

Bring site up-to-date and include universe sources

# cat /etc/apt/sources.list
 
## main & restricted repositories
deb http://us.archive.ubuntu.com/ubuntu/ karmic main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic main restricted

deb http://security.ubuntu.com/ubuntu karmic-updates main restricted
deb-src http://security.ubuntu.com/ubuntu karmic-updates main restricted

deb http://security.ubuntu.com/ubuntu karmic-security main restricted
deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted

## universe repositories – uncomment to enable
deb http://us.archive.ubuntu.com/ubuntu/ karmic universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic universe

deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe

deb http://security.ubuntu.com/ubuntu karmic-security universe
deb-src http://security.ubuntu.com/ubuntu karmic-security universe

# apt-get update
# apt-get upgrade

Change default shell to bash

# ls -lia /bin/sh
5445 lrwxrwxrwx 1 root root 4 2010-04-29 17:43 /bin/sh -> dash
# rm -f /bin/sh
# ln -s /bin/bash /bin/sh
# ls -lia /bin/sh
378 lrwxrwxrwx 1 root root 9 2010-07-07 17:25 /bin/sh -> /bin/bash

Install smtp server

When prompted, choose “internet site”
# apt-get install postfix

Install MySql

# apt-get install mysql-server mysql-client libmysqlclient15-dev
root password: **********

Install Apache

# apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2-suexec libexpat1 ssl-cert
 

Install Imagemagick

#apt-get install imagemagick

Install Php

# apt-get install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Increase memory for php

# grep memory_limit /etc/php5/apache2/php.ini
memory_limit = 128M
root@li106-xx:~#

Some Apache configuration

# grep ServerName *
apache2.conf:ServerName example.com
fragment of /etc/apache2/sites-enabled/000-default:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
 
Enable Apache’s mod_rewrite
# a2enmod rewrite
 
# apache2ctl restart

Test info.php

http://li106-xx.members.linode.com/info.php
# cat /var/www/info.php
<?php phpinfo(); ?>

Install phpmyadmin

apt-get install phpmyadmin

Add app user if desired

# adduser myapp

Install drush

# cd /usr/local/sbin
# wget http://ftp.drupal.org/files/projects/drush-6.x-3.3.tar.gz 
# tar xvzf ~/download/drush-6.x-3.1.tar.gz
# cd drush
# ./drush

–note: if you are seeing PHP Deprecated: Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/idn.ini on line 1 in Unknown on line 0
GO WITH KARMIC! (see above)
 
# grep drush /etc/bash.bashrc

alias drush=’/usr/local/sbin/drush/drush’

Note: in order to dispense with the alias you can link the drush executable so:

 # ls -l drush
lrwxrwxrwx 1 root staff 27 2010-07-10 17:23 drush -> /usr/local/sbin/drush/drush

Install git

# sudo apt-get install tcl8.4 tk8.4
# sudo apt-get build-dep git-core
 # wget http://kernel.org/pub/software/scm/git/git-1.7.2.3.tar.gz
Unpack 
cd into dir
tar -zxvf git-1.7.2.3.tar.gz
cd git-1.7.2.3
./configure
make
sudo make install

Mail accounts with Postfix and Dovecot and MySql

http://library.linode.com/email/postfix/postfix-dovecot-mysql-ubuntu-9.10-karmic

Reference

Ref: http://howtoforge.net/perfect-server-ubuntu-10.04-lucid-lynx-ispconfig-2

 

Click here to sign up using my referral code. Thanks!