Configuring Appium in Ubuntu from Scratch

Shashi Kumar Raja
TestCult
Published in
3 min readApr 8, 2017

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 vast 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 https://nodejs.org/download/release/latest/
    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
usr/local/bin/node

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 $JAVA_HOME
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
./studio.sh
  • 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
appium

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

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

The above steps should get your ubuntu machine running with appium in very short time.

If you liked this article, you can read these others posts related to testing-

--

--