Would you like to learn how to install Apache and enable the use of Perl CGIs on a computer running Ubuntu Linux? In this tutorial, we are going to show you how to enable the CGI feature and enable Perl scripts to run on the Apache server.

• Ubuntu 18
• Ubuntu 19
• Ubuntu 20
• Apache 2.4.41
• Perl 5

Equipment list

The following section presents the list of equipment used to create this tutorial.

As an Amazon Associate, I earn from qualifying purchases.

Tutorial Ubuntu - Perl CGI on Apache

Install the Perl package.

Copy to Clipboard

Install the Apache server and enable the module named CGID.

Copy to Clipboard

Restart the Apache service.

Copy to Clipboard

As an example, let's create a Perl CGI.

Access the Apache's CGI directory.

Copy to Clipboard

Create a Perl CGI.

Copy to Clipboard

Here is the file content.

Copy to Clipboard

Change the file permission.

Copy to Clipboard

Open your browser and enter the IP address of your web server plus /cgi-bin/test.pl.

In our example, the following URL was entered in the Browser:


The Perl CGI should display the following message.

Apache Perl CGI

Congratulations! Apache is now able to use Perl scripts as CGI.