How To Install Apache Cordova on Ubuntu 18.04 LTS

How To Install Apache Cordova on Ubuntu 18.04 LTS


Apache Cordova, initially referred to as PhoneGap is an open-source development framework for mobile devices that helps developers to use HTML5, CSS3, and JavaScript to build new mobile applications.

This platform also allows you to create hybrid mobile apps using Javascript, HTML, and CSS that can be useful in other mobile platforms such as Android, IOS, or Windows. It is easy and fast to create hybrid applications compared to the native applications on the Cordova platform, hence saves a lot of time during the development stage.

This articles will take you through the process of installing Cordova on Ubuntu 18.04 LTS.


Before we begin the installation process, you need to have the following:

  • A virtual server running Ubuntu 18.04.
  • A non-root user with sudo privileges.

Let’s begin!

Step 1 –
Installing Node.js

The first step is to install the current stable version of Node.js to your virtual machine. Since Node.js is not present in Ubuntu’s default repository, we need to include PPA for node.js for it to install. This can be done by running the command below:

$cd ~
$ curl -sL -o

You can use nano editor or any other editor of choice to scrutinize the content of the above script:

$ nano

Alternatively, execute the command below to run the script:

$ sudo bash

After installing the repository, go ahead and install Node.js by running the command below:

$ sudo apt-get install nodejs -y

To check the version of Node.js installed, execute the command below:

$ nodejs -v

This will give you an output like the one below. The version number may vary depending on the Node.js installed:


Next, run the command below to install Node.js package manager:

$ sudo apt install npm

Execute the command below to verify the version of npm installed:

$ npm -v

This will give you an output similar to the one below:


Step 2 –
Installing Cordova Using NPM

The next step is to install Cordova with NPM. Apache Cordova command requires Node.js to run and it’s available on NPM. To install it, run the following command:

$ sudo npm install -g cordova

After installing Cordova, you need to check to verify the version you are using with the command below:

$ cordova --version

The output should look like this:

? May Cordova anonymously report usage statistics to improve the tool over time? Yes

Thanks for opting into telemetry to helpus improve cordova.


We can now go ahead and create an app after installing Cordova

Step 3 –
Creating An Application With Cordova

Now that you have successfully installed Cordova, you can create your first application .

To do so, run the command below with the name myapp. You can change the name as needed.

$ cordova create myapp

The output should look like this:

Creating a new cordova project.

Now add the platform you want in the application. This process will create the files you need for the corresponding platform.

$cd myapp
$ cordova platform add android

The output below will display:

Using cordova-fetch for cordova-android@~7.0.0
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms/android
        Package: io.cordova.hellocordova
        Name: HelloCordova
        Activity: MainActivity
        Android target: android-26
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@7.0.0
Android Studio project detected
Android Studio project detected
Discovered plugin"cordova-plugin-whitelist"in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist"for android

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
Adding cordova-plugin-whitelist to package.json
Saved plugin info for"cordova-plugin-whitelist" to config.xml
--save flag or autosave detected
Saving android@~7.0.0 into config.xml file ...

The next thing is to list down the installed platforms that will be required for Cordova application.

$ cordova platform -ls

You should see the output below:

  android 7.0.0
  browser ~5.0.1
  ios ~4.5.4
  osx ~4.0.1
  windows ~5.0.0
  www ^3.12.0

If you add any platform that you don’t want, you can get rid of it using the command below:

$ cordova platform remove android

Now, you need to build a Cordova application. But before that, make sure that your system fulfils all the requirements needed for your build environment.

$ cordova requirements

After installing these requirements, run the command below to start building your application:

$ cordova build android

That’s all!


At this point, you should be able to install Apache Cordova on Ubuntu 18.04 LTS successfully. Now you can enjoy using standard web technologies such as CSS3, HTML5, and JavaScript hassle free.

Check out these top 3 Linux hosting services

AU$2.68 /mo
Starting price
Visit FastComet
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing
AU$5.98 /mo
Starting price
Visit Kamatera
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing
AU$3.72 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing

How To Install Node.js On Ubuntu 18.04

This tutorial will help you install the latest version of Node.js; a cross-platf
4 min read
David Malcom
David Malcom

How to Create a Non-root User on Your Ubuntu 18.04 VPS or Dedicated Server

This guide shows you how to create a user on your Ubuntu 18.04 virtual server.
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to Install a Self-Signed SSL Certificate on Your Ubuntu 18.04 VPS or Dedicated Server

This how-to article will teach you how to create a self-signed SSL certificate o
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to Set Up Cron Jobs on Your Ubuntu 18.04 Dedicated Server or VPS

This guide shows webmasters and administrators how to set up cron jobs on your U
3 min read
Idan Cohen
Idan Cohen
Marketing Expert provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top