Installing on a Slicehost virtual server

From Cerberus Helpdesk Wiki

Jump to: navigation, search

This article assumes that:

  • You're installing on an Ubuntu 8.10 virtual dedicated server from Slicehost.
  • You are able to set up a DNS record to point to this new server instance.
  • You have an existing mail server for outgoing (SMTP) and incoming (POP3/IMAP) mail. If not, you can use Gmail.

Conventions:

  • When you see helpdesk.example.com, replace it with your own domain name.
  • Commands you type into the console will be prefixed with shell>


Contents

Introduction

At WebGroup Media we run a mix of physical and virtual servers from a variety of providers. We manage physical hardware for our Cerb4 On-Demand service and it's cost effective because of volume (spreading the cost over many customers sharing resources).

Occasionally we have customers whose requirements put them in a space between our On-Demand service (fully managed by us) and a dedicated server (fully managed by them). They're looking for something where they don't need to hassle with or invest in hardware, but still have enough access to a server to log in through the console, modify code, save and copy backups, connect to the database, and install tools. SliceHost fills this space perfectly by providing inexpensive virtual servers.

The advantage of a cheap virtual server is you can run an application with special installation requirements (such as PHP5/MySQL5) that are different than your existing infrastructure. It's also useful to allow a single application to live outside an intranet firewall. Each app can have its preferred environment and be self-contained.

The reasons SliceHost is great for Cerb4 hosting:

  • Inexpensive for low resource requirements
  • Full admin control of server
  • Web-based control panel
  • Choice of Linux-based distros
  • Near-instant setup
  • Dedicated IP and reverse-DNS
  • Automated backups
  • No hardware headaches
  • Easily upgrade server resources without moving

At the time of writing, the most cost-effective SliceHost plans are:

  • $20/mo: 256MB RAM, 10GB storage, 100GB bandwidth
  • $38/mo: 512MB RAM, 20GB storage, 200GB bandwidth
  • $70/mo: 1GB RAM, 40GB storage, 400GB bandwidth

After the $70/mo point, we feel you'll get more resources for your money using a different solution like Amazon EC2 or a dedicated server.

If you decide to sign up at SliceHost you can use this link and the Cerb4 project will get a couple bucks of account credit.

Setting up the new server

  • Create a new slice using Ubuntu 8.10
    Setting up a new slice
    Setting up a new slice
    Note: You should use a different machine name for your slice than the domain name you plan to use for your helpdesk, otherwise Apache will have trouble with the virtual host. You *can* use the same name but you'll need to edit Apache's /etc/apache2/apache2.conf file and set ServerName 127.0.0.1
  • You'll be given a new root password.
    Your new root password
    Your new root password
  • Once your instance is created (usually about 1-2 minutes), log in as root using SSH and the new password given.
    Logging in through SSH
    Logging in through SSH

Update the package manager's cache:

shell> apt-get update

Install Apache2, PHP5, MySQL5, and a few other tools:

shell> apt-get install apache2 php5 php5-dev php5-imap php5-mysql php5-gd \
   php5-curl php-pear mysql-server subversion make

(you'll be prompted for a MySQL root password. Choose something you'll remember)

DNS

You'll need to create an "A" record in your DNS to point your preferred domain name to the IP of your slice. Instructions for this vary depending on your environment, and if you aren't your system administrator your best bet is to ask them for help with this step.

Getting the Cerb4 files

Create a directory that will store the Cerb4 project files:

shell> mkdir -p /home/vhosts/helpdesk.example.com/httpdocs

Enter the new directory:

shell> cd /home/vhosts/helpdesk.example.com/httpdocs

Checkout the latest stable Cerb4 branch as the 'admin' directory using Subversion:

shell> svn co "http://svn.webgroupmedia.com/cerb4/branches/stable" admin

Set permissions:

shell> chown -R www-data:www-data *

Make sure all directories are visible:

shell> find * -type d -exec chmod 755 {} \;

Enabling friendly URLs

Let's enable Apache2's mod_rewrite for friendlier URLs (/tickets/search vs. /index.php/tickets/search).

Change into the directory with Cerb4's project files:

shell> cd /home/vhosts/helpdesk.example.com/httpdocs/admin

Enable mod_rewrite in Apache2:

shell> a2enmod rewrite

Copy the .htaccess-dist template to .htaccess to enable it:

shell> cp .htaccess-dist .htaccess

Building MailParse

Cerb4 uses the MailParse PHP extension to parse e-mail efficiently. We'll need to build it since it's not part of the default PHP installation or in Ubuntu's package repository.

Install the mailparse extension using PHP's PECL tool:

shell> pecl install mailparse

Create the mailparse.ini configuration file for PHP5:

shell> vi /etc/php5/apache2/conf.d/mailparse.ini

mailparse.ini:

# configuration for php mailparse module
extension=mailparse.so

Creating the virtual host in Apache

Note: Remember to replace helpdesk.example.com with your own domain name.

Create the virtual host in Apache2:

shell> vi /etc/apache2/sites-available/helpdesk.example.com

helpdesk.example.com:

<VirtualHost *:80>
 ServerAdmin you@example.com
 ServerName helpdesk.example.com
 
 DocumentRoot /home/vhosts/helpdesk.example.com/httpdocs
 <Directory /home/vhosts/helpdesk.example.com/httpdocs>
  Options -Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all
 </Directory>
 
 ErrorLog /var/log/apache2/error.log
 
 # Possible values include: debug, info, notice, warn, error, crit,
 # alert, emerg.
 LogLevel warn
 
 CustomLog /var/log/apache2/access.log combined
</VirtualHost>

Configuring PHP

We need a little more memory than PHP gives us by default. We also want to explicitly define our temporary directory for file uploads.

shell> vi /etc/php5/apache2/php.ini

Find the following lines and update their values.

php.ini:

memory_limit = 32M
upload_tmp_dir = /tmp

Activate the new website

shell> a2ensite helpdesk.example.com

shell> /etc/init.d/apache2 restart

Create the MySQL database

shell> mysql -u root -p

mysql> CREATE DATABASE cerb4 CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> GRANT ALL PRIVILEGES ON cerb4.* TO cerb4@localhost IDENTIFIED BY 's3cr3t';
mysql> QUIT;

Installing Cerb4

Now we're going to run the Cerb4 installer. If you don't have an existing SMTP/POP3 server, you can configure Gmail to work with Cerb4.

  • Open http://helpdesk.example.com/admin in your browser.
  • Verify everything is green in the Server Environment Tester.
  • If successful, click the "Next Step" button.
  • Read and accept the license.
The Cerb4 Installer
The Cerb4 Installer

Database Setup

(enter the same information you used when creating the database)

  • Driver: MySQL 3.23/4.x/5.x
  • Host: localhost
  • Database Name: cerb4
  • Username: cerb4
  • Password: s3cr3t

Click the Continue button.

Settings

  • Choose Mail addresses

Outgoing Mail

  • SMTP Server: (enter your details)

Your Account

  • Enter your personal e-mail address (not the helpdesk's!) and choose a password.

Registration

  • Fill out the quick survey for a free 3 worker license.

Cleaning up

Enter the Cerb4 project directory:

shell> cd /home/vhosts/helpdesk.example.com/httpdocs/admin

Remove the installation directory for security purposes:

shell> rm -Rf install/

Setting up your scheduled tasks timer

  • Test at the console first:

shell> curl --interface lo "http://helpdesk.example.com/admin/cron?ignore_wait=1&loglevel=6"

If that works, then continue:

shell> adduser cerb4

(pick a hard to guess password)

shell> crontab -e -u cerb4

crontab:

*/5 * * * * /usr/bin/curl --interface lo "http://helpdesk.example.com/admin/cron"

Performance Tuning

Out of the box Cerb4 is pretty fast, but we can make it even faster. For more information on Memcached and APC, read the article on Performance.

Memcached

Memcached provides a shared memory cache where arbitrary information can be read frequently without incurring the overhead of a database.

Install the memcached daemon and the PHP5 client library:

shell> apt-get install memcached php5-memcache

Edit the configuration file:

shell> vi /etc/memcached.conf

memcached.conf:

Find the "-m" line and reduce the shared memory to 2MB. That should be plenty for the cache of a single helpdesk on our virtual server.

-m 2

Start the Memcached daemon:

shell> /etc/init.d/memcached start

Edit Cerb4's framework.config.php file to take advantage of Memcached:

shell> vi /home/vhosts/helpdesk.example.com/httpdocs/admin/framework.config.php

framework.config.php:

Uncomment (remove the leading "//") the following options and set their value.

  • DEVBLOCKS_CACHE_PREFIX can be anything as long as it's unique. This helps prevent someone from guessing your cache keys.
  • DEVBLOCKS_MEMCACHED_SERVERS can be left as its defaults.

define('DEVBLOCKS_CACHE_PREFIX','_something_unique_'); // ONLY A-Z, a-z, 0-9 and underscore
define('DEVBLOCKS_MEMCACHED_SERVERS','127.0.0.1:11211');

APC

The Alternative PHP Cache (APC) is an extension for PHP which caches the most frequently-accessed scripts in their machine-friendly opcode format. Typically, APC is a moderate, turnkey performance-boost that doesn't require any application-level changes to benefit from the cache.

Install the Apache2 development package so APC can compile against it:

shell> apt-get install apache2-dev

Install the APC extension using PHP's PECL tool:

shell> pecl install apc

Accept the defaults for apxs when prompted.

Create the extension configuration file for APC:

shell> vi /etc/php5/apache2/conf.d/apc.ini

apc.ini:

extension=apc.so

Restart Apache2:

shell> /etc/init.d/apache2 restart
With memcached and APC your helpdesk should be running faster and consuming far less memory per page.
With memcached and APC your helpdesk should be running faster and consuming far less memory per page.

Log in for the first time

Installing the Support Center

The Support Center allows your community to use their web browser to:

  • Open new tickets and review their history
  • Browser your knowledgebase
  • Update their contact information

Creating a Support Center in Cerb4

  • Log in to your helpdesk as an administrator
  • Click "helpdesk setup" in the top right
  • Click the "Features & Plugins" tab and make sure the following plugins are enabled:
    • Cerberus Helpdesk: Community Tools
  • Click the "Community Tools" tab
  • Under "Add Community":
    • Community Name: Website
    • Add New Community Tool: Support Center
  • Click "Save Changes"
    Creating a new Support Center community tool
    Creating a new Support Center community tool
  • Click the new "Support Center" link in the left column
    Configuring your new Support Center
    Configuring your new Support Center

You can customize your new Support Center to your heart's desire later. For now, let's add an example contact situation.

  • Scroll down to the "Add a Contact Situation" box under the "Open Ticket" heading.
  • Enter the following text:
    Add a contact situation to make ticket creation easier for your visitors
    Add a contact situation to make ticket creation easier for your visitors
  • Click "Save Changes"

Deploying the Support Center

  • From the Support Center you just created above, scroll to the bottom until you see the "Installation" section

For demonstration purposes we're going to deploy your new Support Center on the same domain as your helpdesk, but you could deploy it on *any* domain on *any* server that supports PHP4 or PHP5.

  • Copy the index.php content from the first textbox and paste it into the file /home/vhosts/helpdesk.example.com/httpdocs/index.php
  • Copy the .htaccess content from the second textbox and paste it into the file /home/vhosts/helpdesk.example.com/httpdocs/.htaccess

You're open for business!

  • Open your browser to: http://helpdesk.example.com/
    Your new Support Center!
    Your new Support Center!
Personal tools