This guide assumes you are running your webserver under the http
user and http
group. You may need to change these in the commands
below (for example, Debian uses www-data
).
-
Clone the repository, switch to the latest stable release and fetch the submodules:
git clone git://github.com/Artefact2/osmium.git cd osmium git checkout production git submodule init git submodule update
From now on, you can run the
./bin/sanity_check
script to see which things need to be installed or configured. -
Make the cache directories writeable by your webserver:
chgrp http cache static/cache chmod g+rwx cache static/cache
-
Copy the
config-example.ini
file toconfig.ini
, and tweak the settings inconfig.ini
to your liking.Do the same for
static/robots-example.txt
. -
Install the depedencies listed below.
-
Make sure Sphinx uses the configuration file
sphinx/sphinx.conf
. In some systems (like Debian), you will need to copy this file to the system-widesphinx.conf
and edit all the paths to absolute paths. The search daemon (searchd
) should now be running. -
Install the PostgreSQL schema: see the "Initial database setup" section below.
-
Run
./bin/sanity_check
. At this point, you should not have any fatal issues (marked in red). -
Run
make
. This will generate the stylesheets, the static client data, and generate other static cache. The first run may take some time. -
Setup the cron jobs (they will renice their CPU/IO priority, no need to do it yourself):
sudo crontab -e -u http @hourly /path/to/osmium/bin/cron.hourly >/dev/null @daily /path/to/osmium/bin/cron.daily >/dev/null
-
Configure your HTTP server. Check the
ext/httpd-conf/
directory for configuration examples of popular web servers. If yours is not in the list, or you want to tweak the configuration yourself, here is how Osmium assumes your web server will proceed:
-
Any URL that does not match
^/(src/|static)
is aliased (or "sent to") to/src/dispatch.php
. -
Any URL that matches
^/static-([1-9][0-9]*)/
is aliased to/static/
(for example, '/static-2/foo/bar.png' is an alias of/static/foo/bar.png
). -
For optimal performance, it is recommended to set an expiration date for static files far in the future. Static files all have URIs that match
^/static(-[1-9][0-9]*)?/
. -
To minimize bandwidth usage, be sure to enable gzip compression (especially on all the files (except images) under static/).
-
For pretty error pages, you can use
/src/fatal.php?code=<HTTP_CODE>&message=<TEXT>
.
-
Start your webserver and browse to it. You should see the Osmium main page. If not, check the error logs and re-run
./bin/sanity_check
for things you may have missed. -
(Optional) Create an account then give yourself moderator status:
psql osmium osmium_user UPDATE osmium.accounts SET ismoderator = true WHERE accountname = 1
(If you are not the first user creating an account, you can see your account ID by going on your profile page and looking at the number in the URL.)
-
PHP >= 5.4, with:
- dogma extension, using libdogma 1.1.x (
dogma.so
) - PostgreSQL extension (
pgsql.so
) - MySQLi extension (
mysqli.so
) - cURL extension (
curl.so
) - SimpleXML support (enabled by default)
- Zlib support
- (Optional) Semaphores support (
sysvsem.so
) - (Optional) iconv extension (
iconv.so
) - (Optional) intl extension (
intl.so
) - (Optional) APC (or APCu for PHP >= 5.5) extension (
apc.so
)
- dogma extension, using libdogma 1.1.x (
-
PostgreSQL >= 9.0
-
Sphinx search server >= 2.0.4 (using the
sphinx.conf
from thesphinx/
directory) -
HTMLPurifier PEAR package, see http://htmlpurifier.org/download#PEAR
-
Sass >= 3.2 (http://sass-lang.com/)
-
(Optional) A Javascript minifier (UglifyJS is recommended) (heavily recommended for production)
-
(Optional) Horde_Text_Diff+Horde_Autoloader PEAR packages, see http://pear.horde.org (heavily recommended for production)
-
(Optional) PHPUnit, for automated tests
-
(Optional) Xdebug, for debugging and code coverage reports
Assuming your PostgreSQL database name is osmium
and it is owned by
the osmium_user
user, follow these steps:
-
Get the latest Osmium static data dump (see
README-Datadump.md
for instructions) -
Import the Osmium static dump:
xzcat osmium-sde-*.sql.xz | psql osmium osmium_user
-
Import the Osmium tables/views:
psql osmium osmium_user < pgsql/osmium.sql
-
Generate the type search index:
(stop searchd) cd sphinx indexer osmium_types (start searchd)
Note: on some systems, the
indexer
binary is calledsphinx-indexer
. See your system packaging of Sphinx for more details. -
make post-eve-schema-update