Skip to content

Installing a debian Morzo server from scratch

tdammers edited this page Feb 17, 2013 · 10 revisions

Step 1: Install debian

  • Download the debian stable i386 netinst iso. Suitable jigdo, bittorrent and http download links can be found at http://www.debian.org/CD/.
  • Boot from the netinst iso and install a minimal core system: check only the "SSH Server" and "Basic System Utilities" presets. We'll install all the dependencies in the next step.
  • Set up ssh and networking to your preferences. I like to give my virtual servers two network interfaces: NAT on eth0 (to be used to access the internet from the virtual machine, for things like API calls and apt), and host-only on eth1 (to be used to ssh into the machine and serve web pages). This way, the VM can make outbound connections as needed, but will be naturally firewalled off of the real world for incoming connections.
  • Install your favorite text editor. I use vim.

You should now be able to boot the server, ssh into it, and become root in order to install things.

Step 2: Install required packages

We'll need to install a whole bunch of packages, so let's get started:

$ sudo aptitude install apache2 php5 php5-cli libapache2-mod-php5 \
php5-xdebug \
php5-adodb libphp-adodb \
php5-mysql mysql-client mysql-server \
memcached php5-memcache ntp \
php5-gmp

Aptitude tells me there's one conflict; the first resolution it offers should work fine.

Step 3: Pull in the code.

There are two ways you can do this: either install git inside the VM and use that, or set up a shared directory between the VM and the host machine. I opted for the latter, mounting a directory on the VM into a sshfs mount on the host. The procedure is something like this:

tobias@host$ mkdir morzo
tobias@host$ ssh morzovm
tobias@morzovm$ mkdir morzo
tobias@morzovm$ exit
tobias@host$ sshfs tobias@morzovm:morzo morzo
tobias@host$ cd morzo
tobias@host$ git clone ssh://[email protected]/trezker/morzo .
...
tobias@host$ ssh morzovm
tobias@morzovm$ cd morzo
tobias@morzovm$ ls
blocked.php                database_structure.sql  models          sql_backup.sh
config.rep.php             docroot                 README          sync.sh
controllers                libraries               run_update.php  util
database_initial_data.sql  logs                    run_update.sh   views

Step 4: Download php-openid

  • $ git clone https://github.com/openid/php-openid.git php-openid
  • cp -R php-openid/Auth Auth

Step 5: Configure Apache

  • Become root (sudo -i or su -).
  • $ cd /etc/apache2/sites-available
  • $ cp /home/yourname/morzo/apache-config morzo
  • Now edit morzo to point the document root to the docroot directory inside the morzo project directory; in my case, this is /home/tobias/morzo/docroot.
  • $ a2ensite morzo
  • $ a2dissite default
  • $ a2enmod rewrite
  • $ service apache restart
  • Now visit your VM in a browser. If you get a white page, check the apache error log (/var/log/apache2/error.log).
Clone this wiki locally