Installation Guide

The following is installation instructions for the Foswiki 1.0.0 production release on an Apache web server on Linux. Visit Foswiki:Support.SupplementalDocuments for supplemental information for installing Foswiki or upgrading from TWiki, including notes on installing Foswiki on different platforms, environments and web hosting sites.

These installation instructions are also available online by following links from Foswiki:Support.Foswiki01x00x00.

On this page:

Preparing to install

Before attempting to install Foswiki, you are encouraged to review the Foswiki:System.AdminSkillsAssumptions. This guide assumes the person installing Foswiki has, at a minimum, basic knowledge of server administration on the system on which Foswiki is to be installed. While it is possible to install Foswiki with FTP access alone (for example, on a hosted site), it is tricky and may require additional support from your hosting service (for example, in setting file ownership and installing missing perl CPAN libraries).

To help setup a correct Apache configuration, you are very much encouraged to use the automatic tool Foswiki:Support.ApacheConfigGenerator which generates the contents for an Apache config file for Foswiki based on your inputs.

While this installation guide specifically describes installation on an Apache web server on Linux, Foswiki should be fine with any web server and OS that meet the system requirements (see below). For additional notes on installing Foswiki on other systems, see Foswiki:Support.SupplementalDocuments.

If you are installing Foswiki without Unix/Linux root (administrator) priviledges (for example, on a hosted domain), see "Notes on Installing Foswiki on Non-Root Account" below for supplemental instructions to the basic steps presented below.

If you are upgrading from an earlier major version of Foswiki or from an old TWiki such as Cairo (TWiki 3) you will need the information found in Foswiki:System.UpgradeGuide. There is also a static HTML UpgradeGuide.html included in the root of your Foswiki distribution.

Upgrading from a TWiki 4 release is much simpler. Follow the steps described in Foswiki:Support.UpgradingFromOlderTWikiReleases to ensure a safe upgrade without accidently overwriting customizations.

One of the more difficult tasks is installation of addition CPAN libraries. See Foswiki:Support.HowToInstallCpanModules for detailed information on how to install CPAN libraries.

If you need help, ask a question in the Foswiki:Support web or on Foswiki:Community.InternetRelayChat (irc.freenode.net, channel #foswiki)

Basic Installation

  1. Download the Foswiki distribution from http://foswiki.org/Download
  2. Make a directory for the installation and unpack the distribution in it. In the rest of this document we assume this directory is called foswiki.
    • Note! that Foswiki does not allow spaces in the directory names. Especially on Windows make sure to use a directory path without spaces.
  3. Setup access file and directory rights to enable the webserver user (the user Apache runs the CGI scripts as) to read and write inside the foswiki directory.
    • Warning! Do not just just run a chmod -R 770 foswiki. The access rules have different meaning for files and directories. This is the most common mistake installers make.
    • The distribution tgz has the file and directory access rights setup to work with a reasonable security level that will work for all types of installations including shared hosting.
    • The ownership of the foswiki directory tree is normally set to the user that unpacked the tgz and will have to be changed to the webserver user using the command chown -R user:group /path/to/foswiki. The webserver username varies from Distributions. Examples for some major distributions:
      • RedHat, Fedora, CentOS, Gentoo, Mandriva : chown -R apache:apache /path/to/foswiki
      • debian/Ubuntu/Kubunto : chown -R www-data:www-data /path/to/foswiki
      • Suse : chown -R wwwrun:www /path/to/foswiki
    • If you mistakenly change the access rights in a way that makes Foswiki stop working, simply run the script found at Foswiki:Support.SettingFileAccessRightsLinuxUnix to set the access right of the entire Foswiki tree back to the distributed defaults.
    • It is possible to define tighter access rules than the ones given by default after the installation is complete. But how tight they should be depends on your distribution and local needs. Typically you may want to limit all access from world if the webserver machine has login access for other users than root and the web server administrator. For a dedicated web server made just for running Foswiki with limited login access the default access rights have a good safety level.
  4. Check the Perl installation. Ensure that Perl 5 and the Perl CGI library are installed on your system.
    • The default location of Perl is /usr/bin/perl. If it's somewhere else, change the path to Perl in the first line of each script in the bin directory.
    • Some systems require a special extension on perl scripts (e.g. .cgi or .pl). This is normally only needed under Windows and only where perl scripts are only recognized by file extension. Linux and Unix users should normally never need to do this. If necessary, rename all files in bin (i.e. rename view to view.pl etc). If you do this, make sure you set the ScriptSuffix option in configure (Step 6).
  5. Create the file LocalLib.cfg located as bin/LocalLib.cfg
    • There is a template for this file in bin/LocalLib.cfg.txt. Simply copy LocalLib?.cfg.txt to LocalLib?.cfg. Make sure the ownership and access rights of the copy are the same as LocalLib?.cfg.txt
    • The file bin/LocalLib.cfg must contain a setting for $foswikiLibPath, which must point to the absolute file path of your lib e.g. /var/www/foswiki/lib.
    • If you need to install additional CPAN modules, but can't update the main Perl installation files on the server, you can set $CPANBASE to point to your personal CPAN install. Don't forget that the webserver user has to be able to read those files as well.
  6. Choose best configuration method for your webserver. There are two ways to configure Apache: config file included from httpd.conf or .htaccess files
    • Apache config file: The recommended method is using a config file. With a config file you can put the entire Foswiki configuration in ONE file (typically named foswiki.conf). Performance is much better with a config file, and one file gives the best overview and ensures that you get a safe installation . However using a config file requires that you can restart Apache which again means that you need root or sudo access to stop and start Apache. The Foswiki apache config file is included from the main Apache config file http.conf. Most distributions have a directory from which any file that ends with .conf gets included when you restart Apache (Example RedHat/Fedora/Centos: /etc/httpd/conf.d). If you use a virtual host setup in Apache you should include the foswiki.conf file from inside the desired virtual host config in your Apache configuration.
    • .htaccess file: This should only be used when you cannot use a config file. Performance is slowed down because Apache has to look through all directories in search for possible .htaccess files each time someone views a page in Foswiki. Normally this is the only way to control Apache in a shared host environment where you have no root or sudo priviledges.
  7. Configure the webserver
    • Unless you are an Apache expert setting up the webserver can be quite difficult. But Foswiki has three resources that make setting up Apache easier.
      • The best and easiest way is to use webpage Foswiki:Support.ApacheConfigGenerator which contains a tool that can generate a safe and working config file for Foswiki on Apache.
      • In the root of the foswiki installation you find an example config file foswiki_httpd_conf.txt
      • In the root of the foswiki installation and in the bin directory you find example .htaccess files you can copy and modify. The files contains help text explaining how to set them up. In foswiki/bin you find .htaccess.txt which can be copied to .htaccess and defined access to the CGI scripts. In the root of Foswiki you find pub-htaccess.txt which you can copy to pub/.htaccess, subdir-htaccess.txt which you can copy to all directories as .htaccess except bin and pub, and you find root-htaccess.txt which you can copy to .htaccess in the foswiki root directory. But again only use .htaccess files if you do not have root priviledges.
    • If you are unsure about how to do this on your system, see Foswiki:Support.SupplementalDocuments for links to information about various server setups.
    • Note! When you use config files you need to restart Apache each time you change a setting to make the new setting active.
  8. Protect the configure script
    • You should never leave the configure script open to the public. Limit access to the bin/configure script to either localhost, an IP address or a specific user using basic Apache authentication. The Foswiki:Support.ApacheConfigGenerator lets you setup who has access to the configure script. Also the example foswiki-httpd-conf.txt and bin/.htaccess.txt files includes the needed setting to protect the configure script.
    • If you limit the access to a particular user then you need to setup a .htpasswd file that contains the user name and password that Apache will authenticate against. Per default both Foswiki:Support.ApacheConfigGenerator and the example config files and .htaccess files uses data/.htpasswd but this file does not exist until you have Foswiki running and have registered the first user. You therefore have two options. Either limit the access to localhost or an IP address, or make a .htpasswd file. To make a .htpasswd file change directory to foswiki/data and issue the command htpasswd -c .htpasswd username and enter your password when asked. The username must match the Require user username directive in the Apache config file or .htaccess file. Do not use a username you will later use to register in Foswiki because Foswiki will then claim that you are already registered.
  9. Run the configure script from your browser (enter http://yourdomain/foswiki/bin/configure into your browser address bar)
    • Resolve any errors or warnings it tells you about.
    • Note! When you run configure for the first time, you can only edit the section General Path Settings. Save these settings, and then return to configure to continue configuration.
    • If your webserver can be accessed by more than one domain name make sure to add the additional alternative URLs to {PermittedRedirectHostUrls}
    • When you return to configure you now need to setup Mail and Proxies. Especially the {WebMasterEmail}, and {SMTP}{MAILHOST} must be defined to enable Foswiki to send registration emails. Many ISPs have introduced authentication when sending emails to fight spam so you may also have to set {SMTP}{Username} and {SMTP}{Password}. If you do not want to enable mailing or want to enable it later you can uncheck {EnableEmail}.

You now have a basic, unauthenticated installation running. At this point you can just point your Web browser at http://yourdomain.com/foswiki/bin/view and start Foswiki-ing away!

Important Server Security Settings

Before you continue any further there are some basic and very important security settings you have to make sure are set correctly.

The Foswiki:Support.ApacheConfigGenerator as well as the example foswiki_httpd_conf.txt and example htaccess.txt files include the needed settings that protect against all 3 security elements.

Next Steps

Once you have Foswiki installed and running, you might consider the following optional steps for setting up and customizing your Foswiki site. Many of the references below refer to topics within your Foswiki installation. For example, Skins refers to the Skins topic in your Foswiki web. Easy way to jump directly to view the pages is to open your own Foswiki in your browser and write System.Skins in the Jump test box to the right in the top bar and hit Enter. You can find these topics in the on-line reference copy at the official Foswiki website: System web at Foswiki

Enable Authentication of Users

This step provides for site access control and user activity tracking on your Foswiki site. This is particularly important for sites that are publicly accessible on the web. This guide describes only the most common of several possible authentication setups for Foswiki and is suitable for public web sites. For information about other setups, see System.UserAuthentication, and Foswiki:Support.UserAuthenticationSupplement.

These are the steps for enabling "Template Login" which asks for a username and password in a web page, and processes them using the Apache 'htpasswd' password manager. Users can log in and log out. Users are listed in a topic System/WikiUsers

  1. Under the Security Settings pane of configure :
    1. Select Foswiki::LoginManager::TemplateLogin for {LoginManager}.
    2. Select Foswiki::Users::HtPasswdUser for {PasswordManager}.
    3. Select Foswiki::Users::TopicUserMapping for {UserMappingManager}.
    4. Save your configure settings.
    5. Register yourself using the System.UserRegistration topic.
      Check that the password manager recognizes the new user. Check that a new line with the username and encrypted password is added to the data/.htpasswd file. If not, you probably got a path wrong, or the permissions may not allow the webserver user to write to that file.
  2. Edit a topic (by clicking on the Edit link at beginning or end of topic) to check if authentication works.

You are strongly encouraged to read System.UserAuthentication, Foswiki:Support.UserAuthenticationSupplement for further information about managing users and security of your Foswiki site.

Note! The other LoginManager option Foswiki::LoginManager::ApacheLogin uses a basic Apache type authentication where the browser itself prompts you for username and password. Most will find the TemplateLogin looking nicer. But ApacheLogin is required when you use Apache authentication methods like mod_ldap where all authentication is handled by an Apache module and not by the Foswiki perl code. When you use ApacheLogin the apache configuration must be set up to require authentication of the some but not all the scripts in the bin directory. This section in the Apache config (or .htaccess) controls this

<FilesMatch "(attach|edit|manage|rename|save|upload|mail|logon|rest|.*auth).*">
   require valid-user
</FilesMatch>

The Foswiki:Support.ApacheConfigGenerator includes this section when you choose ApacheLogin. In the example foswiki_httpd_conf.txt and bin/.htaccess.txt files this section is commented out with #. Uncomment the section when you use ApacheLogin. It is important that this section is commented out or removed when you use TemplateLogin.

Define the Administrator User(s)

Administrators have read and write access to any topic, irrespectively of Foswiki access controls. When you install Foswiki one of the first things you will want to do is define yourself as an administrator. You become an administrator simply by adding yourself to the AdminGroup. It is the WikiName and not the login name you add to the group. Editing the Main.AdminGroup topic requires that you are an administrator. So to add the first administrator you need to login using the internal Wiki admin user login and the password you defined in configure.

Set Foswiki Preferences

Preferences for customizing many aspects of Foswiki are set simply by editing a special topic with Foswiki.

Enable Email Notification

Each web has an automatic email notification service that sends you an email with links to all of the topics modified since the last alert. To enable this service:

  1. Confirm the Mail and Proxies settings in the Configure interface.
  2. Setup a cron job (or equivalent) to call the tools/mailnotify script as described in the System.MailerContrib topic.

Enable WebStatistics

You can generate a listing manually, or on an automated schedule, of visits to individual pages, on a per web basis. For information on setting up this feature, see the System.SiteTools topic.

Automate removal of expired sessions and lease files

Per default Foswiki cleans out expired session and lease files each time any topic is viewed. This however cost performance. It is an advantage to define a negative value in configure for {Sessions}{ExpireAfter} and install let cron run the tools/tick_foswiki.pl script. Read The topic CommandAndCGIScripts#tick_foswiki_pl for details how to do this.

Enable Localisation

Foswiki now supports displaying of national (non-ascii) characters and presentation of basic interface elements in different languages. To enable these features, see the Localisation section of configure. For more information about these features, see Foswiki:Support.InternationalizationSupplement.

Tailor New Users Home Topic

When a new users registers on your Foswiki, a home topic is created for them based on the System.NewUserTemplate topic (and its System.UserForm). It contains additional resources you can use to:

If you choose to tailor anything you are strongly adviced to copy NewUserTemplate and UserForm to the Main web and tailor the Main web copies. Foswiki will look for the NewUserTemplate in the Main web first and if it does not exist it uses the default from the Foswiki web. By creating a Main.NewUserTemplate and its Main.UserForm you will not loose your tailorings next time you upgrade Foswiki.

If you added or removed fields from the user form you may also need to tailor System.UserRegistration.

Install Plugins

Foswiki:Extensions is an extensive library of plugins for Foswiki, that enhance functionality in a huge number of ways. A few plugins are pre-installed in the Foswiki distribution.

You activate installed plugins in the Plugins section of configure. In this section you also find a Find More Extensions button which opens an application which can install additional plugins from the foswiki.org website. If you are behind a firewall or your server has no access to the Internet it is also possible to install plugins manually. Manual installation instructions for the plugins can be found in the plugin topics on foswiki.org. Additional documenation on Foswiki plugins can be found at Foswiki:Support.PluginsSupplement.

Some plugins require that you define their settings in configure. You fill find these under the Extensions section of configure.

Customize Your Foswiki!

The real power of Foswiki lies in it's flexibility to be customized to meet your needs. You can with small means change the looks of the default skin (called PatternSkin) by reading the System.PatternSkinCustomization

At the official Foswiki website you can find more resources. A good place to start for exploring what's possible is Foswiki:Support.AdministratorsCookBook which offers tips and tricks for customizing your Foswiki site. Many of these are appropriate to implement immediately after installing Foswiki and before adding content so now's a good time to look at these.

Customization of Special Pages

Some pages are meant to be customized after choice of authentication. If you do not use the internal Foswiki password manager the topics that contains the features for changing and resetting passwords and changing the email address should be changed to a note describing how to perform these tasks in your organization. The topics are:

WYSIWYG vs Raw Edit

From TWiki release 4.2.0 and continuing with Foswiki 1.0.0 it was decided that WYSIWYG would be the default edit mode. An Edit Raw link is available for those that have a need or preference for this mode.

However you may prefer to have the same user interface as in TWiki 4.1 where Edit was the raw text editor and you had a WYSIWYG button. You can modify the templates that define the buttons by following the description on Foswiki:Support.FaqHowToMakeRawEditDefault.

Copyright, License and Classification Statements

In the bottom of each topic you will find a default copyright messages saying "Copyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors." It is a setting WEBCOPYRIGHT that defines this. This is often not adequate.

You change the copy right statement globally by taking these steps.

Troubleshooting

The first step is to re-run the configure script and make sure you have resolved all errors, and are satisfied that you understand any warnings.

Failing that consult the resources you can find in Foswiki:Support.SupplementalDocuments and Foswiki:Support.AskedQuestions.

If you need help, ask a question in the Foswiki:Support web or on Foswiki:Community.InternetRelayChat (irc.freenode.net, channel #foswiki)

Appendices

Foswiki System Requirements

Low client and server base requirements are core features that keep Foswiki widely deployable, particularly across a range of browser platforms and versions.

Server Requirements

Foswiki is written in Perl 5, uses a number of shell commands, and requires RCS (Revision Control System), a GNU Free Software package. Foswiki is developed in a basic Linux/Apache environment. It also works with Microsoft Windows, and should have no problem on any other platform that meets the requirements.

Resource Required Server Environment
Perl 5.8.4 or higher is recommended. Foswiki will run in perl 5.6.1 but only with Wysiwyg editor disabled. Wysiwyg requires unicode support which is provided by perl 5.8.1 and forward.
RCS 5.7 or higher (including GNU diff)
Optional, Foswiki includes a pure perl implementation of RCS that can be used instead (although it's slower)
GNU diff GNU diff 2.7 or higher is required when not using the all-Perl RcsLite?.
Install on PATH if not included with RCS (check version with diff -v)
Must be the version used by RCS, to avoid problems with binary attachments - RCS may have hard-coded path to diff
Other external programs fgrep, egrep
Cron/scheduler • Unix: cron
• Windows: cron equivalents
Web server Apache is well supported; for information on other servers, See Foswiki:Support.InstallingOnSpecificPlatforms.

Required CPAN Modules

Most of the CPAN libraries listesd below are part of a standard Perl installation so you most likely have them all!

See Foswiki:Support.HowToInstallCpanModules for detailed information on how to install CPAN libraries

The following Perl CPAN modules are used by Foswiki

Module Preferred version
Algorithm::Diff (included)  
CGI Versions 2.89 and 3.37 must be avoided. Most version from 3.15 and onwards should work.
CGI::Carp >=1.26
Config >=0
Cwd >=3.05
Data::Dumper >=2.121
Error (included)  
File::Copy >=2.06
File::Find >=1.05
File::Spec >=3.05
FileHandle >=2.01
IO::File >=1.10
Text::Diff (included)  
Time::Local >=1.11

Optional CPAN Modules

The following Perl modules may be used by Foswiki:

See Foswiki:Support.HowToInstallCpanModules for detailed information on how to install CPAN libraries

Module Preferred version Description
Archive::Tar   May be required by the Extensions Installer in configure if command line tar or unzip is not available
CGI::Cookie >=1.24 Used for session support
CGI::Session >=3.95 Highly recommended! Used for session support
Digest::base    
Digest::SHA1    
Jcode   Used for I18N support with perl 5.6
Locale::Maketext::Lexicon >=0 Used for I18N support
Net::SMTP >=2.29 Used for sending mail
Unicode::Map   Used for I18N support with perl 5.6
Unicode::Map8   Used for I18N support with perl 5.6
Unicode::MapUTF8   Used for I18N support with perl 5.6
Unicode::String   Used for I18N support with perl 5.6
URI   Used for configure

Most of them will probably already be available in your installation. You can check version numbers with the configure script, or if you're still trying to get to that point, check from the command line like this:

perl -e 'use FileHandle; print $FileHandle::VERSION."\n"'

Client Requirements

The Foswiki standard installation has relatively low browser requirements:

CSS and Javascript are used in most skins, although there is a low-fat skin (Classic skin) available that minimises these requirements. Some skins will require more recent releases of browsers. The default skin (Pattern) is tested on IE 6, Safari, and Mozilla 5.0 based browsers (such as Firefox).

You can easily select a balance of browser capability versus look and feel. Try the installed skins in the skin browser and more at Foswiki:Extensions.SkinPackage.

Important note about Foswiki Plugins

Notes on Installing Foswiki on Non-Root Account

The following supplemental notes to the Basic Installation instructions apply to installing Foswiki on a system where you don't have Unix/Linux root (administrator) privileges, for example, on a hosted Web account or an intranet server administered by someone else.

Referring to the Basic Installation steps presented above:

Foswiki dir: What it is: Where to copy: Example:
foswiki start-up pages root Foswiki dir /home/smith/foswiki/
foswiki/bin CGI bin CGI-enabled dir /home/smith/foswiki/bin
foswiki/lib library files same level as bin /home/smith/foswiki/lib
foswiki/locale language files dir secure from public access /home/smith/foswiki/locale
foswiki/pub public files htdoc enabled dir /home/smith/foswiki/pub
foswiki/data topic data dir secure from public access /home/smith/foswiki/data
foswiki/templates web templates dir secure from public access /home/smith/foswiki/templates
foswiki/tools Foswiki utlilities dir secure from public access /home/smith/foswiki/tools
foswiki/working Temporary and internal files dir secure from public access /home/smith/foswiki/working

For additional information about installing Foswiki on a hosted accounts, see Foswiki:Support.InstallingOnSharedHosts

Installing Manually Without Configure

It is highly recommended to use run configure from the browser when setting up Foswiki. Configure does a lot of the hard work for you.

But there may be instances where you do not want to use configure or where configure simply won't run because of a missing dependency.

The manual steps you have to take are:


Related Topics: AdminDocumentationCategory, Foswiki:Support.SupplementalDocuments