Hello, friends. In this short post, we will help you to install Apache Cordova on Debian 11. This tool is used to create mobile applications.
What is Apache Cordova?
If we take as a reference the Apache Cordova website, we have this definition
Apache Cordova is an open-source mobile development framework. It allows you to use standard web technologies HTML5, CSS3, and JavaScript for cross-platform development.
Developers use Cordova to create hybrid web and mobile applications. For example, a website builder can use Apache Cordova to package it into a mobile application for distribution in the various app shops.
So, Apache Cordova is widely used around the world and relies on NodeJS in addition to other tools.
Installing NodeJS in Debian 11
Apache Cordova is strongly linked to nodeJS. So, we have to install NodeJS before Apache Cordova.
To achieve this, we will install the 16.x
version of NodeJS.
Add the repository in question.
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
After the NodeJS dependencies are installed, we can install NodeJS without much trouble.
So, to install NodeJS you can run
sudo apt install nodejs
Installing Java on Debian 11
Next, you need to install Java. In this step, you have to choose between the openJDK or the proprietary version. Many recommend Oracle’s proprietary version to avoid problems, but others have found openJDK to work well.
sudo apt install default-jdk
This will get Java installed.
Install Apache Cordova on Debian 11
With NodeJS installed and running, we can then, thanks to npm
install Cordova.
To achieve this, just run
sudo npm install -g cordova
At the end of the installation, you will be able to see which version of Apache Cordova has been installed.
cordova --version
Output:
11.0.0
Create a new project with Apache Cordova
So, to create a new project with Cordova, you need to run
cordova create net.project.hello hello
You can replace the values with the name of your new project.
This will create a new folder that you have to access.
cd hello
The next step is to add a platform. In this case, I will add Android.
cordova platform add android
Remember that for this, you have to install the Android SDK. Now you can start using Apache Cordova.
Conclusion
In this post, you learned how to install Apache Cordova on Debian 11. This is a good step to learn about mobile/web hybrid applications.