25.1 C
Senior Writer and partner

Install Play framework on Debian 10

Hello, friends. Application development leads to the use of many different tools to make the process faster. Some of these tools are more or less complex according to what is required, but today we will show you how to install Play Framework on Debian 10. This Java and Scala compatible framework will allow you to make quite robust web applications.

What is Play Framework?

Play Framework is a framework that allows us to make web applications with Java & Scala in a fast and easy way. These applications are based on scalability and the possibility that they can be adapted to many different needs.

Like many current frameworks, it uses the MVC pattern for the logical processing of the applications. In addition to this, it has a lot of community support as well as brilliant official documentation.

So with this introduction to Play, we can start the installation process.

Install Play Framework on Debian 10

- Advertisement -

Normally you would install this framework on a local computer, but it also works on a remote server.

So, open a terminal and update Debian

sudo apt update
sudo apt upgrade

After that, you can install some necessary packages. Normally you should already have them but it’s always good to be sure.

sudo apt install git unzip zip curl

Then, with the curl command we have to download the SDK install script with which we will install sbt which is the tool with which we will finally manage the projects made with Play Framework.

curl -s "https://get.sdkman.io" | bash
1.- SDK on Debian 10
1.- SDK on Debian 10

At the end of the process, it is necessary to refresh the user’s PATH.

source "$HOME/.sdkman/bin/sdkman-init.sh"

Now check the installed SDK version with the following command:

sdk version

Sample Output

==== BROADCAST =================================================================
* 2021-07-02: grails 3.3.14 available on SDKMAN!
* 2021-07-02: gradle 7.1.1 available on SDKMAN!
* 2021-07-01: grails 3.3.13 available on SDKMAN!

SDKMAN 5.11.6

When using the SDK, you should then install Java. To do this, you can run the following command:

sdk install java $(sdk list java | grep -o "8\.[0-9]*\.[0-9]*\.hs-adpt" | head -1)

Sample output:

Done repackaging...

Installing: java 8.0.292.hs-adpt
Done installing!

Setting java 8.0.292.hs-adpt as default.

now it uses SDK to install sbt.

sdk install sbt

Sample Output:

Installing: sbt 1.5.4
Done installing!

Setting sbt 1.5.4 as default.

Download the sample project for Play Framework

Make sure you are in your home folder and from there with the git command download the sample project.

cd ~
git clone https://github.com/playframework/play-samples.git
Cloning into 'play-samples'...
remote: Enumerating objects: 16564, done.
remote: Counting objects: 100% (362/362), done.
remote: Compressing objects: 100% (246/246), done.
remote: Total 16564 (delta 210), reused 199 (delta 105), pack-reused 16202
Receiving objects: 100% (16564/16564), 5.32 MiB | 12.35 MiB/s, done.
Resolving deltas: 100% (9846/9846), done.

Access the downloaded folder

cd play-samples/play-scala-hello-world-tutorial

And run the project

sbt run

This will make it available at http://localhost:9000 which you can use a web browser to view the content.

2.- Play Framework on Debian 10
2.- Play Framework on Debian 10

Now if you are doing this installation on a remote server, then you will get an error. This is because the host has not been authorized.

Finish running Play and edit the configuration file:

nano /home/user/play-samples/play-scala-hello-world-tutorial/conf/application.conf

And add the following:

play.filters.hosts {
  allowed = ["."]

Save the changes and close the editor so that when you start the framework again, it will be accessible.

Creating a new application with Play Framework on Debian 10

First, create a folder for the new project. In my case I will call it example but you can call it whatever you want. Then access it.

mkdir ~/example
cd ~/example

And from there, you can download the template for java application development:

sbt new playframework/play-java-seed.g8

Now, access the generated folder and run it:

cd example

Stop it and start working on it.


In this post, you learned about the existence of a very interesting framework for the web like Play Framework. Besides this you are now able to install it on Debian 10.

Enjoy it.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article