Tuesday, December 8, 2015

Introduction to IPTABLES Tutorial

My notes on iptables commands.

Firewall tutorial for iptables
Contents:

  1. View
  2. Append rules
  3. Insert a rule
  4. Delete a rule
  5. Default Policy
  6. Saving the rules

The problem with devices and applications not being able to access the server is usually due to configuration of the iptables firewall. This can be configured on an application or through command line terminal.


Monday, December 7, 2015

Raspberry Jam Kuala Lumpur 2015 - Kids at the Workshop

The Raspberry Jam Kuala Lumpur 2015 saw quite a huge turnout. This first Jam for Malaysia was on 5 Dec 2015 at Asia Pacific University (APU), Kuala Lumpur.

There were concurrent (parallel) sessions of free talks and hands-on workshop. Since the workshop was hands-on, participants who purchase/register for the workshop online included the price of hardware. This consist of;

Raspberry Pi 2 model B
Power adapter
Raspberry case (red & white)
Micro SD card (8GB)

There were ample parking along the road side as the huge parking lot was full. Probably due to a fun run being held at the same venue. A goody pack was given out during registration. At the first talk, the presenter from APU introduced a work in progress of a robot that uses raspberry pi (RP) and adruino.
Tele-presence and Tour Guide Robot using RP by APU
Its off to the workshop after that talk. The workshop title was "Getting your Raspberry Pi up and running and setting up for File sharing" and was conducted by Raspberry Pi Penang.

The number of participants was double the online registrations, as they allow walk-in registrations. There was another kid at the front row but Martha was nervous, not in a mood to talk to anyone. A quick check of our hardware and its found that the micro SD card doesn't come with an adapter. The laptops and PCs only had the standard SD card readers. Thanks to Fazli (I don't think he recognise me) for sharing his SD adapter.

Setting up the RP
Done fixing RP and casing


Following the instructions, she completed the installation of Raspbian (from MS Windows), updating and upgrading the Raspbian Jessie. Installed and configured Samba for file sharing. Didn't get a chance to test the file sharing as the instructor took more time than the allocated 1 hour session.



Martha updating Raspbian

While she was waiting for the others to complete the steps, Martha found Minecraft in the installed Rasbian. Tried to find the keys and explored Minecraft world. Its the first time for her to setup and she had an enjoyable learning experience.

Generally steps to create a file sharing server with the RP during the workshop;

Step 1: Install Raspbian

Download latest Rasbian image, currently its Jessie from www.raspberrypi.org and create the image on the SD card. Insert the blank SD card into the computer used to write the image. For MS Windows users, the software is called Win32DiskImager-0.9.5-binary and for Linux, the software is pre-installed called "dd".

Step 2: Update and Upgrade Raspbian

Take the SD card and install in the RP (make sure power is off). Plug-in all the cables (Monitor, keyboard, mouse, network) and turn on RP power. Watch the monitor screen as it boots.

Configure the settings from the "preferences" menu and reboot.

Open the terminal and type;
sudo apt-get update
sudo apt-get upgrade -y

Reboot.

Additionally I would suggest;
1. Change the default pi user password
2. Add additional tools, at the terminal type;
sudo apt-get install raspberrypi-ui-mods

Step 3: Install Samba

At the terminal type:

sudo apt-get install samba samba-common-bin

Assign access of the default pi user for file sharing. When prompted for password, enter the pi user password.

sudo smbpasswd -a pi

Restart samba

sudo /etc/init.d/samba restart

Done.

From a computer in the same network, use the network share tools to access the RP via IP address. You will need to enter the pi user password.

Example:

On a MS Windows, open the Windows Explorer and click on the network. type in the hostname of the Raspberry Pi. Select the option to Connect as a different credentials, since the Windows is likely to be logged in with a user other than the name "pi".


On MS Windows 8.1, the samba share needs to be map manually. Open a command prompt and type the following;

net use windowsdir shareserver\sharepath /USER:username thepassword

Example
net use Z:  \\10.1.1.103\pihome /USER:pi thepassword

Wednesday, October 28, 2015

Check Disk Usage on Windows with WinDirStat

Running out of disk space and wondering where it all went to? Windows users can have their disk summarised and a treemap generated through the use of WinDirStat.

This Windows programme is a port from an open source application called KDirStat written for KDE running on Linux/BSD/Unix type operating system. In the spirit of open source, One characteristics of being open source is having others extend or provide their own version of the software. For example, altWinDirStat from from WinDirStat with some updates. Its a matter of seeing who can stand the test of time in the open source world.

Wouldn't you agree that it opens up more possibilities and increase access to better software?


In the diagram above, there are 3 distinct areas in the default layout after scanning of a directory. Which by the way can include a network share. 

In the area for Directory Summary, users can choose to access the sub-directories details and even delete directories. Click on a directory and its highlighted in the treemap. In the File extension summary, just a click and the disk view of that extension is shown. Click on the Coloured Treemap and the item is highlighted in directory and file extension summary areas, immediately.

Its a nifty and fast tool. 

Tuesday, September 29, 2015

Tutorial on Multiple Fragments in Activity

Here is an example to describe in codes how to create Fragment classes with Android Studio 1.4.

I wanted to be able to receive Button events and switch the Fragment depending on user selection. Need to be careful with rendering the layouts lower than API 23, as it did not generate the Design view properly.

Android Fragments in an Activity



Friday, September 25, 2015

Notes on the Sunshine app

Reviewed back lessons over last few months.

"Notes on Udacity Developing Android Apps"

Biggest problem was not passing the correct object to the ViewList. It kept giving a null error upon running the application.

The logging system was truly helpful for errors at runtime.


Upgrade to Android Studio 1.4 RC2

That was fast, RC1 was out in early September 2015 and shortly after that RC2 is released on 23 September. View the upgrade installation for Canary channel, RC1 at "Upgrade to Android Studio 1.4 RC1". Upgrade was smooth and without any problem recompiling target API 21 apk.

RC2 provide bug fixes and includes;

  • Update to the Theme Editor (using style.xml files)
  • In performance monitors it includes GPU and network profiler
  • The Vector Asset Wizard creates Android XML vector drawables, icons, from SVG files
  • Improved Android permission checks 
It is stable in terms of use and will surely provide a good experience for first time Android developers. With Android Studio 1.4, education institutions will surely be able to introduce Android Programming to a more advanced level, similar to how C++ was widely used.

Here are steps to upgrade RC2 from RC1;

Step 1: Check for updates

Start Android Studio and in the menu choose Help-> Check for Updates...
Click "Update and Restart". Ensure you have administrator rights to update the application or accept the request to update if such a request window appears.


Step 2: Restart Android Studio

This would be automatic if all went well. Verify RC2 is installed in the About.


Done.






Monday, September 21, 2015

Upgrade to Android Studio 1.4 RC1

Just saw there is an update to Android Studio to version 1.4RC1.

In existing Android Studio 1.1, update can be done easily with these steps;

(Tested on MS Windows 8.1)

Step 1: Update Android Studio

Open existing Android Studio (in this case its version 1.1) and click "Check", which is at the bottom of the Android Studio start page.


Step 2: Update configuration

After it searches for update on the Internet, click "Update and Restart"


After it has installed the update, choose to import my settings from a previous version (keep existing configuration).


Step 3: Update Plugin and other components

Platform and Plugin Updates, click "update". Click "Update now".



Click "Exit Studio and launch SDK Manager".
Choose "Install .. packages..." button. Choose ".


In Choose Packages to Install, choose "Accept License and click Install. My case above, it took 2.9GB of downloads.

Start Android Studio and complete rest of installation.

See an example of creating an Android Studio Project.

Troubleshooting:

Problem 1. After creating a new project, there is an Gradle sync error:

Warning:The project encoding (windows-1252) does not match the encoding specified in the Gradle build files (UTF-8). This can lead to serious bugs.

Solution: Upon new installation, the default IDE encoding uses Windows-1252 instead of UTF-8 as in project files. Change this from Android Studio menu File-> Settings-> Editor->File Encodings

Change the default encoding for project files to UTF-8. Click OK. Restart Android Studio and create a new project.


Problem 2: Rendering Problems.


Build the project.


Done.


Sunday, September 20, 2015

Samsung S5 Wifi not connecting automatically

Samsung S5 is a powerful Android mobile phone. In May 2015, the S5 received an update to Android 5.0 but has since had a problem with the wifi.


The smart network switch automatically switches from wifi when it gets weak, to mobile data. Usually, to save on mobile data its a good idea to turn it off. This way, even if wifi is weak it still stays on until signal is lost.

It can connect to wifi. However even after choosing smart wifi, it does not automatically reconnect when returning to the most wifi access point (AP) that it has saved the password. I say most because it can connect to open public wifi like Starbucks.

Previously, before the upgrade it was able to connect without problem.

Even resetting to factory did not help. Probably had something to do with me restoring my backup.

Here is how I got it working, clearing the S5 phone cache.

Step 1: Power off the S5

Step 2: At same time hold down following keys;
Volume up, power on/off, Home.

When it vibrates or see the galaxy start screen, release the power on/off.

Step 3: clear cache and restart
Use the volume key to select clear cache. Press the power button.

Once it says cache cleared, use volume button to select restart of phone and press power button.

Done.

Thursday, September 17, 2015

Howto Screenshot Desktop

The print screen key or "PrtSc" can be used to create a screenshot of the desktop and windows. This will activate gnome-screenshot from the gnome-utils package.

Gnome-utils contain;

  • dictionary
  • disk usage analyser
  • screenshot tool
  • search 


By default on a server setup of Centos Linux 6, the screenshot is not installed. This can be done easily.

Step 1: Install gnome-screenshot

As a admin role (root) at the terminal, type
# yum install gnome-utils

Step 2: Take screenshot of desktop or active windows

Screenshot of desktop
Press the print screen key or "PrtSc"



Screenshot of active window
Hold "Alt" key and press the print screen key or "PrtSc"

Edit the graphics name and press Save.

Delayed screenshot
This is useful if the screenshot can only be taken without user intervention.

  1. On desktop menu click Applications-> Accessories-> Take Screenshot
  2. Choose which area of desktop to take screenshot and enter the number of seconds for "Grab after a delay of ___ seconds.
  3. Click "Take Screenshot"



Done.





Paint program on Centos

Linux comes with open source software (OSS) for graphics editing, such as XPaint, GIMP and Tuxpaint. Vector editing can be done with Inkscape and xfig.

XPaint is a light weight program to do simple graphics editing and carries the GPL license.

Currently maintained by Jean-Pierre Demailly, but as stated in the "About" message, not to send bug reports.

Installation of XPaint (currently version 2.9.9.4) on Centos Linux 6.2 64 bits is quite straight forward.

Dependencies;

  • Xawd3d 1.5
  • gv 3.7.1
  • linXaw3dXft 1.6.2b
  • netpbm 10.47.05
  • psutils 1.17


Step 1: Install XPaint

Login with admin role (root) and type

# yum install xpaint
type y and press Enter

Step 2: Start XPaint

On the Centos Linux desktop, choose Applications-> Graphics ->XPaint


Click "Canvas" button and choose "New Canvas"




Tips on initial use of XPaint


Open an image to edit
File-> Open image...

Drawing lines, rectangle, circles, polygon
Click the Tool icon and choose the drawing tool.

Done.

Tuesday, September 15, 2015

Howto Install WordPress 4 on Centos Linux 6


WordPress in a PHP based content management system licensed under GPL v2. Since it has been around for a long time, there are many forums, blogs and video to help users and developers.

Functions:
  1. Create web pages without needing to know HTML
  2. Provide blog tools
  3. Themes to quickly create different look and feel
  4. Plugins to extend its functionalities
  5. Mobile ready site
  6. Provide multiple authors to manage their own contents.

WordPress 4.3 has just been released and here is a guide to install on Centos 6.4

Pre-installation recommendation
PHP 5.4 (works on 5.3.3)
MySQL 5.5 (works on 5.1)
mod_rewrite in Apache module
Bind-utils (works on 9.8.2)

Step 1: Obtain WordPress

Open a terminal and download the WordPress installation file.

$ wget --no-check-certificate https://wordpress.org/latest.tar.gz
$ tar xvzf latest.tar.gz
$ ls wordpress

Copy the whole folder to the web server directory. Example if the web server runs with permission for user apache.
$ mkdir /var/www/html/wp1
$ cp -r wordpress/* /var/www/html/wp1
$ chown -R apache.apache /var/www/html/wp1

Read the readme.html file with a web browser.


Step 2: Configure MySQL and create wp-config.php

Create the database wp1 in MySQL
$ mysql -u root -p
> create database wp1;
> /q

Open a web browser with URL to the installed page of WordPress.

http://servername/wp/
or
http://servername/wp/wp-admin/install

Fill the fields and click Submit.


Click Run the Install.

Fill the 5-minutes WordPress Install information
  • Site Title
  • Username
  • Password
  • Confirm password
  • Your E-mail
  • Privacy
Click Install WordPress.

Click Log In.

Enter the admin username and password.

View the admin user's dashboard.

Restart apache web server.
$ sudo service httpd restart

Step 3: View the site

Enter in the web browser URL
http://servername/wp1



The default left panel list;
  1. Site name
  2. Search tool
  3. Recent post
  4. Recent comments
  5. Archives
  6. Categories
  7. Meta (Site Admin, Logout, Entries RSS, Comments RSS, WordPress.org)

Troubleshoot

Problem 1: When choosing to add a new theme, the following error is displayed.
"unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums."

Solution: Ensure the server can connect to https://downloads.wordpress.org site. Restart Apache web server.

Problem 2: Pages are blank, and there are no error or warning messages.

Solution: Turn on the debug by changing the value false to true in /var/www/html/wp1/wp-config.php

define('WP_DEBUG', true);

Done.

Wednesday, September 9, 2015

Tutorial on Linux Shell Fundamentals

Most Linux admin and developers on Linux will benefit from knowing some shell scripting skills.

In most Linux, the shell is run on BASH. There are a few other shells out there but the default is BASH which I will introduce the basics here.

Gain access to a Linux terminal or also known as the command line terminal (CLI) and follow along these topics.

Fundamentals 1 (START)
  1. Getting started
  2. Creating a script
  3. Comments, printout and local strings
  4. Builtin variables
  5. Backup a folder
  6. Separate variable names and back slash
  7. Linux command in scripts
  8. Function basics
  9. Script arguments
  10. Accepting user input
  11. Simple if/else decision
Fundamentals 2 (START)
  1. The while loop
  2. Array variables
  3. Read from a file
  4. The for loop
  5. The until loop
  6. Find plain text files
  7. Quick menu input with select
  8. The case to create a menu
  9. Formatted printing with printf
  10. Print a line full length of screen


--

Monday, September 7, 2015

Display Dnsmasq status on Nagios

This article is an example of adding a custom process status in Nagios here the server (10.10.2.1) is separate from the host (10.10.2.2). In Nagios reference there are lots of option for configurations.

Dnsmasq as a light weight alternative to named, will appear in the linux process. E.g. when issuing the command ps -C dnsmasq

Pre-configuration checklist:

Ensure NRPE is installed and working on the host.

Step 1: Update nrpe.cfg with following;

# vi /etc/nagios/nrpe.cfg

Add the line
command[check_dnsmasq]=/usr/lib64/nagios/plugins/check_procs -C dnsmasq -w 5 -c 10

Save and test the new nrpe command;
# /usr/lib64/nagios/plugins/check_procs -C dnsmasq -w 5 -c 10
PROCS OK: 1 process with command name 'dnsmasq'


Restart nrpe
#service nrpe restart

Step 2: Add this service to the Nagios host

# vi /etc/nagios/servers/server1.cfg

define service{
use generic-service
host_name lbserver2
service_description Dnsmasq
check_command check_nrpe!check_dnsmasq
}

Save and restart Nagios


These 2 step works for any services that the linux ps command can detect.

Install Nagiosgraph on Centos 6

This article is on how to install Nagiosgraph on Centos.

Nagiosgraph is a plugin to Nagios and it provides graphical display of information captured by Nagios.

Installation environment:
Centos 6.5 x86_64
Nagios version 3.5.1-1
Pre-requisite perl modules: rrd tool 1.4+, Nagios::Config, GD, Object

Step 1: Prepare Nagiosgraph 1.5 for installation

# wget http://downloads.sourceforge.net/project/nagiosgraph/nagiosgraph/1.5.2/nagiosgraph-1.5.2.tar.gz
#  tar xvzf nagiosgraph-1.5.2.tar.gz
#  cd nagiosgraph-1.5.2
# less README

Install Perl module if havent installed.
# ./install.pl --check-prereq
# yum install perl-rrdtool perl-GD perl-Nagios-Plugin
# cpan Nagios::Config
If there are many modules not installed, just press Enter (Yes), unless you have other config.

Check all dependencies are met.
# ./install.pl --check-prereq


Step 2: Install Nagiosgraph source

# install.pl --prefix=/usr/share/nagiosgraph
Follow the instructions online. I choose the default values where nagios and httpd (apache) files were not updated automatically.

Step 3: Post configuration

If in step 2, it was chosen to not modify apache and nagios, then following must be configured. All instructions are printed at end of the installation of Step 3.

nagios.cfg
In the nagios configuration file (nagios.cfg),
    add/change these lines:
# vi /etc/nagios/nagios.cfg

Edit value for
process_performance_data=1

Add following lines
# process nagios performance data using nagiosgraph
service_perfdata_file=/tmp/perfdata.log
service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=30
service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph

template.cfg
# vi /etc/nagios/objects/templates.cfg
define service {
        name    graphed-service
        action_url      /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$
        register 0
}

command.cfg
# vi /etc/nagios/objects/commands.cfg

# command to process nagios performance data for nagiosgraph
define command {
  command_name process-service-perfdata-for-nagiosgraph
  command_line /usr/share/nagiosgraph/bin/insert.pl
}

Host service files. E.g. for servername server1, append to show the graph service
vi  /etc/nagios/servers/server1.cfg
define service{
use generic-service,graphed-service
host_name applicationser1
service_description Current Load
check_command check_nrpe!check_load
}

* In the apache configuration file (httpd.conf),
    add this line:

include /usr/share/nagiosgraph/etc/nagiosgraph-apache.conf

Restart nagios to start data collection:
# service nagios restart

Restart apache to enable display of graphs:
# service httpd restart
Nagioschart: Chart icon in Nagios page

Nagioschart: Configuration page

Troubleshoot

Check graphs are displaying data, open a web browser and enter the URL
http://serversite/nagiosgraph/cgi-bin/show.cgi

Check RRD is collecting data with the command
# ls /usr/share/nagiosgraph/var/rrd

Check the nagios configuration files for errors
# /usr/sbin/nagios -v /etc/nagios/nagios.cfg

To enable graph links and mouseovers, see README sections:
       Displaying Per-Service and Per-Host Graph Icons and Links
       Displaying Graphs in Nagios Mouseovers

Thursday, September 3, 2015

Howto add Dropbox as Backup to Kodi - OSMC on Raspberry Pi 2

This is generally for backup purpose.

Step 1: Create API in dropbox

Login to dropbox.com or create an account if you haven't.
Go to the URL https://www.dropbox.com/developers/apps
Click "Create"
Choose "Dropbox API app"
In Can you app be limited to its own folder, choose "Yes"
App Name: "Kodi backup"
Click check box for "I agree to...conditions"
Click "Create app"

Write down the values for
App key and App secret.


Step 2: Configure Dropbox in Kodi

Open the Kodi screen and click Programs ->Get more...
Choose "Backup"-> "Install"
Click "Configure", in tab "General", change Remote path type to "Dropbox".
Enter values for Dropbox key
and Dropbox Secret
Click "ok"
Click "Launch"


Step 3: Start the backup

AT THE KODI SCREEN

A popup window "XBMC Backup - Mode" will appear, choose "Backup"
DO NOT CLICK "OK"

Step 4: Locate dropbox authorization
AT THE SSH TERMINAL
Using SSH tool like Putty, login to the OSMC Raspberry Pi and look for the dropbox authorization key in the file kodi.log.
Type
$ grep dropbox /home/osmc/.kodi/temp/kodi.log


AT THE PC WEB BROWSER
Copy that URL to a web browser and when the API request appears, click "Allow"

Step 4: Start backup

Return back to the screen in Step 3 and click "Ok"

Backup should begin.

Check dropbox for a new folder with the backup contents in
Apps/Kodi backup

Done.

Other stuff to do with Dropbox is to stream your home videos.
**To access files on dropbox**
Open the Kodi screen and click Programs ->Get more...
Choose Dbmc (Dropbox add-on)
Click "Install"

Once Dbmc has completed installation, click Dbmc (Dropbox add-on)
Click "Configure"

Tuesday, September 1, 2015

Setup Centos as Nagios clients

Centos Linux servers can be monitored by Nagios remotely. This typically provides information of ping response, services running and system information.

The setup is fairly straight forward assuming Nagios server IP is 10.10.2.1 and uses port 5666.

Step 1: Install Nagios plugins and NRPE.

Read the NRPE documentation.
Login to the nagios host, e.g. 10.10.2.2
# yum install -y nagios-plugins-all nrpe net-snmp

Edit /etc/nagios/nrpe.cfg with these 2 values

server_address=127.0.0.1
or the nagios IP

allowed_hosts=10.10.2.1
or the nagios IP

Example to enable monitoring of http is to have this line;
command[check_http]=/usr/lib64/nagios/plugins/check_http -I 10.10.2.2 -w 5 -c 10

Step 2: Start NRPE

# service nrpe start
# chkconfig nrpe on

Test with
 /usr/lib64/nagios/plugins/check_nrpe -H 10.10.2.2 -c check_load

Step 3: Allow monitoring through firewall

E.g. if using IPTABLES, make it as a rule at the top
# iptables -I INPUT 2 -p tcp -m tcp --dport 5666 -j ACCEPT
# iptables -L |grep 5666
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:5666

# service iptables save

Step 4: Configure Nagios server

Enable the services in the Nagios server, in this example 10.10.2.1
# vi /etc/nagios/servers/server1.cfg

define service{
use generic-service,graphed-service
host_name server1
service_description Http
check_command check_nrpe!check_http!-w 5 -c 10
}


Post installation

Check the service is running
# netstat -anlp |grep nrpe
tcp        0      0 10.240.1.14:5666            0.0.0.0:*                   LISTEN      12467/nrpe
unix  2      [ ]         DGRAM                    14250318 12467/nrpe

From the nagios server, test with 
/usr/lib64/nagios/plugins/check_nrpe -H 10.10.2.2

this should return the NRPE version.

/usr/lib64/nagios/plugins/check_nrpe -H 10.10.2.2 -c check_http

this should return the http check at the host.


Self reminder: TODO check_postgres source github

Thursday, August 27, 2015

Raspberry Pi: Starting Kodi

Kodi is an application that provides the interface to manage video, music, pictures and liveTV. Its the default media centre on OSMC.

If you have not installed OSMC, see previous post on getting started.

Step 1: Adding source for video add-ons from tvaddons.ag
Start Kodi, choose System ->Setting ->File Manager
Click Add Source and enter location as
http://fusion.tvaddons.ag

Enter a name: Fusion

Click "OK"

Step 2: Install plugins for streaming movies and TV shows

Choose 1Channel and Genesis

Remainder of installation reference is from here.

Tuesday, August 25, 2015

Access VirtualBox VM via SSH

A virtual machine provides lots of space for development, troubleshooting and learning. Sometimes its required to remotely access the virtual machine guest using SSH from the host. Virtualbox allow users to setup so many different type of virtual machines known as the guest.

The machine installed with VirtualBox is known as the host. In this example, the host is a MS Windows 7 computer with virtual machine guest OS being Centos Linux 6. SSH client such as Putty is run on the host computer and will attempt to connect to the virtual machine. This will also allow multiple guest OS to SSH between one another.

Step 1: Configure VirtualBox networking

Shutdown all guest virtual machines. Open VirtualBox Manager, click on the virtual machine to be configured and choose Settings ->Network. There should already be an existing network for access to the Internet. Nothing needs to be changed if you can already access the Internet from the guest OS.

Guest virtual machine default networking with access to Internet

Choose one of the unused Adapter (example Adapter 2) and configure the settings:
Attached to: Host-only Adapter
Name: VirtualBox Host-Only Ethernet Adapter



On the MS Windows, VirtualBox has already setup its own network 192.168.56.1 as can be seen below. The other IP is the dynamic IP used by host computer to access the Internet.



Step 2: Configure a static IP on guest OS.

Start the guest OS and login. Open a terminal as root and the new network device has been identified but we need to configure the IP to match that of the VirtualBox network 192.168.56.x.


In the case above, VirtualBox has already configured network device eth0 to access Internet. Check eth1 with

# ethtool eth1

The default eth1 if we started that network, it would use DHCP but we want a static IP so that we know the IP for SSH. We now need to create/edit eth1

vi /etc/sysconfig/network-scripts/ifcfg-eth1

Add/modify following lines;

DEVICE="eth1"
BOOTPROTO=static
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR=192.168.56.10
NETMASK=255.255.255.0
IPV6INIT=no
NAME="System eth1"

Start the networking for eth1 and check that eth1 is using the new IP. 

Step 3: Restart the guest virtual machine.

Reboot the guest OS and test access to Internet and ability to SSH into the guest OSS from the host computer as can be seen below.

Guest VM network for Internet and SSH

The network routing is shown below.
Guest virtual machine network routing




Tuesday, August 18, 2015

Getting started with LibreOffice 5

There are quite a number of options for word processors, spreadsheets and slide presentation these days and many of it with the option for being online. LibreOffice 5 is available to users on popular platforms like Mac, Linux and MS Windows. This makes it easier for implementation across any type of systems for any organisation.

LibreOffice can help save lots within an organisation while having access to a top class application that is continuously being kept updated. The document formats will ensure it can be preserved for a long time. The installer file can be downloaded from libreoffice.org site and the offline help can also be downloaded separately.

LibreOffice 5 Installer

The minimum installation system pre-requisites recommended is a Pentium III,  512MB RAM which should be fine for almost all computers. However, is does require a considerable 1.5GB disk space and display of 1024x768 resolution with 256 colours.

Java Runtime Environment (JRE) is needed if using some features in Base.

LibreOffice 5 provides the following;

  • Writer document
  • Calc spreadsheet
  • Impress presentation
  • Draw drawing
  • Math formula
  • Base database
LibreOffice 5 Main Screen
The 3 notable features (see release notes for more);

AutoCorrect
Default unicode 6 support which is included in its AutoCorrect. E.g. if you type :camera: it displays the camera. Here are a few more;



Compatibility with MS Office
Improved import and export of MS Word, Excel and Powerpoint documents. This means, users can work with these docs without much hassle. More controls for compatibility is found in the Tools ->Option ->Load/Save

Improvements in import of annotated text ranges from Word documents. Better support for RTF document formats.

Entire row/column references
Ever wanted to specify an entire row/column? Now this can be done with "A:A" and "1:1".

Monday, August 17, 2015

Howto Install PHP and Postgresql on Fedora Core

Fedore Core 22 came out in May 2015 with quite a number of changes that even the usual Linux guy had trouble getting around.

This included
  • The dfn package manager to replace Yum
  • Gnome 3.16 to provide a new desktop look
  • The firewall-cmd to replace iptables firewall
  • Retreive systemd notices with journalctl

For basic PHP web application development with Postgresql database it was pretty straight forward after learning these new commands. This will also server as an introduction to the new commands mentioned above. Apache was already installed.


Step 1. Install PHP

Open a command terminal and type
$ sudo dnf install php php-xmlrpc php-xml php-mbstring

It installed the following;
php-common-5.6.11-2.fc22.x86_64
php-pgsql-5.6.11-2.fc22.x86_64
php-xmlrpc-5.6.11-2.fc22.x86_64
php-cli-5.6.11-2.fc22.x86_64
php-xml-5.6.11-2.fc22.x86_64
php-mbstring-5.6.11-2.fc22.x86_64
php-pdo-5.6.11-2.fc22.x86_64
php-pecl-jsonc-1.3.7-1.fc22.x86_64
php-5.6.11-2.fc22.x86_64

Restart web server

$ sudo systemctl restart httpd.service

If there are errors, open the log and inspect.

$sudo journalctl -xe

== Check that Apache is permitted through the Firewall==
firewall-cmd --permanent --zone=FedoraWorkstation --add-service=http
firewall-cmd --permanent --zone=FedoraWorstation --add-service=https
firewall-cmd --reload

In this case, my default-zone was "FedoraWorkstation" and not "public".

Step 2: Install Postgresql database


$ sudo dnf install postgresql-server postgresql

It installed the following;
postgresql-9.4.4-1.fc22.x86_64
postgresql-libs-9.4.4-1.fc22.x86_64
postgresql-server-9.4.4-1.fc22.x86_64

$ postgresql-setup --initdb

Edit /var/lib/pgsql/data/pg_hba_conf

local   all             all                         trust
host    all             all             127.0.0.1/32            trust

$ sudo -u postgres psql
postgres=> alter user postgres password 'password';
postgres=> create user tboxmy createdb createuser password
'somepassword';
postgres=> create database tboxmy owner tboxmy;
postgres=> \q

$ psql
tboxmy=# \dn
tboxmy=# \q

Then run some test with the PHP and database.

Other useful tools.

Export database from existing Postgresql

$ pg_dump -U username -h localhost -W databasename > output.text.sql

Restore the sql dump file to a database

$ psql --set ON_ERROR_STOP=on -U username -h localhost -W databasename < output.text.sql

Friday, August 7, 2015

What is OpenStack? Some Figures and statistics.

Cloud computing is still gaining some interest in public and private organisations. Many large organisations have shown interest and support for OpenStack as a software to deliver cloud platforms. With the source code to OpenStack freely accessible and welcomes community participation via the Foundation, it has also grown into an operating system of its own.

Recognition of the companies contributing to some parts of OpenStack include;
Those who are keen, should look up these developers to see how they contribute to the project.

There are some statistics that may be of interest at Openstack Activity Dashboard. Number are just numbers, but it makes lots of nice charts and puts some perspective of the project.

Some figures as of 6th Aug 2015;
  • Code developers; 3,971
  • Code submitters; 4,171
  • Launchpad participation; 8,881
  • IRC participants; 20,302
  • Ask participants; 4,035





Contribution by companies like HP, IBM and Red Hat;




There is a Malaysian OpenStack meetup on 13th Aug 2015 (Event), and its free.

Blog Archive