Install Appium in Linux Mint


Here I have displayed the installation procedure of Appium in Linux Mint

SUMMARY OF TOOLS REQUIRED BY APPIUM
  • Java SDK 1.7 The openjdk-7-jdk package must be installed. Do not confuse it with openjdk-7-jre, which contains just the Java runtime environment.
  • Apache Ant Java version of GNU make for building Java applications
  • Apache Maven Java dependency management and build system
  • RVM Ruby Version Manager
  • gem Ruby package manager
  • bundler Ruby dependency manager
  • Node.js JavaScript runtime
  • npm Node.js package manager
  • grunt JavaScript task runner
These tools can be installed by following the next steps.

1. INSTALL JAVA


     $ sudo apt-get install openjdk-7-jdk

Sometimes Vim may not execute bashrc - in such cases, $ gedit .bashrc works where worked for me

     $ vim .bashrc

          export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
          export PATH="$PATH:$JAVA_HOME"

    $ source .bashrc

Run the following command to check whether Java is accessible:

    $ java -version

You should get the following output in your terminal:

java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

2. INSTALL APACHE ANT

Move to the workspace folder that we created in step 0 and download the latest version of Apache Ant (which is 1.9.6 at the time of writing):

    $ wget http://www.eu.apache.org/dist//ant/binaries/apache-ant-1.9.6-bin.tar.gz

When that’s done, just uncompress the file and delete the original .tar.gz folder since we won’t need it anymore.

    $ tar -xvzf apache-ant-1.9.6-bin.tar.gz

    $ rm apache-ant-1.9.6-bin.tar.gz

Now you will have a folder named apache-ant-1.9.6 in your workspace folder.
Use that folder to create the ANT_HOME in your .bashrc file:

    $vim .bashrc

        export ANT_HOME="$HOME/workspace/apache-ant-1.9.6"
        export PATH="$PATH:$ANT_HOME/bin" # Add ant to PATH

    $source .bashrc

From the ANT_HOME directory, run the following:

     $ ant -f fetch.xml -Ddest=system

This will get the library dependencies of most of the Ant tasks that require them. If you don’t do this, many of the dependent Ant tasks will not be available.


3. INSTALL APACHE MAVEN

In your workspace folder, download the latest version of Apache Maven (which is 3.3.9 at the time of writing):

    $ wget http://www.us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
    $ tar -xvzf apache-maven-3.3.9-bin.tar.gz

Delete the .tar.gz file:

    $ rm apache-maven-3.3.9-bin.tar.gz

Create the MAVEN_HOME variable and add it to the path:

    $ vim .bashrc

       export MAVEN_HOME="$HOME/workspace/apache-maven-3.3.9"
       export PATH="$PATH:$MAVEN_HOME/bin"

    $ source .bashrc

Then, run the following command from the terminal to check that Maven has been properly configured:

    $ mvn -v

If everything is fine, you should get the following output:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /home/6020peaks/workspace/apache-maven-3.3.9
Java version: 1.7.0_91, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.13.0-74-generic", arch: "amd64", family: "unix"

4. INSTALL RVM

From a terminal, install the mpapis public key. You’ll need it to avoid errors while downloading RVM.

    $ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Then, proceed to install RVM with Ruby:

    $ \curl -sSL https://get.rvm.io | bash -s stable --ruby

Once this is done, proceed to update RubyGems and Bundler:

    $ gem update --system
    $ gem install --no-rdoc --no-ri bundler
    $ gem update
    $ gem cleanup

5. INSTALL NODE.JS

The first rule for installing Node.js the right way is to avoid using apt-get, or else it will need sudo grants, and Appium will not work correctly. Instead, install Linuxbrew, and then install Node.js from it. In short, Linuxbrew is a package manager for Linux forked from the original Homebrew for Mac OS X.

You can install Linuxbrew on Ubuntu by running the following commands. First, install the Linuxbrew dependencies:

    $ sudo apt-get install build-essential curl git m4 python-setuptools ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev

Then, install Linuxbrew by running this:

    $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/linuxbrew/go/install)"

Once installed, add brew to your path:

    $ vim .bashrc
    $ export PATH="$PATH:$HOME/.linuxbrew/bin"
    $ source .bashrc
    $ brew doctor

Now you are in shape to install Node.js from brew:

    $ brew install node

Note that this step can take a very long time, so please be patient and do not close the terminal. Once the process is done, check that Node.js and npm have been successfully installed by running the following:

    $ node --version
    $ npm --version

At this stage, I got an error node is not installed and then find a solution to update brew and then works for me


6. INSTALL GRUNT

Simply run the following command in the terminal, and npm will take care of everything:

    $ npm install -g grunt grunt-cli


7. INSTALL APPIUM

In this section, we’ll work with version 1.4.16 of Appium, but all of the information in this tutorial applies independent of the version.

To install version 1.4.16, change the directory to the workspace folder you created at the beginning, and then download the source code from GitHub:

    $ wget https://github.com/appium/appium/archive/v1.4.16.tar.gz
    $ tar -xvzf appium-1.4.16.tar.gz
    $ rm appium-1.4.16.tar.gz
    $ mv appium-1.4.16 appium

Now, this stage is where the official Appium documentation gets confusing. According to the documentation, the next steps are to run the following commands to execute a collection of scripts that will set up Appium so that you can start it and test your app with it.

    $ cd appium;

Optional-->    $ ./reset.sh —android  --verbose

However, the documentation assumes that Android is already perfectly configured in your environment and ready for Appium. If that is the case, then you should not have any problem; otherwise, proceed with our instructions in the next section.

Installation Of Android

The first step is to install the latest Android SDK for Linux. Switch to your workspace folder and run the following commands:

For instance, I have downloaded previous version

    $ wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
    $ tar -xvzf android-sdk_r24.4.1-linux.tgz
    $ rm android-sdk_r24.4.1-linux.tgz

Then, create the ANDROID_HOME variable in .bashrc, and add tools and platforms_tools to the path:

   export ANDROID_HOME="$HOME/workspace/android-sdk-linux"
   export PATH="$PATH:$ANDROID_HOME/tools"
   export PATH="$PATH:$ANDROID_HOME/platform-tools"

Refresh your environment so that the new variables are recognized by your terminal:

    $ source .bashrc

Once the Android SDK is ready, the next step is to install the Android APIs that our apps will target in the tests. Note that Appium requires API level 20 or above in order to work properly.

    $ android list sdk --all

If you face any issues or errors , Follow the commands

    $ export ANDROID_HOME=~/android-sdk-linux
    export PATH=$ANDROID_HOME/tools:$PATH export PATH=$ANDROID_HOME/platform-tools:$PATH

Next step would be to run android to update and install API level packages

    $ android

Or

Go to tool folder and type the following command

    $ ./android

You could view the SDK manager and select and install for API

Now it’s time to run the appium server by using the following command

$  npm install -g appium
npm install wd

    $ node .
    or
    $ appium

Appium installation in linuxmint/ubuntu via terminal
Installation of appium in linux mint/ ubuntu


Here you could see the appium server running…

Now run command 
 
     $ android

Terminal will run and run the following command to run emulator for virtual device

    $ android avd
    Or
    $ ./android avd

You could see the AVD setting window,
Installed API will list and you can select and create for AVD settings 

Appium installation in linuxmint/ubuntu 64 bit- AVD manager
Installation of appium in linux mint AVD manager
Now you could see the emulator running and virtual device on screen. Here we go,

Appium installation in linux mint/ubuntu virtual device
Installation of appium in Linuxmint/ubuntu Virtual Device
Hope this helps

Post author by Blogger


5 comments:


  1. Good post.....I appreciate yor way of writing that make the blog attractive and make reader to hold longer to your blog.
    Regression Testing Services
    Functional Testing Services
    Performance Testing Services

    ReplyDelete
  2. Nice Blog, When I was read this blog, I learnt new things & it’s truly have well stuff related to developing technology, Thank you for sharing this blog. Need to learn software testing companies, please share. It is very useful who is looking for smart test automation platform

    ReplyDelete
  3. Nice and interesting post, I appreciate your hard work. keep it up…!!!Thanks for such useful information, It is true that now if you want to grow your business you will surely need the mobile app testing services for your business. But for that purpose everyone needs best mobile app testing companies.

    ReplyDelete
  4. I really like this post and would like to share a content to you free of cost. I have written an original and 100% unique article on the topic How To Build A Web Application With Node JS. The article is of length 1000 words if you agree to publish it here I can send it to you right now. Please reply me on technoligent007@gmail.com. I shall be looking forward to your reply soon. ...Thanks and regards

    ReplyDelete