How to extract tar.xz file

Hello all,

I was trying to extract tar.xz file in Ubuntu recently and was getting errors. The “Right click” –> “Extract” too din’t work. I assumed that as it was tar file it should have the capability to extract this file too. But it was not the case.

Here is how I extracted the tar.xz file:

  1. First of all we need to install xz-utils package so that the command works. You can install this by using the following command:

sudo apt-get install xz-utils

  1. Now give the following command to extract the file:

tar xJf foo.tar.xz

Thats it. This will do the trick. Now you can extract tar.xz file using the above tar command or using the “Right click” –> “Extract” method.

If you find any difficulty please leave a comment. I will appreciate a simple “Thanks” if that helps you.

Regards,
Manohar Bhattarai (मनोहर भट्टराई)
Personal Website : http://manoharbhattarai.com.np/
Personal Blog : http://blog.manoharbhattarai.com.np/

Posted in Linux, Ubuntu, xz Tagged with: , , , , , , , , , , , , , , , , , , ,

How to enable ssh to VirtualBox guest Ubuntu

I recently installed Ubuntu Server 12.04 on Oracle VirtualBox and needed to connect to it using ssh. But was wondering how to access my ubuntu server guest from my ubuntu host (yes, I am using ubuntu as host too.) and got it working with few settings. If you want to first install vitrualbox, here is the howto.

This is how I enabled ssh to virtualbox guest:

  1. If the virtual guest is running, first shut it down as we need to change some settings for it.

  2. On the Oracle VM Virtual Manager go to File–>Preferences…

  3. On the VirtualBox – Settings window select Network and click the + sign to add a Host-only Networks. You will see a vboxnet0 on the list now.(If you already have this, you can skip this step)

VirtualBox - Settings-Network

VirtualBox – Settings-Network

  1. Now select the Virtual Machine and click Settings. On the Settings window select the Network. The “Adapter 1” Attached to : NAT is used for internet by the virtual machine, so leave as it is. Select “Adapter 2” and check the Enable Network Adapetr checkbox if it is not already checked. On the “Attached to:” choose “Host-only Adapter” and in “Name:” select vboxnet0(The same we created in the above step.) Click OK.

 

Ubuntu Server 12.04 - Network Adapter 2-Settings

Ubuntu Server 12.04 – Network Adapter 2-Settings

  1. Now, start the virtual machine guest. Install openssh-server(if not already installed) using the command sudo apt-get install openssh-server.

  2. Edit the /etc/network/interfaces file with the command vi /etc/network/interfaces or with any other editor of your choice. And add the following contents in it if not already there.

auto eth1
iface eth1 inet static
address 192.168.56.110
netmask 255.255.255.0

You can see the address is 192.168.56.110, the 56 is from the vboxnet0. You can check that by following step 2 and 3, and select the vboxnet0 and hit “Enter” key OR right click on vboxnet0 and choose “Edit host-only network”.

Host-only Network Details

Host-only Network Details

  1. Now restart networking using command /etc/init.d/networking restart

  2. Now restart the virtual machine guest.

  3. You can now access your guest virtual machine from host through shh using ssh <username>@192.168.56.110 and username can be anything like “root”.

I hope this will help someone and saves his/her day.

Regards,
Manohar Bhattarai (मनोहर भट्टराई)
Personal Website : http://manoharbhattarai.com.np/
Personal Blog : http://blog.manoharbhattarai.com.np/

Posted in Ubuntu, Virtualbox Tagged with: , , , , , , , , , , , ,

Execute .sql file from command line in postgresql

Hi all,

Every now and then we have/want to run a .sql file or sql script from command line instead of typing each and every sql commands. So, I will write how to execute .sql file from command line in postgresql today. See this howto to see how to install postgresql in ubuntu.

Lets see how to do it:

We can execute the .sql file in two ways from command line(mention in the comment part if you know others).

In the following example commands, simulator is the database name, qs.sql is the .sql file/script with SQL commands, qs.sql file is located at Desktop and present working directory is /home/manohar i.e my home directory.

  1. From the ubuntu/linux command prompt:

psql -d simulator -f Desktop/qs.sql

Or

psql -U <database_username> -d simulator -f Desktop/qs.sql

From ubuntu command line

From ubuntu command line

  1. From the psql command prompt:

\i Desktop/qs.sql

From sql prompt

From sql prompt

 

 

Hope this helps you all.

Regards,
Manohar Bhattarai (मनोहर भट्टराई)
Personal Website : http://www.manoharbhattarai.com.np/
Personal Blog : http://blog.manoharbhattarai.com.np/

Posted in Linux, Postgres, Ubuntu Tagged with: , , , , , , , , , , , , , , ,

Try google nose

Hello everyone,

Today Google has announced a new product called “Google NoseBETA“. This helps to smell the things you look. If can find out more about it here.

So try google nose at the above given link. Smelling Is Believing.

Edit: Yeah that’s right, it was the April Fools Day prank by google.

Regards,
Manohar Bhattarai (मनोहर भट्टराई)
Personal Website : http://manoharbhattarai.com.np/
Personal Blog : http://blog.manoharbhattarai.com.np/

 

Posted in April Fools Day Tagged with: , , , , , , , ,

How to install virtualbox in ubuntu

Hi all,

I have installed virtualbox many times in my ubuntu machine. But recently, after installing virtualbox in my ubuntu machine from Software center, I found some problem installing guest additions in it. After much searching I found that I have installed OSE which was not the latest version. Then I removed the VirtualBox OSE from Software center and downloaded the latest Oracle VM VirtualBox.

Lets see how to remove OSE and install Oracle VM VirtualBox:

First remove the OSE from Software Center. The already installed guest Operating Systems will not be affected(atleast it din’t for me).

Now download the latest stable version from here. Choose the best for the platform you are using from the provided list. For me it was “VirtualBox 4.2.10 for Linux hosts“. Choose the appropriate package for your Linux distribution from the list. I choosed the Ubuntu 10.04 LTS (“Lucid Lynx”) i386 for 32bit machine.

This will ask you to download the .deb file. Choose the location to save or it normally downloads to your “Downloads” directory.

To install double click the just downloaded .deb file. It will open a window, click “Install Package”. It will install the Oracle VM VirtualBox. If you get any error regarding other version of virtualbox already being installed, you probably must have forgot to remove the old OSE virtualbox. If so, delete it from the software center.

To open go to Applications->System Tools->Oracle VM VirtualBox(for Ubuntu<=10.10) and above that search for virtualbox or you can see an icon in the side bar.

I hope this will help someone and saves his/her day.

Regards,
Manohar Bhattarai (मनोहर भट्टराई)
Personal Website : http://manoharbhattarai.com.np/
Personal Blog : http://blog.manoharbhattarai.com.np/

 

Posted in Ubuntu, Virtualbox Tagged with: , , , , , , , , , , , , , , , ,

Install Postgresql in Ubuntu 12.04 LTS

Hi all,

Its common to all that we need to install database in our machine now or then due to re-installation of OS or any other reasons whatever that may be. I too use to install most of the time due to some reason or other.

Today I am installing Postgres or Postgresql database on my new installation of Ubuntu 12.04 LTS. I wanted to document this so that it will help others too and mostly that I can refer to whenever I need to do the same again.

Type following command in the terminal to install postgresql (9.1 is the default version that Ubuntu 12.04 provides) :

manohar@manohar-desktop:~$ sudo apt-get install postgresql

Now edit the /etc/postgresql/9.1/main/pg_hba.conf file and add/change the following line :

# "local" is for Unix domain socket connections only
local   all             all                                    md5

Now edit the /etc/postgresql/9.1/main/postgresql.conf file and change :

#listen_addresses = 'localhost'

to

listen_addresses = '*'

so that the TCP/IP connection for everyone is enabled which is by default disabled. Or you can change the “*” to any IP range suitable to you.

And change the following to enable password encryption :

#password_encryption = on

to

password_encryption = on

Now create an user as superuser for your current user (if you like to) :

manohar@manohar-desktop:~$ sudo -u postgres createuser --superuser $USER

To create a database with a user that have full rights on the database, use the following command:

manohar@manohar-desktop:~$sudo -u postgres createuser -D -A -P manohar
manohar@manohar-desktop:~$sudo -u postgres createdb -O manohar mydatabase

The first command line creates the user with no database creation rights (-D), with no add user rights (-A) and will prompt you for entering a password (-P). The second command line create the database mydatabase with manohar as owner.

If you have created current user as superuser, you can create the database(named simulator) using following commands :

manohar@manohar-desktop:~$ createdb simulator

To use the just created database(i.e. simulator), use the following command :

manohar@manohar-desktop:~$ psql simulator
psql (9.1.8)
Type "help" for help.

simulator=#

Now you can give database related commands in the new database prompt.

Here is some test commands for example :

simulator=# create table test(name text);
CREATE TABLE
simulator=# \d
List of relations
Schema | Name | Type  |  Owner
--------+------+-------+---------
public | test | table | manohar
(1 row)

simulator=# \d test
Table "public.test"
Column | Type | Modifiers
--------+------+-----------
name   | text |

simulator=#
Postgres

Postgres

 

Hope this helps you all.

Regards,
Manohar Bhattarai (मनोहर भट्टराई)
Personal Website : http://manoharbhattarai.com.np/
Personal Blog : http://blog.manoharbhattarai.com.np/

Posted in Postgres Tagged with: , , , , , , , , , , , , , , , , , , , ,

Java code names

Hi all,

I am back after a long time. Today I am writing about the Java code names which most of us don’t know about.

Java, one of the most popular object oriented programming language, was initially codenamed Oak. The first stable version was the JDK 1.0.2. is called Java 1.

Most versions of the Java 2 Platform Standard Edition have an internal code or project name, as listed below. The dates listed are the final product release dates (following any beta releases). Feature releases are shown in bold.

Starting with Tiger, each version has two version numbers: an internal number, such as 1.5.0, and an external number, such as 5.0.

Since 1.2.2, major releases 1.3, 1.4.0, 5.0 and 6) are named after birds or mammals, while minor releases are named after insects, given that they are bug-fix releases. (Hopper is short for grasshopper and ladybird is another term for ladybug.)

Java_Logo

VERSION CODE NAME    RELEASE DATE
JDK 1.1.4 Sparkler Sept 12, 1997
JDK 1.1.5 Pumpkin Dec 3, 1997
JDK 1.1.6 Abigail April 24, 1998
JDK 1.1.7 Brutus Sept 28, 1998
JDK 1.1.8 Chelsea April 8, 1999
J2SE 1.2 Playground Dec 4, 1998
J2SE 1.2.1 (none) March 30, 1999
J2SE 1.2.2 Cricket July 8, 1999
J2SE 1.3 Kestrel May 8, 2000
J2SE 1.3.1 Ladybird May 17, 2001
J2SE 1.4.0 Merlin Feb 13, 2002
J2SE 1.4.1 Hopper Sept 16, 2002
J2SE 1.4.2 Mantis June 26, 2003
J2SE 5.0 (1.5.0) Tiger Sept 29, 2004
Java SE 6 Mustang Dec 11, 2006
Java SE 7 Dolphin July 28, 2011

 

Most of the above contents are gathered from official sites like Oracle and other sites. The detailed information on the releases can be found in wikipedia.

In his blog Mustang and Dolphin… we’ll miss you, Ray Gans has explained how the code names are left behind and developed a new project naming system around the open source model.

Regards,
Manohar Bhattarai (मनोहर भट्टराई)
Personal Website : http://manoharbhattarai.com.np/
Personal Blog : http://blog.manoharbhattarai.com.np/

Posted in Java Tagged with: , , , , , , , , , , , , , , , ,

The resource is not on the build path of a java project eclipse

Hi all,

I am back again. So, this post is about an error “The resource is not on the build path of a java project eclipse” in Eclipse IDE when you try to navigate using F3 key or Ctrl+(left mouse click) to any Java resource.

I had a similar error recently as I deleted the entire src(source) folder in the project and replaced the same folder from some other place.

I tried to search but could not find something really to the point answer. Then I tried myself. This is how I removed the error:

  1. Right click on the src(source) folder.

  2. Select “Build Path”

  3. Select “Use as Source Folder”

And you are done. Just close all open tabs and re-open them if you still can not navigate. Enjoy coding…

Thank you.

Posted in Eclipse IDE Tagged with: , , , , , , , ,

Ubuntu 12.04 on Virtualbox pae error – “Unable to boot – please use a kernel appropriate for your CPU”

Hi all,

My last post was about the release of Ubuntu 12.04 LTS. I wanted to install it in the VirtualBox. But I got an error. So this post is about how to remove the error and move forward with the installation.

If you are installing the new Ubuntu 12.04 Precise Pangolin 32bit ISO on Virtualbox you are going to get this error :

“This kernel requires the following features not present on the CPU: pae Unable to boot – please use a kernel appropriate for your CPU”.

Precise Pangolin LTS [Running] - VirtualBox OSE

Precise Pangolin LTS [Running] – VirtualBox OSE pae error

To fix this error, you have to enable PAE/NX for the virtual machine.

To enable, you have to select the virtual machine and then click “Settings” and under System –> Processor, check the “Enable PAE/NX” box:

Precise Pangolin LTS - Settings

Precise Pangolin LTS – Settings

This occurs because Ubuntu 12.04 uses the PAE kernel by default for 32bit.
Hope this helps you all and saves you day.
Enjoy Ubuntu 12.04.
And if you want to enable ssh access to guest Ubuntu from host, here is the howto.

Thank you.

Posted in Linux, Precise Pangolin, Ubuntu, Ubuntu 12.04 LTS, Virtualbox Tagged with: , , , , , , , , , , , , , , , , , , , , , ,

Ubuntu 12.04 LTS Precise Pangolin is released

Hi all,

I am back again after a long time. This post is about the new release of Ubuntu, 12.04 LTS, code named Precise Pangolin.

Ubuntu 12.04 LTS

Ubuntu 12.04 LTS

 

It was officially released few hours back. This is a Long Term Support released whose both(Desktop and Server) versions unlike previous LTS releases that have been supported for three years for the desktop version and five years for the server version.

To know more you can visit the below links :

1. Ubuntu Website

2. Ubuntu Wiki

3. Downloads

4. Desktop Download

5. How to install

6. List of files including torrents for downloads

Hope you all like this. Give it a try and give the feed back in the comments below. I have been using Ubuntu since version 7.10, and it has changed my life literally.

Thank you.


Regards,
Manohar Bhattarai (मनोहर भट्टराई)
http://about.me/manoharbhattarai
http://www.facebook.com/pages/Manohar-Bhattarai/130973796914160
Blogs:
http://manoharbhattarai.wordpress.com/
Microblogs:
Twitter :- http://twitter.com/mhrbhattarai
Identi.ca :- http://identi.ca/manoharbhattarai

Posted in Linux, Precise Pangolin, Ubuntu, Ubuntu 12.04 LTS Tagged with: , , , , , , , , , , , , , ,
%d bloggers like this: