How to Install Foswiki with Apache on Ubuntu 24.04
You install Foswiki with Apache on Ubuntu 24.04 to deploy a robust, open-source wiki for team collaboration.
Foswiki is a powerful, Perl-based wiki engine that builds shared knowledge bases and manages projects. Foswiki excels at combining unstructured text with structured data, making Foswiki a versatile tool for teams.
This process sets up Foswiki to run efficiently using the Apache web server on Ubuntu 24.04 LTS, ensuring reliable performance for your wiki.
Install Apache2 and necessary Perl modules using `apt`. Download Foswiki, extract it to `/var/www/foswiki`, and set correct file permissions with `chown`. Configure an Apache virtual host in `/etc/apache2/sites-available/foswiki.conf` and enable the site.
Install Apache HTTP server on Ubuntu
You need to install Apache first because it’s the web server that Foswiki uses to work on your Ubuntu system. Open your Ubuntu terminal and run these commands to get Apache installed.
To do that, open the Ubuntu terminal and run the commands below to install the Apache web server.
sudo apt update
sudo apt install apache2
Once Apache is installed, the commands below can start, stop, and enable the Apache web server to start automatically when your server boots up.
sudo systemctl stop apache2
sudo systemctl start apache2
sudo systemctl enable apache2
You can test that the Apache web server is running by opening your web browser and browsing to the server’s localhost or IP address.

When you see the Apache2 Default Page, it signifies that the Apache HTTP server, a web server software version 2.4.57, has successfully installed and is running.
Additional help on installing Apache on Ubuntu is in the link below.
Install Perl and Related Modules
Foswiki requires Perl to run, so you must install Perl and its related modules on your Ubuntu system. Installing Perl and its modules provides the necessary tools for Foswiki to work correctly after you install Foswiki.
sudo apt-get install rcs libalgorithm-diff-perl libarchive-tar-perl libauthen-sasl-perl libcgi-pm-perl libcgi-session-perl libcrypt-passwdmd5-perl libdigest-sha-perl libemail-address-xs-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-codes-perl liblocale-maketext-perl liblocale-maketext-lexicon-perl liblocale-msgfmt-perl libwww-perl liblwp-protocol-https-perl liburi-perl libversion-perl
Download Foswiki files
You need to download the latest Foswiki files and put them in the right folder for Apache to use. After downloading, extract the files into the Apache directory and adjust file permissions to finish setting up Foswiki.
First, head to the `/tmp/` directory and download the Foswiki files. Next, extract the contents into the `Foswiki` folder within Apache’s main directory.
Run the commands below to adjust Apache’s root folder permissions so the Foswiki app can work as expected.
cd /tmp
wget https://github.com/foswiki/distro/releases/download/FoswikiRelease02x01x09/Foswiki-2.1.9.zip
unzip Foswiki-*.zip
sudo cp -rf Foswiki-2.1.9 /var/www/foswiki
sudo chown -R www-data:www-data /var/www/foswiki/
Run the `configure` script from the Foswiki installation directory to repair the `bin` scripts and ensure proper setup. This script, typically located at `foswiki/bin/configure`, verifies file permissions and module dependencies, preventing common errors in version 1.2.5.
cd /var/www/foswiki/tools
sudo -u www-data perl rewriteshebang.pl
When asked, press ‘y’ to apply your changes.
Apache configuration is the next step to serve your Foswiki content. This allows Foswiki to display its web pages correctly to users.
Run the commands below to create an Apache virtual host file for Foswiki.
sudo nano /etc/apache2/sites-available/foswiki.conf
Then, copy and paste the content block below into the Apache server block.
<VirtualHost *:80>
ServerName foswiki.example.com
ServerAdmin admin@example.com
DocumentRoot /var/www/foswiki
ScriptAlias /bin /var/www/foswiki/bin
Alias /pub /var/www/foswiki/pub
<Directory /var/www/foswiki/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/foswiki/bin>
Options +ExecCGI -FollowSymLinks
AllowOverride None
SetHandler cgi-script
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Save the file.
You enable the Foswiki virtual host for Apache and restart the Apache server by running the commands `sudo a2ensite foswiki.conf` and `sudo systemctl restart apache2`. This action makes Foswiki accessible through your web browser.
sudo a2ensite foswiki.conf
sudo a2enmod rewrite
sudo a2enmod cgi
sudo a2enmod access_compat
sudo systemctl restart apache2
Setup Let’s Encrypt SSL/TLS for Foswiki
Secure your Foswiki site with HTTPS by setting up a free SSL/TLS certificate using Let’s Encrypt with Apache on Ubuntu. This makes your Foswiki installation secure by protecting user data, which is important after you install Foswiki.
Please read the post below for additional resources on installing and creating Let’s Encrypt SSL certificates for Apache.
How to set up Let’s Encrypt SSL certificate for Apache on Ubuntu Linux
Once you have restarted the Apache web server, open your browser and browse to the server hostname or IP address defined in the Apache server block.
http://foswiki.example.com/bin/view
The Foswiki set up wizard should appear.
Click on the configure link to configure the app.

Begin configuring all the necessary settings for your site. Click the Save button in the upper right corner of the configuration page.
The login section at the top of the left-hand menu should show that you are still be logged in as a temporary Admin user. Click on the “Log Out” link to exit that user.

Your Foswiki installation is now ready. You can begin creating and editing Foswiki pages immediately after completing the installation steps.

Foswiki should be ready to use.
Conclusion:
To recap, installing Foswiki on Ubuntu 24.04 with Apache involves a few key steps:
- Install Apache: Ensure a stable HTTP server is set up to host Foswiki.
- Install Perl and Dependencies: Foswiki is Perl-based, so installing required Perl modules is essential.
- Download and Configure Foswiki: Fetch the latest Foswiki package and set it up in the Apache root directory.
- Set Permissions: Adjust file permissions for secure interaction between Apache and Foswiki.
- Configure Apache: Create a virtual host file to properly route web traffic to the Foswiki installation.
- Secure with SSL: Enhance security by implementing an SSL/TLS certificate using Let’s Encrypt.
- Complete Installation: Access the Foswiki setup wizard to finalize configurations and start using the platform.
A secure Foswiki installation, completed by following the preceding steps, ensures your team can effectively collaborate and manage knowledge. This Foswiki setup is ready for use by multiple users after this installation.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
No comments yet — be the first to share your thoughts!