• Articles / Artículos
  • Contact / Contacto
CODEANDO : our blog about technology

Installing OpenTSDB 2.3.0 on Ubuntu 16.04 LTS

28/7/2016

1 Comment

 
This article describes the steps required to install OpenTSDB 2.3.0 on Ubuntu 16.04 LTS

1- Download the latest stable version of OpenTSDB from:

https://github.com/OpenTSDB/opentsdb/releases

2- Install Java 8 on Ubuntu:

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installer


3- Configure Java Environment:

$ sudo apt-get install oracle-java7-set-default

4- Set JAVA_HOME:

$ sudo echo "export JAVA_HOME=\"/usr/lib/jvm/java-7-whatever/\"" >> ~/.bashrc

5- Install AUTORECONF

$ sudo apt-get install dh-autoreconf

6- Install gnuplot

$ sudo apt-get install gnuplot

7- Download hbase from:

http://apache.dattatec.com/hbase/stable/

And install:

tar -xzf hbase-1.1.5-bin.tar.gz

8- Edit config file conf/hbase-site.xml and set the following parameters:

<configuration>
<property>
    <name>hbase.rootdir</name>
    <value>file:///home/home/hbase</value>
</property>
<property>

    <name>hbase.zookeeper.property.dataDir</name>
    <value>/home/home/zookeeper</value>
</property>

</configuration>

​9- Run bin/start-hbase.sh (bin/stop-hbase.sh to stop)

10 - Install opentsdb package

sudo dpkg -i opentsdb*.deb

11- Verify settings in /etc/opentsdb/* (vi /etc/opentsdb/*)

12- Prepare environment:

env COMPRESSION=NONE HBASE_HOME=/home/home/Downloads/hbase-1.1.5

./usr/share/opentsdb/tools/create_table.sh


13 - Start opentsdb

(cd /etc/init.d/ && ./opentsdb start)

14 - If you need to stop openstdb:

(cd /etc/init.d/ && ./opentsdb stop)

Enjoy!


1 Comment

Connect to MySQL from a C program in QNX

28/7/2016

0 Comments

 
If you need to install MySQL on QNX see this post.

Once you started mysqld, you can connect to your databases from any program.
​
To test your connection and query from a C program in QNX, you can create a file (for example test_mysql.c) with the following content:
#include
#include
int main(int argc, char *argv[]) {
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
char *server = "localhost";
char *user = "root";
char *password = "12345"; /* Replace with your password */
char *database = "mysql";
conn = mysql_init(NULL);
/* Connect to mysql */
if (!mysql_real_connect(conn, server,
user, password, database, 0, NULL, 0)) {
fprintf(stderr, "%s\n", mysql_error(conn));
return 1;
}
/* run SQL query */
if (mysql_query(conn, "show tables")) {
fprintf(stderr, "%s\n", mysql_error(conn));
return 1;
}
res = mysql_use_result(conn);
/* output table name */
printf("MySQL Tables in mysql database:\n");
while ((row = mysql_fetch_row(res)) != NULL)
printf("%s \n", row[0]);
/* close connection */
mysql_free_result(res);
mysql_close(conn);
return 0;
}
​In order to compile this example and link to mysql libraries, run the following command:
gcc -o output $(mysql_config --cflags) test_mysql.c $(mysql_config --libs)
To execute the test application, run:
./output
Picture
0 Comments

How to access a Raspberry Pi on windows network by hostname

28/7/2016

1 Comment

 
To get our Raspberry Pi to show it's hostname on a windows network, we need to install samba and winbind on the Raspberry Pi. In order to do that, we ran the following commands:
sudo apt-get install samba
sudo apt-get install winbind
Then we edit /etc/nsswitch.conf to enable wins:
Change the line "hosts: files dns" to "hosts: files wins dns"
Finally we change the hostname and reboot:
edit /etc/hostname
sudo reboot
That's all!
1 Comment

Setup guide for Apache, PHP and MySQL on QNX 6.5 (NEW)

1/6/2016

0 Comments

 

​Requirements

This article describes the steps required to install Apache 2.2, PHP 5.3 and MySQL 5 on QNX 6.5 for i386 platform. 
The following packages are required for installation:
  • ap22-php53-5.3.8nb1
  • apache-2.2.19
  • apr-1.4.5
  • apr-util-1.3.12nb1
  • bootstrap
  • expat-2.0.1nb2
  • libiconv-1.14
  • libxml2-2.7.8nb3
  • mysql-client-5.1.58
  • mysql-server-5.1.58
  • perl-5.14.1
  • php-5.3.8
  • pkg_install-info-4.5nb3
  • readline-6.2
  • tcp_wrappers-7.6.1nb4
  • xmlcatmgr-2.2nb1
  • zlib-1.2.3 ​
These packages are part of pkgsrc under BSD License.
​

Create Groups and Users for MySQL & Apache 

​First of all, we need to create two new groups and users in QNX, one for MySQL and one for Apache: Before you begin, start photon if necessary and login as root.
Click the "Users" button under the "Configure" menu on the right side menu (shelf). 

Picture
Now press the "Advanced" button
​
Go to the "Groups" tab and click on "New Group", type mysql into "Group Name" and click Done.
Then click on "New Group" again to create another group and type www into "Group Name". Click "Done" to continue.
Now go to the "Users" tab and click on  "New User", type mysql into Full Name, Login ID, home directory and select "mysql" as the group. Select the checkbox "Prevent this user from logging in." and the click "Done".

Now click on  "New User" again to create the user for Apache. Type www into Full Name, Login ID, home directory and select "www" as the group. Select the checkbox "Prevent this user from logging in." and click "Done".
​Click "Done" again to close the "Advanced" window and click "Done" to close the "Users" Window.

Setup Network

Open Network Settings (Under "Configure" on the right side menu) to setup the network. 
Picture
Network settings must be in MANUAL MODE.
DHCP cannot be used for MySQL and Apache.
​
In the "Devices" tab, select "Manual" in the "Connection" combo box and enter the ip address and netmask that you have reserved for your QNX Server.
In our server they are:
IP: 10.0.2.15
Netmask 255.0.0.0
 
Now go to the "Network" tab and enter your host name for QNX Server, default gateway and name server.
In our server they are:
Host Name: qamp1
Default Gateway: 10.0.2.2
Name Servers: 10.0.2.2
 
Click "Done" when finished.
Important: DO NOT use localhost as the host name. You can use any host name EXCEPT localhost.

Once the network is configured in manual mode, add your hostname to /etc/hosts.
Open Text Editor (Under "Utilities" on the right side menu) and open the file /etc/hosts.
Add the following line, using your host name and ip address:
10.0.2.15            qamp1           
Go to "File", click "Save" and close Text Editor.
​
Important: leave a blank line at the end of the file. 
Picture
​NOTE: To test that hosts was correctly configured, you can open a terminal window and type "ping qamp1" (where qamp1 is your hostname). The QNX server should respond from the ip address that your entered in your hosts file.
​

Setup QNX Environment

​We need to setup PATH and CS_LIBPATH in /etc/profile and /etc/rc.d/rc.local.
To setup these variables, open a Terminal Window (Under Utilities on the right side menu) and run the following commands:
​
echo "\nexport PATH=\$PATH:/usr/pkg/bin:usr/pkg/sbin" >> /etc/profile
echo "setconf CS_LIBPATH \$(getconf CS_LIBPATH):/usr/pkg/lib" >> /etc/rc.d/rc.local

​Now REBOOT QNX to proceed.

​Install Apache, PHP and MySQL packages

Download all the packages required (See the "Requirements" section of this document for the download link) into a directory in your QNX server, and install them as follows.
In our server, the download directory is /root/packages. You should replace this path with your own path when executing these commands.

Open a Terminal window (Under "Utilities" on the right side menu) and untar bootstrap.tar.gz under the root directory (/), using the following command:
​
tar -xzf /root/packages/bootstrap.tar.gz -C /

​​Now,  cd to the root directory (/):
​
cd /
​
​And run the following command to install Apache, PHP and MySQL:
​
pkg_add /root/packages/apache-2.2.19.tgz
pkg_add /root/packages/ap22-php53-5.3.8nb1.tgz
pkg_add /root/packages/mysql-server-5.1.58.tgz
 

Prepare Apache and MySQL to start automatically

To prepare Apache and MySQL to start automatically when QNX boots run the following commands:
​
cp /usr/pkg/share/examples/rc.d/apache /etc/rc.d/
echo "/etc/rc.d/apache start" >> /etc/rc.d/rc.local
cp /usr/pkg/share/examples/rc.d/mysqld /etc/rc.d
echo "/etc/rc.d/mysqld" >> /etc/rc.d/rc.local
 

Configure Apache and PHP

Edit apache config file according to the Apache help descriptions. In order to do this, open the file /usr/pkg/etc/httpd/httpd.conf using Text Editor and change:​
​
Listen 10.0.2.15:80 # <- CHANGE THIS LINE TO YOUR IP ADDRESS CONFIGURED BEFORE
ServerName 10.0.2.15 # (use your IP address) <- ADD THIS LINE IF IT DOES NOT EXIST
​
Also add the following lines to the appropriate sections to enable PHP 5 module:
In the "Dynamic Shared Object (DSO) Support" section add:​
​
LoadModule php5_module lib/httpd/mod_php5.so

In the "AddHandler" section add:
​
​AddHandler application/x-httpd-php .php
​
Finally verify the following values (they should already be set to these values):
​
ServerRoot "/usr/pkg"
User www
Group www
ServerAdmin you@example.com
DocumentRoot "/usr/pkg/share/httpd/htdocs"
​
Go to "File", click "Save" and close Text Editor.
​

Configure MySQL

Run the following commands to prepare MySQL:
​
mysql_install_db --user=root
chown -R mysql:mysql /var/ mysql
​
​Finally, change the root password for mysql (use your desired password instead of 12345). In order to do this, first we need to start mysqld.

. /etc/rc.d/mysqld &
cd /usr/pkg/bin
./mysqladmin -u root -p password "12345"
./mysqladmin -h qamp1 -u root -p password "12345"
​
​NOTE: When the system asks to "Enter password" it is asking for the current password. As there is no existing password, just press the Return (Enter) key.
​
The installation is finished. You can reboot your QNX server. Apache and MySQL will start automatically when system boots.​
​
Check this post if you an example of how to connect to MySQL from a C program.

​Start / Stop Apache and MySQL Manually

If you need to start apache manually, run:
. /etc/rc.d/apache start
​To stop apache, run:
. /etc/rc.d/apache stop
To start MySQL manually, type:
. /etc/rc.d/mysqld &
To kill MySQL manually, type:
slay mysqld
0 Comments

Apache 2.2 and PHP 5 on QNX 6.5 Step-by-step Installation

29/5/2013

2 Comments

 
Important: there is a new version of this article here..

__________________________

STEP 1: PREPARE ENVIRONMENT


Creating www Group

echo "www:x:199:" >> /etc/group

Creating www User

echo "www:x:199:199:www:/www:/bin/sh" >> /etc/passwd

Setup PATH in /etc/profile

echo "export PATH=\$PATH:/usr/pkg/bin:usr/pkg/sbin" >> /etc/profile

Setup CS_LIBPATH in /etc/rc.d/rc.local

echo "setconf CS_LIBPATH \$(getconf CS_LIBPATH):/usr/pkg/lib" >> /etc/rc.d/rc.local

Download pkgsrc project. To get pkgsrc, write this line into a single line: 

svn checkout --username <username> http://community.qnx.com/svn/repos/pkgsrc/HEAD_650

(username is your registrated email address in qnx.com, you can register for free) 

Now your environment is ready for install. Reboot QNX and go to STEP 2.

STEP 2: INSTALL

Bootstraping pkgsrc
cd /HEAD_650
(cd pkgsrc/bootstrap && ./bootstrap --workdir HEAD_650
/pkgsrc/bootstrap/work)


Preparing Apache 2.2
cd /HEAD_650/pkgsrc/www/apache22
bmake distinfo
bmake clean


Compiling and Linking and Installing Apache 2.2
cd /HEAD_650/pkgsrc
(cd www/apache22 && /usr/pkg/bin/bmake install)


Configuring dinamic .so modules in Apache 2.2
cd /HEAD_650/pkgsrc/www/apache22/work/httpd-2.2.23/
./configure --enable-so


Installing Apache 2.2.
cd /HEAD_650/pkgsrc
(cd www/apache22 && /usr/pkg/bin/bmake install)


Installing PHP5 Module for Apache 2.2
cd /HEAD_650/pkgsrc
(cd www/ap-php && bmake install)


Preparing Apache 2.2 to start when QNX boots
cp /usr/pkg/share/examples/rc.d/apache /etc/rc.d/apache
echo "/etc/rc.d/apache start" >> /etc/rc.d/rc.local


Installation Finished. Now go to STEP 3

STEP 3: APACHE CONFIG FILE AND NETWORK SETTINGS

Before starting Apache remember to configure your network.

Network settings must be in MANUAL MODE. DHCP is not available,

For example:
IP: 10.0.2.99 (or any proper IP address)
Netmask 255.255.255.0
Host Name: qnx650 (or any proper name EXCEPT localhost)
Name Servers: 10.0.2.1
Default Gateway: 10.0.2.1


Once the network is configured to manual mode, add your hostname to /etc/hosts
For example:
10.0.2.99 qnx650
(where 10.0.2.99 is a fixed IP Address and qnx650 is our hostname)


STEP 4: APACHE CONFIG FILES

Edit apache config file according to the Apache22 help descriptions: 

The Important contents of Apache2.2 config file: /usr/pkg/etc/httpd/httpd.conf include:
ServerRoot "/usr/pkg" 
Listen 10.0.2.99:80 
User www 
Group www 
ServerAdmin you@example.com
ServerName 
10.0.2.99 (use your localhost IP address) 
DocumentRoot "/usr/pkg/share/httpd/htdocs"



Also add the following lines to the appropiate sections to enable PHP 5 module:

In the "Dynamic Shared Object (DSO) Support" section add:
LoadModule php5_module lib/httpd/mod_php5.so

In the "AddHandler" section add:
AddHandler application/x-httpd-php .php

STEP 5: READY TO GO!

To start apache manually, enter:
. /etc/rc.d/apache start

To stop apache enter:
. /etc/rc.d/apache stop

You should be able to access http://your-ip/index.html

In case of any fault, please see the error log file in /var/log/httpd/error_log

You can contact me here.
2 Comments
    Picture

    Authors

    We are the development team at INNVAS SRL, a nice group of engineers and IT specialists with solid experience in software development on different platforms, most of them custom developments, for different areas and industries. Our experience includes real time systems (automation and control), SCADA systems, drivers and protocols, GIS, image processing, simulation and optimization, web portals, mobile applications, embedded solutions, among others. 
    We enjoy working on different hardware and software platforms (Windows, Linux, QNX, Android, iOS , Raspberry Pi) and technologies (.NET, Java, HTML5,  C / C ++, Python, Matlab, CUDA, among others).

    Categories

    All
    Apache
    Linux
    MySQL
    Netbios
    Networking
    OpenTSDB
    PHP
    QNX
    Raspberry Pi
    Samba
    Ubuntu

    Archives

    July 2016
    June 2016
    May 2013

    Ads

    Consulting

    Picture
    Need support in QNX ?

    Apache on QNX
    Open SSL on QNX
    MySQL on QNX
    PHP 5 on QNX
    Open LDAP on QNX

    Contact us at:


    INNVAS SRL
    Montevideo
    Uruguay
    ​www.innvas.com
    info@innvas.com


    QNX is a trademark of
    ​QNX Software Systems
Powered by Create your own unique website with customizable templates.