Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install Apache Cordova on Ubuntu

Install Node.js and npm, then Cordova, to build mobile apps from HTML, CSS and JavaScript.

VPS and Cloud Servers2 min read7 steps8 screenshots

What Cordova is

Apache Cordova wraps a web app (HTML, CSS and JavaScript) in a native shell, so you can publish it as a mobile app for Android and iOS from one code base.

Step 1: Install Node.js and npm

Update the system:

sudo apt update && sudo apt upgrade -y
Updating the system

Install curl:

sudo apt-get install -y curl
Installing curl

Download the NodeSource setup script (version 22 is used here; pick a current LTS version):

curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
Downloading the NodeSource script

Run it:

sudo -E bash nodesource_setup.sh
Running the script

Install Node.js:

sudo apt-get install -y nodejs
Installing Node.js

Check the version:

node -v
The Node.js version

Step 2: Install Cordova

sudo npm install -g cordova
Installing Cordova

-g installs it globally, so the cordova command works everywhere.

Check it:

cordova -v
The Cordova version

Create a first project

cordova create myApp com.example.myapp MyApp
cd myApp
cordova platform add android

To build for Android you also need the Android SDK and a Java JDK. Check your setup with cordova requirements.

Benefits of Cordova

  1. Cross-platform. One code base for several systems.
  2. Easy to learn. It uses HTML, CSS and JavaScript.
  3. Large community.
  4. Many plugins for the camera, GPS, files and more.
  5. Open source and free.
  6. Flexible. Use the tools and frameworks you like.
  7. Fast development.

Typical uses

  • Hybrid mobile apps.
  • Turning an existing web app into a mobile app.
  • Quick prototypes.

Quick recap

  • Install Node.js with NodeSource.
  • sudo npm install -g cordova.
  • Check with cordova -v.