How to Install Foswiki Wiki with Apache on Ubuntu Linux

|

,

|

This brief tutorial shows students and new users how to install and configure the Foswiki platform on Ubuntu 18.04 | 16.04 with an Apache2 HTTP server. Foswiki is a free, open-source wiki platform that provides enterprise-grade collaboration features that your team can use to share and collaborate directly in their web browser. It helps you…

This brief tutorial shows students and new users how to install and configure the Foswiki platform on Ubuntu 18.04 | 16.04 with an Apache2 HTTP server.

Foswiki is a free, open-source wiki platform that provides enterprise-grade collaboration features that your team can use to share and collaborate directly in their web browser.

It helps you create personal or business websites in minutes and has a built-in world-class text editor, dynamic to-do lists, inventory systems, a status board, and more.

Foswiki software offers features that may not be available to other CMS, like WordPress, Joomla, or Drupal.

For more about Foswiki, please check its homepage.

When you’re ready to get Foswiki working, continue with the steps below:

Install Apache2 HTTP Server

Foswiki requires a web server, and Apache2 HTTP Server is the most popular web server. You might want to install it to run Foswiki.

To install Apache2 HTTP on the Ubuntu server, run the commands below.

sudo apt update
sudo apt install apache2 libapache2-mod-perl2

After installing Apache2, the commands below can stop, start, and enable the Apache2 service to always start up with the server boots.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

To test the Apache2 setup, open your browser and browse to the server hostname or IP address. You should see the Apache2 default test page, as shown below. When you see that, then Apache2 is working as expected.

http://localhost

Install Perl and Related Modules

Foswiki is written in Perl, which is supported on any platform. To install Perl and related modules to support Foswiki, run the commands below:

sudo apt update
sudo apt install libalgorithm-diff-perl libarchive-tar-perl libauthen-sasl-perl libcgi-pm-perl libcgi-session-perl libcrypt-passwdmd5-perl libdigest-sha-perl libemail-address-perl libemail-mime-perl libencode-perl liberror-perl libfile-copy-recursive-perl libhtml-parser-perl libhtml-tree-perl libio-socket-ip-perl libio-socket-ssl-perl libjson-perl liblocale-maketext-perl liblocale-maketext-lexicon-perl liblocale-msgfmt-perl libwww-perl liblwp-protocol-https-perl liburi-perl libversion-perl

Download Foswiki’s Latest Release

Next, visit the Foswiki site and download the latest package. At the time of this writing, the latest version is 2.1.6

If you find a newer version, download it instead of this. Use the commands below to download and extract the archive package, replacing the version number with the latest version.

cd /tmp/
wget https://github.com/foswiki/distro/releases/download/FoswikiRelease02x01x06/Foswiki-2.1.6.tgz
tar xvzf Foswiki-2.1.6.tgz
sudo mv Foswiki-2.1.6 /var/www/foswiki

Then, run the commands below to set the correct permissions for Foswiki to function correctly.

sudo chown -R www-data:www-data /var/www/foswiki/
sudo chmod -R 755 /var/www/foswiki/

Next, change it into the Foswiki directory and run these commands to fix file permission issues.

cd /var/www/foswiki/tools
sudo sh fix_file_permissions.sh
sudo perl rewriteshebang.pl

When finished, continue below to create Foswiki’s Apache2 vhost file.

Configure the Apache2 Foswiki Site

Next, configure the Apache2 configuration file for Foswiki. This file will control how users access Foswiki content. Run the commands below to create a new configuration file called Foswiki.conf.

A script to auto-generate the configuration file can be found here. Use it to generate one for your environment. Use copy and paste the configuration lines below into the file and save.

sudo nano /etc/apache2/sites-available/foswiki.conf

Then copy and paste the content below into the file and save it. Replace the highlighted line with your domain name and directory root location.

Define foswikiroot "/var/www/foswiki"
<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    DocumentRoot "${foswikiroot}"
    ServerName example.com
    ServerAlias www.example.com

ScriptAlias /foswiki/bin "${foswikiroot}/bin"
Alias /foswiki/pub "${foswikiroot}/pub"
Alias /robots.txt "${foswikiroot}/robots.txt"
RewriteEngine    on
Alias /foswiki "${foswikiroot}/bin/view"
RewriteRule ^/+foswiki/+bin/+view/+(.*) /foswiki/$1 [L,NE,R]
RewriteRule ^/+foswiki/+bin/+view$ /foswiki/ [L,NE,R]

<Directory "${foswikiroot}">
    <RequireAll>
        Require all granted
        Require not env blockAccess
    </RequireAll>
</Directory>

<Directory "${foswikiroot}/bin">
    AllowOverride None

    <RequireAll>
        Require all granted
        Require not env blockAccess
    </RequireAll>

    Options +ExecCGI  -FollowSymLinks
    SetHandler cgi-script

    # Password file for Foswiki users
    AuthUserFile "${foswikiroot}/data/.htpasswd"
    AuthName 'Enter your WikiName: (First name and last name, no space, no dots, capitalized, e.g. JohnSmith). Cancel to register if you do not have one.'
    AuthType Basic
    ErrorDocument 401 /foswiki/System/UserRegistration
</Directory>

<Directory "${foswikiroot}/pub">
    Options None
    Options -FollowSymLinks
    AllowOverride None

    <RequireAll>
        Require all granted
        Require not env blockAccess
    </RequireAll>
    ErrorDocument 404 /foswiki/bin/viewfile

    <ifmodule mod_php3.c>
        php3_engine off
    </ifmodule>
    <ifmodule mod_php4.c>
        php_admin_flag engine off
    </ifmodule>
    <ifmodule mod_php5.c>
        php_admin_flag engine off
    </ifmodule>

   # This line will redefine the mime type for the most common types of scripts
    AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi

</Directory>
<Directory "${foswikiroot}/data">
    Require all denied
</Directory>

<Directory "${foswikiroot}/templates">
    Require all denied
</Directory>

<Directory "${foswikiroot}/lib">
    Require all denied
</Directory>

<Directory "${foswikiroot}/locale">
    Require all denied
</Directory>

<Directory "${foswikiroot}/tools">
    Require all denied
</Directory>

<Directory "${foswikiroot}/working">
    Require all denied
</Directory>

BrowserMatchNoCase ^$ blockAccess
</VirtualHost>

Save the file and exit.

After configuring the VirtualHost above, please enable it by running the commands below.

Enable the Foswiki Site and Rewrite the Module

After configuring the VirtualHost above, please enable it by running the commands below, then restart the Apache2 server.

sudo a2ensite foswiki.conf
sudo a2enmod rewrite
sudo a2enmod cgi

Restart Apache2

sudo systemctl restart apache2.service

Next, open your browser and browse to the server hostname or IP address to bootstrap your install by browsing to the default view URL for your site in your web browser.

http://example.com/bin/view

Follow the link in the Bootstrap banner of the returned page to the bin/configure tool, address any warnings, and save your configuration.

Begin addressing issues on the left. When you’re done, save your changes.

Return from configure (button at the top of the page), and register your first user.

Enjoy!

Conclusion:

You have successfully installed Foswiki CMS on Ubuntu 16.04 | 18.04. For more tutorials on Ubuntu, please search our site.

You may also like the post below:


Discover more from Geek Rewind

Subscribe to get the latest posts to your email.

Like this:



One response to “How to Install Foswiki Wiki with Apache on Ubuntu Linux”

  1. no name Avatar
    no name

    This page was a great help (ubuntu-20.04.1-live-server).

Leave a Reply to no nameCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Discover more from Geek Rewind

Subscribe now to keep reading and get access to the full archive.

Continue reading