Build and install nodejs, npm and cordova on Linux (debian)

A quick reminder on how to install nodejs, npm and cordova from scratch…

to complete the installation make sure you have sufficient rights to create flles in /usr/lib and /usr/bin (use sudo or su otherwise)

NodeJS

nodejs is a python based http engine

download nodejs sources

./configure
make
make install
NPM

npm is a packet manager (like pear in PHP world)

get sources then

./configure
make install

The make is made by dummies and does not detect already built files so use « make install » directly to avoid building file twice.

Cordova

install cordova using the npm package manager:

npm install -g cordova

Javascript and the big integer imprecision… or the WTF with my mysql ids ?

Ever tried to send mysql id over json ? just some small things to know before you try…

open a javascript console and type the following:

first try a stupid echo :

 23278053098520648
 > 23278053098520650

hum ok echo is not working correctly

Let’s try with a number object:

 i=Number(23278053098520648);
 > 23278053098520650

again… ok it is a too big number, let see what is the max:

 i=Number.MAX_VALUE
 > 1.7976931348623157e+308

wow javascript can handle really big number… but with an imprecision of 16 digits and of course mysql ids are 17 digits… so you have to handle mysql ids as string.

Running i386 application in a debian 7 running amd64 architecture and the skype example

For instance, Skype that they themselves entitled multi-arch does not install correctly on debian amd64 if i386 arch is not enabled. This a quick « how to » make skype runs.

First check your main architecture:

 $ dpkg --print-architecture
 amd64

Display other accepted architecture:

 $ dpkg --print-foreign-architectures
 (it should display nothing)

Add the i386 architecture

 $ dpkg --add-architecture i386

now you can see the :i386 packages in your apt-get search

Download the .deb of the skype application

ok you know where to go…

Install GDebi

This application is particularly useful when you have a .deb that have lots of missing dependencies. it will install everything at once.

 $ apt-get install gdebi

Run GDebi on the .deb file

it will install the package and the dependencies

Enjoy !

Another method was to install the ia32lib that provides a bridge from 32bits to 64bits arch but it won’t help regarding the architecture dependies warning.

coffeescript on eclipse juno

! install Xtext:

* use the add new software rom’ ‘the help menu:

url: http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/

* select the version 2.1.x (the latest 2.4.x is ot’ ‘compatible)

* restart eclipse once completed

! install CoffeeScript pluggin

* use the add new software from the help menu:

url: ttp:/’/’coffeescript-editor.eclipselabs.org.codespot.com/hg/

* select CoffeeScript pluggin

rsync on windows server

Reminder to establish rsync connection from a windows server to a remote server

install cwrsync Or CYGWING

Use this link for CWRSYNC

Or install Cygwin and select RSYNC, SSH et openSSL package

Setup a DOS script:
C:
cd c:/Program Files (x86)/cwRsync/bin
rsync.exe -aivz --rsh="./ssh.exe -i C:/Users/bob/.ssh/id_rsa -p 8888" "/windows/backup/" "bob@backup.server.com:/var/backup"

the rsh command allow you to customize the connection particularly to change the default port (the -p option) and to point the right identity file (private rsa key) (the -i option)

for basic explanations please refer to rsync.net

Configurer selinux et Mysql sur une base redhat

Au passage les commandes pour un changement de la basedir et résolution du problème de read/write dans mysql.log lorsque selinux est mal configuré

Tout d’abord avoir les outils indispensables:
  • Vérifier que vous avez tout ce qu’il faut:
rpm -q checkpolicy libselinux libselinux-python libselinux-utils libsemanage libsepol policycoreutils selinux-policy selinux-policy-minimum selinux-policy-mls selinux-policy-strict selinux-policy-targeted setroubleshoot setroubleshoot-server setroubleshoot-plugins setools
  • Pour les fan de gui :
rpm -q mcstrans setools-gui policycoreutils-gui
Réparer :
  • Arrêter Mysql
  • Définir le context de mysql au cas ou vous auriez supprimé ou changé le répertoire par défaut:
semanage fcontext -a -t mysqld_db_t "/chemin/mysql(/.*)?"
  • Rétablir le context:
restorecon -Rv /chemin/mysql
les outils d’analyse pour ceux qui veulent comprendre avec de lancer des commandes dans la nature…:
  • Afficher les rejets du jour et une explication :
ausearch -m avc -ts today | audit2why
  • Afficher les derniers rejets et une ce qu’il faudrait faire pour y remedier (pas toujours tres parlant):
ausearch -m avc -ts recent| audit2allow
En vrac:
  • Forcer le context sur un répertoire et son contenu sans passer par le semanage: (ici donner les droits à  httpd)
chcon -t httpd_sys_content_t -R /chemin/
  • lister les modules selinux installé (il donne les contextes)
semodule -l
  • voir les contextes des fichiers:
ls -Z
  • donner le droit sur un port spécial (ici pour httpd sur le 8081):
semanage port -a -t http_port_t -p tcp 8081