Configuring Appium in Ubuntu

Recently I started working on Appium for Android automation using node.js and needed to set up the automation environment on my Ubuntu machine.Given the user base of Appium, what should have been a quick setup took a long time due to unavailability of proper setup instructions. So, I decided to share the complete to-do list curated by me for setting it up painlessly.

1.Install node.js without using sudo-

  • Do not install node.js through apt-get, which will need sudo rights and appium will not work if node.js is installed as sudo user. If you have already installed remove it using commands:
sudo apt-get remove nodejs
sudo apt-get remove npm
  • Download latest nodejs linux binaries from
    into a folder for example /home/
    superman/Downloads   (where superman is your username and you have downloaded the file in Downloads)
  • Now install it under /usr/local using
cd /usr/local
tar --strip-components 1 -xzf /home/superman/Downloads/node-v8.2.1-linux-x64.tar.gz
  • Check the installation using
which node
it should give you output

node -v 
should give you output
v8.2.1 (or whichever version you have installed)

2. Install java, jdk and jre-

sudo apt-get update
sudo apt-get install default-jre
sudo apt-get install default-jdk
//to install oracle jdk
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

3. Set the JAVA HOME path-

//open bashrc file 
gedit ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=${PATH}:${JAVA_HOME}/bin
//run following command to verify the path
echo $PATH
Tip: Use the following command to find out exact path to which java executable under UNIX / Linux:
which java

4. Download android studio and set the ANDROID HOME path-

  • download android studio for ubuntu and extract it in the HOME directory
  • open terminal and enter
cd android-studio/bin
  • Now android studio will open.Click next and let it download required things.
  • Once android sdk is installed add ANDROID_HOME to environment using:
gedit /.bashrc
//add following lines at the end of the file and then save
export ANDROID_HOME=/home/user_name/Android/Sdk
export PATH=$PATH:/home/user_name/Android/Sdk/tools
export PATH=$PATH:/home/user_name/Android/Sdk/platform-tools

5. Install appium globally-

npm install -g appium
//check if appium is installed using

6. Install appium-doctor to troubleshoot the errors if any using:

npm install -g appium-doctor
//it will give checklist of which things are okay and which are not

Following the above six steps, one by one should get you up and running with Appium in very short time.