Server - Contents

Dancer2 - Part B

Note: Adjust the Firewall, it's to be re-configured to allow port 5000 for testing purposes, if the port has not already been opened.

Perl and Dancer2 on a Debian Server

Perl Environment on the Server

Note: By default, Perl 5 (the most recent stable version) is initially installed and this is the version used. To get the best ease of use from the Perl5 environment, it is highly recommended to use Perlbrew -see [Dancer-Extras#1]

Install Dancer2

Logon the server, via PuTTY, and enter the following commands:

sammy@imega:$ sudo apt update && apt-get upgrade
sammy@imega:$ sudo apt install build-essential // required to build Perl modules
sammy@imega:$ sudo perl -MCPAN -e shell
sammy@imega:$ install CPAN // get latest version
sammy@imega:$ reload cpan // remain in cpan shell
sammy@imega:$ install Dancer2 // takes some time
sammy@imega:$ exit  // exit cpan shell

Testing Dancer2

Using FileZilla or other means, upload myexample.zip containing the 3-page website.

sammy@imega:$ unzip myexample.zip
sammy@imega:$chmod -R 775 myexample // set permissions
sammy@imega:$cd myexample
sammy@imega: /myexample$plackup -p 5000 -r bin/app.psgi // Go to browser via link at:- http://[MyServerIP]:5000

Enter in the browser, one's domain at port:5000 (eg. http://[MySeverIP]:5000), the result should the appearance of the 3-page website. Type in the PuTTY console: 'ctl'+c to exit

Warning: There are in the Debian environment, slight differences with regard to that of the Win-PC. Take note of these:
- File names are case-sensitive. Example: myphoto.jpg and myphoto.JPG are seen as different files. If the image is not appearing in your website, check this issue.
- Permissions and Ownerships are concepts deeply implemented in the Linux environment. To ensure correct permissions and ownership for the above-example:
sammy@imega:~/myexample$ cd ~
sammy@imega:~$ chmod -R 775 myexample/   //all files executetable
sammy@imega:~$ chown -R sammy:www-data myexample/   // all files under one ownership.
Dancer2 Dancer-PartB
Dancer-Deploy Dancer-Extras