Installing development tools on Tizen OS 2.3.1

December 16, 2015    Article    1133 words    6 mins read

Check out the date on this baby!!

This content was originally published a while ago and could be quite outdated.

This article assumes you have internet access on your Tizen device, an OpenSSH daemon running and you can connect to it via a SSH client. If you don’t, please read the other articles in the series. If you do, read below on how to install various development tools on your RD-PQ device running Tizen 2.3.1 (and possibly, 2.3, though not tested).

Erlang/OTP

Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang’s runtime system has built-in support for concurrency, distribution and fault tolerance. Installing Erlang is as easy as one, two, three.

$ wget http://erlang.org/download/otp_src_18.2.1.tar.gz
$ tar -xzf otp_src_18.2.1.tar.gz
$ ./configure --prefix=/usr/local
$ make
$ make install

Ruby

You can install Ruby 1.9.3 from the latest arm-wayland Tizen snapshot repo (2.5Mb), use the direct link or, in case the links change with new versions, just browse the repository for the Ruby rpm package. If you need any dependencies, install them from the same repo, skipping the original 2.3.1 repository (if you want to be safe, you can install the Ruby rpm package that is available in the master repo, but be aware the version is older. After you have the package, install it to the phone via sdb, uploading it via scp or just curl/wget it from the SSH console.

$ wget https://download.tizen.org/snapshots/tizen/mobile/latest/repos/arm-wayland/packages/armv7l/ruby-1.9.3.p448-6.19.armv7l.rpm
$ rpm -Uvh ruby-1.9.3.p448-6.19.armv7l.rpm

Perl

Although you will have a version of Perl installed, it won’t be the latest available for Tizen, so again, you can opt between the 2.3.1 repository with Perl 5.12.1 (13Mb) and the snapshot repo with Perl 5.20.0 (8Mb). Whatever package you decide on, install it using the same option as Ruby, after taking care of any needed dependencies.

$ wget https://download.tizen.org/snapshots/tizen/mobile/latest/repos/arm-wayland/packages/armv7l/perl-5.20.0-7.28.armv7l.rpm
$ rpm -Uvh perl-5.20.0-7.28.armv7l.rpm

Python

You will probably have a version of Python installed but in order to upgrade it, choose between the two repositories Tizen 2.3.1 with Python 2.7.1 (193Kb) or latest Tizen snapshot with Python 2.7.8 (4.3Mb) but you’ll need to install all the Python package rpms in the selected repo.

$ wget https://download.tizen.org/snapshots/tizen/mobile/latest/repos/arm-wayland/packages/armv7l/python-2.7.8-7.18.armv7l.rpm
$ rpm -Uvh python-2.7.8-7.18.armv7l.rpm

Java

Download Java SE Embedded from the Oracle website (you will need to create an account or login into an existing one prior to downloading the archive). Make sure you download the ARMv5/ARMv6/ARMv7 Linux - SoftFP ABI, Little Endian version. After download, extract the archive and install Java somewhere on your device, preferably /usr/lib/java.

$ tar -xzf ejdk-8u65-linux-arm-sflt.tar.gz
$ ejdk1.8.0_65/bin/jrecreate.sh --dest /usr/lib/java

Make sure you add JAVA_HOME to your /etc/profile file, like this:

$ JAVA_HOME=/usr/lib/java
$ export JAVA_HOME

Go

Installing Go 1.5 on Tizen is very easy, though you need a Go 1.4 compiler for it. We can adapt the tutorial for Raspberry Pi written by Dave Cheney for our Tizen device.

$ cd /opt/usr
$ curl http://dave.cheney.net/paste/go-linux-arm-bootstrap-c788a8e.tbz | tar xj
$ curl https://storage.googleapis.com/golang/go1.5.src.tar.gz | tar xz
$ cd /opt/usr/go/src
$ env GOROOT_BOOTSTRAP=/opt/usr/go-linux-arm-bootstrap ./make.bash

The process should take about 5 minutes as opposed to more than half an hour on a Raspberry Pi, proving the power under the hood of the Tizen RD-PQ device. Once compiled, Go should be available under /opt/usr/go, you can remove the /opt/usr/go-linux-arm-bootstrap directory to save space. Make sure you add it to your path:

export PATH=$PATH:/opt/usr/go/bin

MySQL

I’ve chosen to install MySQL over MariaDB, you can do the same with the latter with very little changes, the packages should compile by default provided you have enough swap space, MySQL compilation takes craploads of RAM (and swap space). Compiling MySQL requires cmake, diffutils (in addition to the default development tools, binutils, gcc and required libs). Make sure you download the rpms from your favorite Tizen repo and install them using the already well-known methods. Download the package, extract, configure using cmake, compile and install.

$ mkdir /opt/usr/src
$ mkdir /opt/usr/mysql
$ ln -s /opt/usr/mysql /usr/mysql
$ cd /opt/usr/src
$ wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10.tar.gz
$ tar -xzvf mysql-5.7.10.tar.gz
$ cd mysql-5.7.10
$ cmake . -DCMAKE_INSTALL_PREFIX=/usr/mysql -DWITH_BOOST=/usr/lib/boost -DDOWNLOAD_BOOST=1
$ make
$ make install
$ groupadd mysql
$ useradd -r -g mysql -s /bin/false mysql
$ chown -R mysql:mysql /usr/mysql
$ /usr/mysql/bin/mysqld --initialize --user=mysql
$ /usr/mysql/bin/mysql_ssl_rsa_setup
$ cp support-files/mysql.server /etc/init.d/mysqld

After this, you’ll have MySQL installed in /opt/usr/mysql symlinked to /usr/mysql. Start the server with this command:

$ /etc/init.d/mysql start

Apache httpd

Compiling Apache httpd for ARMv7l is pretty straightforward, download the latest apache source archive, download apr and apr-util, configure, compile everything and install.

$ mkdir /opt/usr/apache
$ ln -s /opt/usr/apache /usr/apache
$ cd /opt/usr/src
$ wget https://archive.apache.org/dist/httpd/httpd-2.4.18.tar.gz
$ tar -xzvf httpd/httpd-2.4.18.tar.gz
$ cd httpd/httpd-2.4.18/srclib
$ wget http://apache.javapipe.com/apr/apr-1.5.2.tar.gz
$ tar -xzvf apr-1.5.2.tar.gz
$ mv apr-1.5.2 apr
$ wget http://apache.javapipe.com/apr/apr-util-1.5.4.tar.gz
$ tar -xzvf apr-util-1.5.4.tar.gz
$ mv apr-util-1.5.4 apr-util
$ cd apr
$ ./configure --prefix=/usr
$ make
$ make install
$ cd ../apr-util/
$ ./configure --prefix=/usr --with-apr=/usr
$ make
$ make install
$ cd ../../
$ LDFLAGS="-lpthread"
$ ./configure --prefix=/usr/apache --with-pcre=/usr --with-apr=/usr --with-apr-util=/usr --enable-so --enable-cgi
$ make
$ make install

Apache will be installed in /opt/usr/apache symlinked to /usr/apache. Symlink apachectl to /etc/init.d if you want to use it old-style, and you can start the httpd server using that symlink or the apachectl script:

$ ln -s /usr/apache/bin/apachectl /etc/init.d/httpd
$ /etc/init.d/httpd start

PostgreSQL

PostgreSQL is very easy to compile and install, and strangely, is way lighter on RAM than MySQL, so it might be an alternative to it, depending on what you need.

$ mkdir /opt/usr/postgres
$ ln -s /opt/usr/postgres/usr/postgres
$ cd /opt/usr/src
$ wget https://ftp.postgresql.org/pub/source/v9.4.5/postgresql-9.4.5.tar.gz
$  tar -xzvf postgresql-9.4.5.tar.gz
$ cd postgresql-9.4.5
$ ./configure --prefix=/usr/postgres
$ make
$ make install
$ groupadd postgres
$ useradd -r -g postgres -s /bin/sh postgres
$ mkdir /usr/postgres/data
$ chown -R postgres:postgres /usr/postgres/data
$ su - postgres
$ /usr/postgres/bin/initdb -D /usr/postgres/data
$ /usr/postgres/bin/pg_ctl -D /usr/postgres/data start
$ /usr/postgres/bin/createdb test
$ cp contrib/start-scripts/linux /etc/init.d/postgres

PostgreSQL should now be installed in /opt/usr/postgres, symlinked to /usr/postgres and you can start the server by issuing:

$ /etc/init.d/postgres start

PHP

Installing PHP is a bit more complex depending on the modules you need because that will require installing additional dependencies. For example, adding the GD module requires the libgd library compiled, which in turn requires libpng, jpeg, libtiff and libXpm. I’ll show you how to compile basic support with mbstring, mysqli and pgsql modules.

$ wget http://fr2.php.net/get/php-7.0.0.tar.gz/from/this/mirror -O php-7.0.0.tar.gz
$ tar -xzvf php-7.0.0.tar.gz
$ cd php-7.0.0
$ ./configure --with-apxs2=/usr/apache/bin/apxs --with-mysqli=/usr/mysql/bin/mysql_config --enable-mbstring --with-pgsql=/usr/postgres --enable-mysqli --enable-opcache=no --prefix=/usr
$ make
$ make install

In conclusion, since we have a Linux flavour installed on our Tizen RD-PQ device, we can compile and install all kinds of software and turn the device into a full-featured development server. Stay tuned for the next chapters, where we’ll learn how to administer our new development server, tips and tricks regarding the Tizen platform.

Later edit

  • added Java.
  • added Erlang/OTP.