Linux tutorials and more...
Get Started with Android application development using Linux and Android SDK
The purpose of this article is to get a reader started with an Android application development using an open source Android SDK on a Linux system. The main focus of the following lines will be concentrated on installation of Java based Eclipse IDE, Android SDK and Android Developer Tool (ADT) a special Eclipse plug-in on Ubuntu and Fedora Linux systems. The installation instructions will be followed by a simple Hello Android program example to test an entire installation.
Since the combination of Eclipse and Android SDK provides a powerful Android Virtual Device emulator, a reader does not need to own any Android device to get started with the Android application development.
Introduction
Android is a mobile operating system initially developed by Android Inc and in year 2005 it was acquired by Google Inc. In year 2007 The Open Handset Alliance was formed, which includes Google and other 33 companies. The aim of The Open Handset Alliance is to bring innovation into mobile devices and thus giving consumers a much better user experience.
At the same time, mobile application developers are given an opportunity to freely participate in Android application development using alliance's Android Software Development Kit ( SDK ) which is released through Google's developer website. Developers are therefore, free to develop any Android application they see fit and are free to market it to all Android mobile phone owners. This article will consist of four main sections:
Â
- Installation of Eclipse IDE, Oracle Java JRE, Android SDK and Android Developer Tool (ADT) a special Eclipse plug-in
- Setting up Eclipse IDE with Android SDK and Android Developer Tool
- Writing a simple Android Application: "Hello Android"
- Testing Android application using Android Virtual Device
Â
Â
Prerequisites
For this article, I used Ubuntu 10.04 Lucid Lynx LTS ( Long-term support ) and Fedora 14. However, all instructions below should work for any other recent Linux distribution. Therefore, requirements are very simple:
- Working Linux System
- Internet Connection
Installation
The only major difference in the whole installation procedure of Android Development environment between Ubuntu and Fedora is in installation of Eclipse ( rpm vs deb ) and Oracle Java JRE.
Â
Add a commentRead more: Get Started with Android application development using Linux and Android SDK
Collection of basic Linux Firewall iptables rules
The following iptables rules should serve as a template for creating more customized iptables rules to fit desired network environment.
This article is NOT a comprehensive guide to iptables. If you are new to iptables please familiarize your self with netfilter / iptables before you use some of the iptables rules described below. This is especially recommended if you are working on a production server.
Before applying any rule make sure that you know what you are doing.
Rule: iptables to reject all outgoing network connections
The second line of the rules only allows current outgoing and established connection. This is very useful when you are login to the server vie ssh or telnet
# iptables -F OUTPUT # iptables -A OUTPUT -m state \ --state ESTABLISHED -j ACCEPT # iptables -A OUTPUT -j REJECT
Rule: iptables to reject all incoming network connections
The second line of the rules only allows current outgoing and established connection. This is very useful when you are login to the server vie ssh or telnet
# iptables -F INPUT # iptables -A INPUT -m state \ --state ESTABLISHED -j ACCEPT # iptables -A INPUT -j REJECT
Rule: iptables to reject all network connections
NOTE: This rule will drop and block all network connection whether incoming or outgoing. More importantly this will also include current ongoing established connections
# iptables -F # iptables -A INPUT -j REJECT # iptables -A OUTPUT -j REJECT # iptables -A FORWARD -j REJECT
Rule: iptables to drop incoming ping requests
This iptables rule will DROP all incoming ping requests.
Add a commentRead more: Collection of basic Linux Firewall iptables rules
Where to get linux
Where to get a Linux ? This question comes to mind to any first time "wishing to try Linux" user. Linux operating system is for free and can be obtained by anyone with an Internet connection. This article is written for complete beginners and the aim of this article is to attempt to answer some fundamental questions such us "Where to get Linux" or Which Linux to get". Download links will be provided at the end of this article in "Where to get linux" section.
NOTE:
If you are already using Linux when reading this text this basic "where to get linux" article is surly not for you as it is intended for a very Linux beginners.
Package management
Before we answer a question on where to get linux, we need to understand two main differences between all Linux distributions. Any Linux operating system belongs to one of the following two groups:
- RPM ( Redhat Package Mangement )
- DEB ( Debian Package Management )
Package management defines the rules on how the software ( packages )Â will be installed on any particular system. Beyond this all Linux systems are very similar and if a user get comfortable with a command line administration and usage of Linux distribution with RPM, he would be very much like home when using DEB based Linux distribution.
Add a commentBurn your music files from any format to audio CD using command line
Do you need a GUI to be able to create and burn your favorite music tracks on a standard audio CD which then can be used by any CD player? The answer is no ! GUI is for losers ! Right? :-) Let's see how hard it is to burn an audio CD with a cdrecord linux command. What is needed:
- CD burner - audio files in mp3, ogg, acc or wav format
- cdrecord
- ffmpeg
- normalize-audio
Install all prerequisites:
# apt-get install cdrecord ffmpeg normalize-audio libavcodec52
In our scenario we have a selection of MP3 and OGG files from different albums stored in a single directory called burn:
ls ~/burn/ 03.Come As You Are.mp3 07 - Crystal Mountain.mp3 09-We Who Are Not as Others.mp3 Lemuria_-_05_-_Lemuria.ogg
Since all files are taken from a different locations / albums the chance that they all have a different volume settings is very high. To make them volume uniform we use a normalize-audio command. Normalize normally works only on wav files so first we need to convert all files to wav.
NOTE: if names of your files contain a space use this command to replace space with _:
$ for f in *; do mv "$f" `echo $f | tr ' ' '_'`; done
Convert all files to wav format:
$ for i in $( ls ); do ffmpeg -i $i $i.wav; doneAdd a comment
Read more: Burn your music files from any format to audio CD using command line
Stay time synchronized with Internet Time server and ntpd
If you wish to synchronize your system time with a world time servers all you need to do is to install a ntpdate utility and issue a following command as a root user and you are done:
# ntpdate pool.ntp.org
The above command will synchronize your system time / clock. However, if you want to stay synchronized you need to do little bit more work. The work involves installation and configuration of NTPD daemon. NTPD uses NTP ( network time protocol ) to access a specified time server over the internet. Later, it will keep your system time synchronized without your further intervention.
First we need to install NTPD service. On Debian or Ubuntu this step is easy as:
# apt-get install ntp
In most cases your NTP Daemon will be configured out of the box and installation of ntp package is all you would ever need to do to keep your system time synchronized with internet standard time servers. However, it is good to check certain settings whether they are in place before we leave a system time in hands of NTP daemon. The absolute bare configuration is:
driftfile - this file is used by a ntp daemon to store a clock drift / synchronization error
Add a commentRead more: Stay time synchronized with Internet Time server and ntpd
Using Debian package archive as a configuration tool
Introduction
How often do you need to install your favorite Linux distribution in a single year either virtually or using real hardware? How frequently it happens that you just want to test new release of certain Linux distribution so you install it on different partition or simply virtually using your current system as a host. How often do you need to deploy a server which is a complete clone of the one you configured yesterday. The installation part of any Linux system today is a very straightforward process. Nonetheless, the hardest and the most tedious part comes with a fine tuning, customization and configuration of your system's services as well as your own user environment. You can simply copy your custom system configuration files from one system to another but engaging in this concept this task can become quite disorganized, time consuming and most importantly error-prone.
In this article, we are going to take a different approach which involves a creation of a Debian package archive containing all required custom user and configuration files. First part of this article describes a rather simple way on how to create a Debian package archive containing all custom files followed by its installation. In the second part, we will look at the way on how to create our own very basic Debian Repository and use it to deploy a simple website including Apache webserver installation and configuration on a freshly installed Linux system.
Part1
In this section, we create and install simple Debian package. The package will accommodate some sample user data to serve as an example.
Creating a Debian Package
It took you a while to configure your desktop to have it the way it best suits your needs and convenience. In your custom environment, you may for example include some bash scripts, create several aliases using .bashrc file or changed default behavior of a vim text editor by altering .vimrc file. Furthermore, you may also have customized numerous system configuration files such as /etc/network/interfaces and so on. All this hard work can be saved within a Debian package and installed and removed from any system with a single dpkg command. As a first step we need to create a bare minimum skeleton for a Debian package. This is a fairly simple task as it only involves a single DEBIAN/control file. So let us start by creating a directory named "myenv". This directory will hold all data for our own version 1.0 Debian package.
$ mkdir myenv
In the next step, we need to create a control file:
$ cd myenv $ mkdir DEBIAN $ vi DEBIAN/control
Â
Add a commentRead more: Using Debian package archive as a configuration tool
Linux authentication login with USB device
This article describes a method how to use a USB memory device as an authentication token to log in into a Linux system instead of traditional password. This can be accomplished by use of Pluggable Authentication Modules ( PAM ) and some sort of USB storage device such as USB memory stick of Mobile phone with SD card attached.
This authentication technique can be also further expanded into Two-Factor authentication where two authentication methods involving USB token and one-time password can be merged together to produce a greater security. This article is written using Ubuntu Linux systems. However, users of other Linux distributions should be able to follow below described steps to achieve the same results.
Pluggable Authentication modules Installation
Pluggable Authentication modules are available on most of Linux system in a form of pre-compiled packages accessible from a relevant repository. First we need to install required packages for PAM USB authentication:
$ sudo apt-get install pamusb-tools libpam-usb
Add USB device to PAM configuration
In the next step, we will add a USB device which we intend to use with PAM authentication. This can be done with a pamusb-conf command or manually by editing /etc/pamusb.conf file. Using pamusb-conf command greatly reduces time and difficulty of this operation. Connect your USB device and execute a following command with a name of your USB device as an argument. The name can be anything you wish. In this case, we use "my-usb-stick" :
$ sudo pamusb-conf --add-device my-usb-stick Please select the device you wish to add. * Using "Verbatim STORE N GO (Verbatim_STORE_N_GO_07A10D0894492625-0:0)" (only option) Which volume would you like to use for storing data ? 0) /dev/sdb2 (UUID: A842-0654) 1) /dev/sdb1 (UUID: CAAF-0882) [0-1]: 0 Name : my-usb-stick Vendor : Verbatim Model : STORE N GO Serial : Verbatim_STORE_N_GO_07A10D0894492625-0:0 UUID : A842-0654 Save to /etc/pamusb.conf ? [Y/n] Y Done.
The pamusb-conf is smart enough to discover our USB device, including multiple partitions. After completing this step a block of XML code had been added into /etc/pamusb.conf configuration file to define our USB device.
<pre> <device id="my-usb-stick"> <vendor> Verbatim </vendor> <model> STORE N GO </model> <serial> Verbatim_STORE_N_GO_07A10D0894492625-0:0 </serial> <volume_uuid> A842-0654 </volume_uuid> </device> </pre>Add a comment
Ubuntu Linux with Google chrome browser download install and usage guide
Introduction
This article describes installation and usage of Google Chrome web browser in conjunction with Ubuntu Linux. The article also touches on some privacy concerns in regard to Google Chrome and its restrictive license. Although, Google Chrome web browser is a multi-platform application this article will be focused solely on Google Chrome and i386 Ubuntu Linux.
What is Google Chrome
In short, a Google Chrome is a Internet web browser developed by Google, Inc .. Google Chrome is based on an open source project Chromium. On 2nd September 2008 Google chrome was released for a MS Windows operating system only and later further binaries were compiled for MAC OS as well as for Linux operating system. There are multiple privacy concerns when it comes to a Google Chrome browser such as what data are collected during the Internet browsing and using omnibox to search the Internet.
Google Chrome Privacy Concerns
Google Chrome's source code is free software but binaries which a Google chrome is distributed with are under restrictive BSD license.When it comes to a Linux operating system a Google Chrome browser comes in the form of a pre-compiled DEB or RPM packages. Installation of Google Chrome from a DEB or RPM packages requires a root password which is used to modify some crucial system configuration files such as an apt repository list as it is in case of the Ubuntu Linux System. Installation of Google Chrome browser on the Ubuntu Linux operating system also involves an injection of Google, Inc. Linux Package Signing Key into an apt key ring which gives Google a chance to install virtually anything into user's Linux operating system via google-chrome-stable package since no additional involvement by system administrator when updating this package is required. However, as shown later in this article a system administrator has an option to black list Google Chrome package from automatic updates. Surely, when it comes to a privacy Google Chrome is no match to GNU IceCat web browser.
Â
Richard Stallman: ( Founder of a GNU Project )
This is an opinion of Richard Stallman on privacy dangers when using Google Chrome:
The license for those binaries is unacceptable for several reasons.
For instance, it says you give Google the right to change your software and requires you to accept whatever changes they decide to impose. It purports to forbid reverse engineering.
It also uses the confusing and biased propaganda term "intellectual property".
You should not agree to those terms.
Download Google Chrome for Ubuntu Linux
You can navigate to a google website, accept Google Chrome's Terms of Service to download Google Chrome Browser binary or simply download it by using wget and the link below to fetch pre-compiled "deb" package from a google mirror.
Download link for a Google Chrome stable i386 architecture:
ubuntu-chrome ~$ wget https://dl-ssl.google.com/linux/direct/google-chrome-stable_current_i386.deb
Download link for a Google Chrome stable amd64 architecture:
ubuntu-chrome ~$ wget https://dl-ssl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Â
Installation of Google Chrome on Ubuntu Linux
Once you have downloaded a Google chrome pre-compiled binary Deb package all what needs to be done to install it on your Ubuntu Linux is to navigate to your download directory and execute dpkg -i command and supply a Google Chrome's package name as an argument. All Google Chrome prerequisites should be already installed with your default Ubuntu installation.
Add a commentRead more: Ubuntu Linux with Google chrome browser download install and usage guide
Rapidshare wget direct download and Linux
This article explains how to download files from a rapidshare using a linux wget command line tool. Note that RapidShare Premium account is required in order to use wget for a rapishare download .
Using a wget to download from a rapidshare allows you to download multiple files in a single session using simple bash script. It also can be said, that using a bash script and wget to download rapidshare files is somewhat a cheap replacement of jDownloader tool.
This article will start by guiding a user to set a rapidshare account to allow rapidshare direct downloads. In the next step we will create a rapidshare authentication cookie which will be used to authenticate a user when downloading by wget. In the last step we will create a simple bash script to automate the whole process.
Set rapidshare direct download to ON
Direct download from rapidshare requires to set rapdishare direct download to ON, so start up your browser, login to rapidshare and set Direct download to ON.
In your web rapidshare account navigate to:
My RapidShare->File Manager->Download Settings->Direct Downloads-> ON

Â
Create a rapidshare authentication cookie
Rapdishare authentication works on a cookie basis. First run wget command to save a rapidshare authentication cookie to a ~/.rapidshare file.
$ wget -q -O - \ --post-data="sub=getaccountdetails_v1&withcookie=1&login=RAPIDSHARE-USER&password=RAPIDSHARE-PASS" \ https://api.rapidshare.com/cgi-bin/rsapi.cgi \ | grep cookie | cut -d= -f2 > ~/.rapidshare
If all went well your ~/.rapidshare file should contain a long string of characters and numbers.
Add a commentLinux DOSBox emulator and DOS games now free to download
Do your ever get into that sentimental mood that you want to see and play all those DOS games ( now retro games ) you used to play as a kid. I'm talking about those games which made you addicted to the computer and technology at the first place! Well, when I used to be a school kid we had all these superb, state of art computers there and we used to study DOS and its basic commands. What I want to say here is that if there were no DOS games at that present time I would never understand any of that DOS gibberish today. No, I'm not a DOS expert today but the desire to play a game made me to understand some basic computer principles such us how to copy data, extract data, store data on 1.44 floppy, how to do simple text file editing and understanding of  basics of DOS commands and its syntax without any effort.
It is going to be more than two decades since I executed my first DOS command and today I still enjoy executing commands on a command line but using a Linux Operating System. GUI is nice and useful but CLI is fast and effective and I never managed shake it off me completely. Linux is a very powerful operating system and running old DOS retro games is literally piece of cake when using a DosBox simulator. Most of DOS games are now scattered everywhere on the Internet in form of abandonware and waiting for a free download.
In order to play a DOS game on a Linux Operating System we first need to install a DOSBox simulator. If you  are using a Debian or Ubuntu simply use apt-get to install dosbox package and you are done:
# apt-get install dosbox
It is also recommended to install:
# apt-get install unrar unzip wine
Here is list of some great DOS games including wget download command. The execution of these DOS games is rather simple. Enjoy !
NOTE: In some DOS games you may need to configure your SoundBlaster card ! I'm sure that we all know how to do it ! :-)
NOTE: To Download more DOS games visit bestoldgames.net
Warcraft 2
Download a Warcraft 2 game:
$ cd $ wget http://www.bestoldgames.net/download/bgames/warcraft-2.zip
Extract:
$ unzip warcraft-2.zip
Execute:
$ cd Warcraft\ 2/ $ dosbox WAR2.EXE -fullscreen
Screenshot:

Read more: Linux DOSBox emulator and DOS games now free to download
Find by IP - Perl IP to location Example
In the next few lines we are going to describe a process of how to retrieve and geographical information from an IP address . For this we will use a MAxMind Perl API module. This company also provides a data file GeoLiteCity which is free but is less accurate than the paid version. As for a preparation part first we need to download a GeoIP perl module and data file:
$ cd $ mkdir GeoIP $ cd GeoIP $ wget http://geolite.maxmind.com/download/geoip/api/perl/Geo-IP-1.38.tar.gz $ wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
While in the GeoIP directory the next step is to extract both packages:
$ tar xzf Geo-IP-1.38.tar.gz $ gunzip GeoLiteCity.dat.gz
It should be pointed out that this article assumes that your are running some distribution of Linux with PERL interpreter.
Â
Add a commentsudo install, usage and sudoers config file basics
What if you want one user to run a command as an another system user without exchanging passwords. For example, you may want an user john to run a find command or custom bash shell script as an user greg or even as a user root ( superuser ) without password exchange. In this case a sudo utility with its /etc/sudoers configuration file will be your friend. This utility is very widely used but at the same time very little understood by Linux users of all levels.
This short article describes some basic of sudo usage and format of sudoers configuration file.
sudo install
First we need to make sure that sudo and /etc/sudoers the sudo configuration file is available. To do that run:
$ which sudo
or
$ sudo -V
The first command should reveal a location of a sudo binary executable and the second program will output a version number of sudo command its self. The sudo configuration file sudoers is in most cases located in /etc/sudoers. You can use ls command to locate this file.
$ ls -l /etc/sudoers -r--r----- 1 root root 481 2010-04-08 21:43 /etc/sudoersAdd a comment
Read more: sudo install, usage and sudoers config file basics
Linux DNS server BIND configuration
This article is a quick configuration manual of a Linux DNS server using bind. I believe that bind do not need much introduction, but before you proceed with the installation and configuration of bind nameserver make sure that bind DNS server is exactly what you want. Default setup and execution of bind on Debian or Ubuntu may take around 200MB of RAM with no zones added to the config file. Unless you reduce the memory usage of a bind via various bind "options" config settings, be prepared to have some spare RAM available just for this service. This fact is even more important if you pay for your own VPS server.
Another DNS nameservers available on a Linux systems are NSD ( Name Server Daemon) or djbdns ( tinydns ). Both are lightweight alternatives to bind9 DNS server and have less RAM requirements. Apparently are even faster. Â
In this article we will not go into details of what Domain Name Service ( DNS ) is nor how DNS works. Rather we simply concentrate in a simple configuration of a custom zone and config file for a given domain / host  supporting www, mail services.
Sample scenario notes to help you ready this DNS bind howto:
- nameserver IP address 192.168.135.130
- sample domain / host: linuxconfig.org
- authoritative nameservers for a linuxconfig.org zone: ns1.linuxconfig.org ( 192.168.0.10 ) and ns2.linuxconfig.org ( 192.168.0.11 )
- www and mail services for linuxconfig.org will point to:Â 192.168.0.10
bind9 nameserver installation
Unless you prefer to install bind from a source code the installation is rather simple. On a Debian or Ubuntu Linux server you can install a bind nameserver with a following command:
Add a commentLPI 101 - Linux certification practice exam
The best way to memorize all linux commands and techniques used in Linux administration to gain Linux Professional Institute certificate is by practice. The following LPI sample exam should be taken as a middle way between reading a book and practice on command line. It includes questions from all topics required for LPIC 101 ( the first step in Linux certification progress ). Currently the test consist of 20 questions randomly taken from pool of 50.
Â
The Linux Professional Institute is a provider of Linux Certification (LPIC). Each LPIC level requires a candidate to pass two exams. For example to gain a certification for Level 1 a of LPIC a candidate must pass both, 101 and 102 exams.
Â
Each LPIC level requires successful completion of two exams for certification. A first level 1 of LPIC is considered as Junior Level Administration. Candidate should demonstrate solid knowledge of Linux operating system in terms of Linux installation, troubleshooting as well as demonstrate the ability to work from a command line by use of various CLI tools.
The pass score for each subsequent LPI 101 sample test is 85% with unlimited time. Â You can test your Linux skills with this test as many times as needed.
Â
Click here to begin your sample LPI 101 exam:
Add a commentData recovery of deleted files from the FAT filesystem
Introduction
Although FAT32 or FAT16 are very old file systems, which reflects on their poor performance in comparison with other file system alternatives they are still widely used by many electronic devices. Usually, these devices include USB stick's, digital cameras , camcorders and etc. Chances are that you own and store personal data on a device with FAT flesystem is very high as is a likelihood of an accidental deletion of your important data. In this article we will use testdisk utility to undelete files from FAT file system.
OOPS.. I have accidentally removed a video file from my camcorder ! The first thing before we start panic is to unmount USB device and create a low level backup of the device partition with a dd command.
If from any reason you cannot unmount your device, remount it with read-only permissions:
# mount -o remount,ro /dev/sdX
Any data written or file manipulation after accidental file removal will weaken our chances for deleted file recovery. On the other hand creation of a low level backup with dd command gives us an opportunity for unlimited recovery attempts since we are always able to put the entire partition back bit by bit exactly as it was right after accidental file deletion.
After file deletion from a FAT file system the actual file was not removed immediately, but the sectors on which the file resides is now available to be overwritten. From this reason a backup of the entire partition:
# dd if=/dev/sdX of=/my/storage/backup_sdX.dd
To recover a backup for *.dd file we simple reverse the process:
# dd if=/my/storage/backup_sdX.dd of=/dev/sdX
Testing conditions
To test testdisk recovery utility we will create a vfat file system, store video.mp4 and readme.txt files, get md5sum and simply remove and undelete both files.
Add a commentRead more: Data recovery of deleted files from the FAT filesystem
Secure Online Banking with Linux USB Live
Abstract:
Online banking is becoming a very popular way to satisfy our banking needs and this even includes people with no or very little technical background. There are numerous advantages when doing banking transactions online, such as 24/7 bank opening hours, ability to make transactions from anywhere in the world and convenience. The only problem is that we do not take our secured home PC everywhere with us. Consequently, the use of other computer and operating system rather than our own for online banking may involve a great security risk. However, what we can and usually carry on us everywhere we go is some sort of the USB key storage device. This article describes a way of building our own customized Online banking USB live Desktop.
Introduction
Solution to online banking by having an USB key with some bootable Live Linux distribution solely dedicated to serve our online banking needs can be very handy not even when traveling, but also when used on day to day basis. Usually, computers are shared among colleges, family members or friends and therefore chances are very high that our personal details will be made available to some fraudsters and their sophisticated scams and software. What is more, encrypting our non-persistent USB key will make Live USB online banking desktop worthless when falling into enemy hands. Therefore, there is no harm of storing our online passwords directly on the USB itself using an application such as gorilla-password ( double encryption ). Perhaps the outcome of this guide is not as good as the famous IronKey with all its shiny features, but we would all missed the fun if there will be no space to improve it.

This article will comprise of four major sections:
- build Debian USB live image
- customize desktop environment within USB live image
- rebuild USB live image with customized environment and encryption
- transfer USB LIVE image to USB memory device
Prerequisites
Hardware
- USB key with minimum size of 512 MB
- PC with USB slot
Software
The software prerequisites are very simple and straight forward. All what is needed is a running Debian or Ubuntu desktop with live-helper and qemu packages.
Add a commentPage 6 of 9













