How to install Sencha touch in your Linux machine

This tutorial is about how to install Sencha Touch in Linux. Sencha is a framework which gives you ability to develop cross platform mobile application which runs inside of phone browser as native application. For instance, imagine after you develop your application via Sencha Touch then in the next step with using Apache Cordova you can generate package for a particular platform (assume Android or iOS).  So you do not need to learn each programming language separately, you just learn one langauge (in Sencha case is Java script) and code once, then run your application in various platforms. Sencha uses MVC model and based on short experience I had with Sencha, it is very powerful in implementing MVC architecture. In brief each Sencha application uses four components which are View, Controller, Model and Store, you can find more about it on these links.

Architecting Your App in Ext JS 4, Part 1

Architecting Your App in Ext JS 4, Part 2

Architecting Your App in Ext JS 4, Part 3

Architecting Your App in Ext JS 4, Part 4

Sencha website provides very good and in details tutorial about how to install its framework in various platforms however, I would rather to write my own version of tutorial which is going to be shorter and hopefully more useful than official one. Note that the following tutorial is the result of mixing three tutorials which respectively are official Sencha tutorial, Jcob Nelson tutorial, and Vairix tutorial. Most of parts though are from Jacob Nelson tutorial. In addition, I have installed Sencha Touch on Debian 7.3 (Wheezy) and Ubuntu 12.04 and Ubuntu 12.10 successfully without any problem and I guess that installation process more or less should the same in other Linux box.

Now lets proceed with the installation process.

First of all download and extract Sencha package from following link address.

http://www.sencha.com/products/touch/download/

The next step is download Sencha Cmd according to your operating system architecture (identify architecture in Linux with typing ‘uname -r’ in Terminal) from this link.
Now you should install Sencha Cmd. To do that you need open Terminal and cd to the folder you extracted Sencha Cmd file. Then type the following command in Terminal,

$ ./SenchaCmd-3.0.2.288-linux.run

After completing installation process, Sencha Touch is ready to use.
Now it is time to create the first application. Sencha is powerful enough that allows you to prepare workspace (project) with one simple command. So for creating your first application run the following command,

$ sencha generate app YourAppName /Path/Of/Your/Application/Folder

Very well, the workspace is ready now the last step is to setup the server in order to see the application. Luckily Sencha Touch is delivered with one lightweight server which you can set it up very easily with one command. Assume that the name of the application is ‘FirstApp’ and the path is ‘/home/kasra/FirstApp’. Now I want to run the application into the browser, in order to do so just need to copy below line to Terminal,

 /Path/To/Sencha/Cmd/Sencha -port [Portnumber] start -map /Path/To/Your/Application

For example,

 /home/kasra/Sencha/Framework/bin/Sencha/Cmd/4.0.4.84/sencha -port 8085 start -map /home/kasra/Sencha/Apps/FirstApp/

Now open your browser and type

 localhost:PORTNUMBER

For example,

 localhost:8085

You should be able to see the default hello World! application. In order to make it easy and avoid retyping the long command each time, you can add the following line to your .bashrc file like following,

 alias senchaserver=". /home/kasra/Sencha/Framework/bin/Sencha/Cmd/4.0.4.84/sencha fs web -port 8085 start -map /home/kasra/Sencha/Apps/TestingSencha/"

With adding the above line to .bashrc file, if you want to run sever, you just need to type ‘senchaserver’ in command line.
For Sencha coding IDE, you have limited options. One is Eclipse for Java script which is free but has not word prediction and for me it is quite acceptable. The next option which I highly recommend is WebStorm which is free up to 30 days. It is very powerful and has complete word prediction which is very useful. And lastly is Netbeans which is categorized between Webstorm and Eclipse from my point of view.
For designing UI you can download and use Senhca Architect from this link.
For more information please refer to following pages,
Sencha Touch documentation.
Jacob Nelson tutorial on Sencha installation
Vairix tutorial on Sencha installation

send your idea and information to kasra@madadipouya.com

The following two tabs change content below.

Leave a Reply