Installing Sencha Touch 2 on Linux


I initially thought that setting up Sencha Touch 2 to work under Linux would be pretty straightforward but it turned out to be a little cumbersome to install, what follows is a rundown of the steps that it took.



Download Sencha SDK Tools


Download the installer from http://www.sencha.com/products/sdk-tools/download/ , it comes in 32-bit and 64-bit.


$ uname -m
x86_64 # 64-bit



Download Sencha Touch 2


Download it from http://www.sencha.com/products/sdk-tools/download/ , there are two options, an open source version (GPLv3) and a free commercial version.

Extract Sencha Touch 2 package


# move and extract sencha touch 2
$ mv ~/downloads/sencha-touch-2.0.1.1-commercial.zip dev/sandbox/sencha/
$ cd dev/sandbox/sencha
$ unzip sencha-touch-2.0.1.1


Install Sencha SDK Tools


Sencha does not currently provide any of the installation methods usually found in the Linux world, it offers instead an executable file that starts an installation wizard, I prefer to execute it in text mode to have a better chance of spotting any errors that might occur.


  $ cd ~/downloads
  $ chmod +x SenchaSDKTools-2.0.0-beta3-linux.run
  $ sudo su
  $ ./SenchaSDKTools-2.0.0-beta3-linux.run --mode text
  $ exit # become regular user again


Open a new terminal and check if the environment variables were set, if not add them.


$ echo $PATH
# look for
# :/opt/SenchaSDKTools-2.0.0-beta3/:/opt/SenchaSDKTools-2.0.0-beta3/bin

$ echo $SENCHA_SDK_TOOLS_2_0_0_BETA3 
# should print
#/opt/SenchaSDKTools-2.0.0-beta3




$ vim ~/.bashrc
# file content:
# ..
# PATH=$PATH:/opt/SenchaSDKTools-2.0.0-beta3/:/opt/SenchaSDKTools-2.0.0-beta3/bin
# SENCHA_SDK_TOOLS_2_0_0_BETA3=/opt/SenchaSDKTools-2.0.0-beta3



Note
bash reads ~/.bashrc each time an interactive -not login- shell is started


Install Node



$ cd ~/downloads
$ wget http://nodejs.org/dist/v0.8.2/node-v0.8.2.tar.gz
$ tar -xvzf node-v0.8.2.tar.gz
$ cd node-v0.8.2
$ ./configure
$ make # takes a while..
$ sudo make install
# write down node modules directory
# /usr/local/lib/node_modules


Change Sencha's default start script


$ sudo su
$ cp /opt/SenchaSDKTools-2.0.0-beta3/sencha /opt/SenchaSDKTools-2.0.0-beta3/sencha.old
$ vim /opt/SenchaSDKTools-2.0.0-beta3/sencha
$ cat /opt/SenchaSDKTools-2.0.0-beta3/sencha
#!/bin/sh
export NODE_PATH=/usr/local/lib/node_modules
export SENCHA_SDK_TOOLS_2_0_0_BETA3=/opt/SenchaSDKTools-2.0.0-beta3
DIR=$(dirname $(which $0))
node $DIR/sencha.js $*



Generate a new application to test the environment


$ sencha
Sencha Command v2.0.0 Beta 3
Copyright (c) 2012 Sencha Inc.

usage: sencha COMMAND [ARGS]

The available commands are:
  buildbuild a JSB project
   create bootstrapdatagenerate boostrap data
   create jsbgenerate a minimal JSB project followsr an app
   create localegenerate a template locale file from source
   create manifestgenerate classes manifest
   packagepackage your Touch web app into a native bundle
   slice themeslice a custom theeme's images for IE

See 'sencha help COMMAND' for more information on a specific command.




# execute sencha inside sencha-touch directory
$ cd ~/dev/sandbox/sencha/sencha-touch-2.0.1.1
$ sencha generate app HelloWorld ../HelloWorld
path.existsSync is now called `fs.existsSync`.
path.existsSync is now called `fs.existsSync`.
[INFO] Created file /home/fede/Dev/vairix/sandbox/senchatouch2/HelloWorld/.senchasdk
[INFO] Created file /home/fede/Dev/vairix/sandbox/senchatouch2/HelloWorld/index.html
[INFO] Created file /home/fede/Dev/vairix/sandbox/senchatouch2/HelloWorld/app.js
[INFO] Created file /home/fede/Dev/vairix/sandbox/senchatouch2/HelloWorld/packager.json
...


Our final step is to open the browser and load the application


$ cd ~/dev/sandbox/sencha
$ vim ./config.ru
$ cat config.ru 
# serve files in current directory
dir = Dir.pwd
puts "--- APP START ---"
puts ">> serving: #{dir}"
run Rack::Directory.new("#{dir}"



 
$ cd ~/dev/sandbox/sencha
$ rackup config.ru 
--- APP START ---
>> serving: /home/fede/dev/sandbox/sencha
>> Thin web server (v1.4.1 codename Chromeo)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:9292, CTRL+C to stop



Point your browser to http://localhost:9292/HelloWorld/index.html



Now we can continue to work our way through the Sencha documentation http://docs.sencha.com/touch/2-0/

Notes
OS: Fedora Core 15, x86_64
Browser: Chrome


References



How to contact us

Our Location

DireccionArismendi 1420 Of. 102 Telefono(+598) 2409 15 66 Mailinfo@vairix.com

Follow us


Want to contact us?