Ubuntu 8.04 with Lighttpd Install

How To Install Wikidot On Ubuntu Server 8.04 with Lighttpd

Using This Guide

NOTE!

December 6th, 2008

As written, this guide should give you a 100% working install of Wikidot v1 Open Source rev. 317. I have tested it thoroughly on a VirtualBox virtual machine as well as on stand-alone hardware.


I can't guarantee results if you use other releases of Ubuntu/Linux. The reason I chose to use Ubuntu 8.04 versus the newer 8.10 is that it works well with the VitrualBox Linux Additions. If you're not using a VM, then this guide should work well for Ubuntu 8.10 as well as other Debian-based Linux releases.

If you do find errors or have other tips and tricks to contribute, please join my site and contribute!

-Ed

Everything in red text is what you type at the command prompt. I intentionally avoided using [[code]] tags since I have found that they are not friendly when trying to print, especially long lines of code.
Depending on your hardware and Internet connection speed, this will take some time. I would guess 2-3 hours for most if you have a reasonably fast Internet connection.

Install Ubuntu 8.04 (Hardy Heron) Server

Download: http://www.ubuntu.com/getubuntu/download
I recommend setting this up on a new PC or one with a bare hard drive. I opted for guided partitioning, using the whole hard drive.

Do a "plain installation" (no extra packages except maybe Samba if you want Windows compatible file sharing).

Pick a meaningful name for your server. This will end up being the primary name of your wikidot web site. This guide uses mywikidot for the server name. Unless you plan on going live on the Internet, I also recommend picking a name that is NOT a registered domain name.

Configure the distribution

After the basic server install is done and you have rebooted, login with the username and password you created during install.
Next, you want to operate with "root" user privileges by doing this:
sudo su -
You are prompted for your password and you will see the prompt change from "> $" to "> #".

Update the apt repositories:

apt-get update

Install the Gnome Desktop for Ubuntu

apt-get install ubuntu-desktop

Reboot

After the Ubuntu Desktop is finished installing, you need to reboot to start the GUI by entering reboot at the command prompt.

reboot


After logging in, you can then load this guide into Firefox and copy (CTRL-C)/paste (SHIFT-CTRL-V) the commands into a terminal window.

Note

You will find that there will be a number of updates that you will be prompted to install. It is probably fine to wait until later to install updates, but I preferred to do them when prompted (and a couple of them required a reboot to be applied).

Disable the Apache Service

Even though we didn't install Apache, the Ubuntu-Desktop installs a small piece of it and it will conflict with Lighttpd.

Select System » Administration » Services, click the Unlock button, enter your password, find the Web server (apache2) entry and clear the checkmark.


Start a terminal window by going to Applications » Accessories » Terminal

Tip

Right-click the terminal icon in the menu, and choose ""Add this launcher to panel" to create a terminal shortcut on the top menu bar.


Switch to the root user with:

sudo su -


enter your password and you're ready to start copying and pasting.

Install Required Packages

Tip

Highlight everything in red text, hit CTRL-C to copy, change focus to your terminal window, hit SHIFT-CTRL-V to paste the command and then hit Enter to execute the command.

A Better Tip!

An alternate method for copy/paste is to select (highlight) the text in the browser window, change focus to the terminal window and then click the middle mouse button. This will paste the text you previously selected.


apt-get install php5 php5-cli php5-cgi php-pear php5-dev php5-tidy php5-pgsql php5-gd tetex-bin tetex-extra gs-gpl imagemagick build-essential fakeroot dpkg-dev libmagic1 libmagic-dev subversion postgresql-8.3 postgresql-contrib-8.3 zip wget lighttpd lighttpd-doc memcached openssh-server pgadmin3 firestarter openjdk-6-jre sun-java6-jre sun-java6-plugin

Get libxdiff

(For highlighting history changes)
cd /usr/src
wget http://www.xmailserver.org/libxdiff-0.22.tar.gz
tar -xzf libxdiff-0.22.tar.gz
cd libxdiff-0.22
./configure
make
make install

Get PECL (PHP) extensions

Note

PECL will pause twice to ask you questions. Just press Enter to accept the default options.


pecl install FileInfo memcache xdiff

Install compiled extensions:

echo "extension=fileinfo.so" >> /etc/php5/conf.d/fileinfo.ini
echo "extension=memcache.so" >> /etc/php5/conf.d/memcache.ini
echo "extension=xdiff.so" >> /etc/php5/conf.d/xdiff.ini

Note

Memcached is optional and caching is disabled by default in Wikidot.

Reconfigure PCRE

(important for processing long pages)

mkdir /usr/src/debian
mkdir /usr/src/debian/pcre
cd /usr/src/debian/pcre
apt-get -y source libpcre3
apt-get -y build-dep libpcre3
cd pcre3-*/
sed -i 's/--enable-utf8 --enable-unicode-properties/--enable-utf8 --disable-stack-for-recursion --enable-unicode-properties/' debian/rules
fakeroot debian/rules binary
dpkg -i ../*.deb
pcretest -C | grep 'Match recursion'

The last command should say: Match recursion uses heap

Enable CGI for Lighttpd

lighty-enable-mod cgi

Get Wikidot

  • Make room for Wikidot and checkout the latest version:

mkdir /var/www/wikidot
cd /var/www/wikidot
svn checkout http://svn.wikidot.org/repos/wikidot1/trunk .

Note

To checkout a specific revision use the syntax:
svn checkout -r nnn http://svn.wikidot.org/repos/wikidot1/trunk .
and replace nnn with the revision number you want to checkout.

Configure PostgreSQL

Initialize database structure from within the postgres user:
cd /var/www/wikidot
su postgres
psql

  • within psql type:

CREATE USER wd WITH PASSWORD 'wdpass';
CREATE DATABASE wd1 OWNER wd;
\c wd1;
CREATE LANGUAGE plpgsql;
CREATE SCHEMA ts2 AUTHORIZATION wd;
\q (or <CRTL-D>) to exit psql
cat /usr/share/postgresql/8.3/contrib/tsearch2.sql | sed '1,5s/SET search_path = public/SET search_path = ts2/' | psql wd1
psql wd1 < files/dump.sql
exit (exits su postgres and returns to root user)

Preconfigure Wikidot

Edit /var/www/wikidot/conf/wikidot.ini

  • Open a terminal window.
  • sudo nautilus
  • Enter your password.
  • The Nautilus File Browser opens with root user access to files.
  • Navigate to /var/www/wikidot/conf. You will find the wikidot.ini file there. Double-click the file to open it in the gedit text editor.
  • Edit the file and save it.
  • Close the editor.
  • Minimize the file browser and terminal window that launched it (you'll need it later).

A copy of this version of wikidot.ini is attached to this page.

[main]
; the following option determines the master domain for your Wikidot installation
domain = mywikidot.com
; the name of the Wikidot service 
service = MyWikidot

[security]
; string that is used to generate unpredictable hashes for authentication
; YOU MUST CHANGE IT or otherwise, anyone can predict the authentication
; cookies and thus steal any session from your users
secret = MyWikidotRandomString
domain_upload = wikifiles.mywikidot.com

[db]
; PostgreSQL connection parameters 
host = localhost
user = wd
password = wdpass
database = wd1

[mail]
; ==================================================================
; this actually works out of the box thanks to Gabrys (aka "Quake")
; but you should put your own mail server info in here
; ==================================================================
; simple mail sending parameters
host = smtp.gmail.com
port = 465
ssl = true
auth = true
user = wikidot.quake
password = testpass

; settings  if your ISP is Comcast
;[mail]
; simple mail sending parameters
;host = smtp.comcast.net
; ssl false for comcast
;ssl = false
;user = my-email@comcast.net
;password = password-not-needed-for-comcast

[misc]
custom_domains = true

; URL of documentation site
; this is an external link to current wikisot syntax
doc_url = http://www.wikidot.com/doc:wiki-syntax

See /var/www/wikidot/conf/full-example-wikidot.ini for a complete list of all config options for wikidot.ini

Generate Wikidot's Files

cd /var/www/wikidot
php bin/configure.php
php bin/generate_om.php

Append Wikidot cronjobs to the global crontab

cat files/crontab >> /etc/crontab

Change the owner of wikidot files:

chown www-data:www-data -R .

Edit Other Config Files

Edit /etc/php5/cgi/php.ini

  • Open the File Browser you minimized earlier
  • Navigate to /etc/php5/cgi/. You will find the php.ini file there. Double-click the file to open it in the gedit text editor.
  • Edit the file and save it.
  • Close the editor.
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
memory_limit = 64M      ; Maximum amount of memory a script may consume (16MB)
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
; Maximum allowed size for uploaded files. (2M)
upload_max_filesize = 2000M

Edit /etc/lighttpd/lighttpd.conf

Set path to server and disable SSL

  • Navigate to /etc/lighttpd/. You will find the lighttpd.ini file there. Double-click the file to open it in the gedit text editor.
  • Edit the file and save it.
  • Close the editor.
  • Minimize the file browser again (you'll need it later).

A copy of this version of lighttpd.conf is attached to this page.

## a static document-root, for virtual-hosting take look at the
server.document-root        = "/var/www/wikidot/web"

# #### SSL engine
$SERVER["socket"] == ":443" {
  ssl.engine = "disable"
  ssl.pemfile = "/etc/ssl/certs/lighttpd.pem"
}

cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
cp /var/www/wikidot/files/lighttpd.conf /etc/lighttpd/lighttpd.conf
cp /var/www/wikidot/files/lighttpd-wikidot.conf /etc/lighttpd/lighttpd-wikidot.conf

Edit The HOSTS File

  • Open the File Browser window you minimized earlier

(or open a terminal window and sudo nautilus again).

  • Navigate to the /etc folder and find the hosts file.
  • Right-click and Open with "Text Editor"
  • Edit the file so it resembles below (the only lines I added are in red).
  • Substitute your server name for mywikidot.
  • Note that any new wiki sites created will have to be added manually to the hosts file (i.e newwikisite.mywikidot.com)

127.0.0.1 localhost
127.0.1.1 mywikidot
127.0.0.1 www.mywikidot.com
127.0.0.1 profiles.mywikidot.com
127.0.0.1 wikifiles.mywikidot.com
127.0.0.1 template-en.mywikidot.com
# add new template sites if desired
127.0.0.1 template-blog.mywikidot.com
# add new site names here
127.0.0.1 mytest.mywikidot.com
127.0.0.1 myblog.mywikidot.com
127.0.0.1 mysandbox.mywikidot.com

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

  • Save the file.

This will allow you to create 1 new template (template-blog) and 3 new sites: mytest.mywikidot.com, myblog.mywikidot.com and mysandbox.mywikidot.com without the need to edit the hosts file again. If you create new templates or sites, just edit the hosts file and add your new template(s) and site(s) to the list and you will be able to access them. You don't even have to restart any services or reopen your browser!

A copy of this version of hosts-mywikidot-sample is attached to this page.

Disable the Apache Web Server Service

Even though we never installed it explicitly, the Ubuntu Desktop installs it, so we have to disable it to use Lighttpd.

Click System > Admin > Services.
Click Unlock and enter your administrative password.
Scroll down to Web server (Apache2) and clear the checkmark to disable it.
Click OK

Make sure Apache is stopped

Back to the terminal window:
/etc/init.d/apache2 stop

Start/restart Lighttpd & PostgreSQL

/etc/init.d/lighttpd restart
or
/etc/init.d/lighttpd force-reload
/etc/init.d/postgresql-8.3 restart

Log in to your Wikidot

  • open a web browser and navigate to www.mywikidot.com, click login
  • use e-mail: admin@wikidot ; password: ADMIN1

Discuss This Article

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License