Setting up Ubuntu mini on a headless Virtualbox server in windowsXP

March 2, 2011

My aim was to setup a minimal ubuntu installation that I can use occasionally on my office system which is running windows XP for playing around when I get some time. The primary requirement was that it should be small on memory and disk. So, I decided to go for Ubuntu mini in a headless virtual box server

  • I started out by obtaining the Ubuntu (10.10 Maverick) mini iso.
    Can be got from – http://archive.ubuntu.com/ubuntu/dists/maverick/main/installer-i386/current/images/netboot/mini.iso
  • Download the latest version of Virtualbox (4.04), previous versions had some bugs with DHCP so, I downloaded the latest one though I had an old one
    Can be got from – http://download.virtualbox.org/virtualbox/4.0.4/VirtualBox-4.0.4-70112-Win.exe
  • Install Virtualbox and create a virtual machine called Mini with the configuration
    1. 128 MB memory
    2. 8 GB expanding harddisk
    3. Add a cd drive and connect that to Mini.iso
    4. Create two network connections.
    1. NAT – used for internet access
    2. Host only Adapter – used for communication between Windows XPhost and Ubuntu guest
  • Now start the virtual machine and proceed with the installation of Ubuntu. We should get the base system ready upon which we will be installing additional components.
  • Once the base system is ready we have to install shh. This can be done by giving the command
    Sudo apt-get install ssh
    This will install open shh server and client
  • Now the next step is to start the shhd
    Type sudo sshd
    I got the error message 

    tutysra@dev-test:~$ sudo sshd
    sshd re-exec requires execution with an absolute path
    tutysra@dev-test:~$

    What this means that we should use the full path to start sshd
    Now use which to find the executable and run it

    tutysra@dev-test:~$ which sshd
    /usr/sbin/sshd
    tutysra@dev-test:~$ sudo /usr/sbin/sshd
    tutysra@dev-test:~$

  • Now try connecting from the local host to check the connection
    tutysra@dev-test:~$ ssh localhost
    tutysra@localhost's password:
     

    It should prompt for the password.

  • Now we should configure the host only adapter
    We will assign it a static IP 

    Open – /etc/network/interface
    Vi /etc/network/interface and add the following lines

    iface eth1 inet static
    address 192.168.56.101
    netmask 255.255.255.0

  • Now restart networking services
    sudo /etc/init.d/networking restart

We are all done now.

  • Come to windows. Install putty if you don’t have one and from – http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe
    Try connecting to the Ubuntu guest by giving the hostname as 192.168.56.101 and port as 22.
    Now we should be able to log in into the guest
  • Now the next step is to run Virtualbox in the background using headless mode.
    First we should shutdown the machine which is already running and close virtualbox.
  • Open a cmd prompt in windows and type
    "C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe" -startvm Mini –p 8000

    This will start the Virtualbox server in the background. Give it some time for the OS to boot.

  • Now we can connect using putty and start using the system
    In case if the Ubuntu guest doesn’t boot property or if you cannot connect using putty by ssh, we can always use windows remote desktop connection for connecting to the machine and debugging it.
    This can be done by opening Remote Desktop Connection from

    Programs -> Accessories -> Remote Desktop Connection
    In the hostname filed type – 127.0.0.1:8000

    This will allow you to see the Ubuntu guest console from where you can correct the issues if there are any and continue with the normal process.

  • The system can be shutwon from commandline by issuing the command

    "C:\Program Files\Oracle\VirtualBox\VBoxManage" controlvm Mini poweroff

We can put these commands in a batch file for easy execution.
We can also start the virtual machine at startup or as a service so, that looks very clean (no command windows lying open on the screen)
I would be happy to help if you are struck. Leave me a comment if you have any request/suggestion or if you like this.

Is IRC safe?

January 2, 2010

Do they use secured communication? This is the most obvious question one would ask when we have send password to a site or an applicaiton. Without having a secured communication there is no point in authenticating ourself by supplying a password as this information can be taken by anyone while it is transmitted and tamper it.

To my surprise the IRC network is not secure, that means whatever we send including password is send as plain text and can be seen (and changed) by anyone who is capable of doing that. So, it is better not to use IRC for sensitive informaton and use a password that is different from other passwords. It is not a flaw or issue with IRC, it is because of the purpose and principle of IRC. IRC network is not secure and that is how it is and designed to be.

There are works going on to improve this by introducing SSL to make it secure. Freenode has an IRC server which uses SSL with the URL – testnet.freenode.net. Currently they are in testing phase and they need community support to test these new servers. It is a great chance to make IRC secure and give something back to the community.

Install latest version of FireFox on Ubuntu

January 2, 2010

I am using both windows and ubuntu and use firefox on both of them. The latest version of FireFox (from now on called FF) is available for windows immediately but still it takes time to be available for ubuntu. There are a couple of repositories available but they install a re-branded version of FF which I don’t like and which might cause issues with websites which uses the “user-agent” header.

There is a simple and easy option available to install the latest FF or any software from Mozilla on ubuntu. There is a script available at – http://sourceforge.net/projects/ubuntuzilla/files/ as deb. Install this application.

We could run the script after installation by running the command

sudo /usr/local/bin/ubuntuzilla.py

It will prompt a couple of questions for selecting locale and profile backup and will install the latest version of FF

Just restart the system and we could see that this has taken effect by clicking the browser icon on the GNOME panel, we get the latest version of FF running on ubuntu.

How to get lost IRC password

January 2, 2010

I was using IRC sometime back and I have registered my nickname. I haven’t used that for a while and I forgot the password. Though you could log into IRC without having a password for nickname there could be an issue if there is a conflict(in case someone uses the same nickname as yours). I was searching for an option like the generic “Forgot Password” link offered by many email services but I couldn’t find one, In fact IRC doesn’t have an equivalent since they operate on a different principle and used for different purpose. The only way you could reset your password is to ask the staff members. Staff members are users with special privileges and we can request the password to be reset at the channel #freenode for irc.freenode.com. The staff members are very helpful and they reset the password and send it to the mailid with which we have registered. The staff members are all voiced so, that we can easily identify them in the channel and place our request.

Get good looking fonts in Opera on Ubuntu

January 2, 2010

I recently installed opera 10.10 on ubuntu intrepid. I downloaded a binary from opera download site and the installation was smooth. I fired opera and started playing with it for sometime, it is extremely fast and the tabbed browsing was more comfortable than my firefox3.1. But there was one issue that makes it a pain using opera , the fonts doesn’t look good and we soon feel that when we read through some long text.

The issue with opera is that it doesn’t take its font configurations from GNOME. so, its fonts looks different with no sub-pixel smoothing and hinting. I went through the forums and found a solution to this.

We have to enable full-hinting and sub-pixel smoothing. This can be done by typing the following commends in the terminal as root or using sudo.

1. Enable full-hinting

cd /etc/fonts/conf.d
sudo rm 10-hinting-medium.conf
sudo ln -s ../conf.avail/10-hinting-full.conf

2. Enable sub-pixel smoothing

sudo rm 10-no-sub-pixel.conf

We are done. Restart opera and see that the font looking.

Web Services in Ubuntu – JAX-WS

September 5, 2009

In this post let me go through the process of creating a web service client in java on ubuntu.

We need to have the apis for programming web services. Java provides a api called JAX-WS which is version 2 of the java web services api the previous version being JAX-RPC. JAX-WS comes a part of JDK6.0 and above. If you are using jdk5 then we need to download the JAX-WS web-service apis. JAX-WS is developed as a separate project called Metro and the latest version can be downloaded from the Metro project site – https://jax-ws.dev.java.net/. you can follow the instructions on the site for installing it.
Once installed it can be checked by tying wsimport at the terminal. It should give an output which looks like this


Usage: wsimport [options]


where [options] include:
-b specify jaxws/jaxb binding files or additional schemas
(Each must have its own -b)
-B Pass this option to JAXB schema compiler
-catalog specify catalog file to resolve external entity references
supports TR9401, XCatalog, and OASIS XML Catalog format.
-d specify where to place generated output files
-extension allow vendor extensions - functionality not specified
by the specification. Use of extensions may
result in applications that are not portable or
may not interoperate with other implementations
-help display help
-httpproxy:: specify a HTTP proxy server (port defaults to 8080)
-keep keep generated files
-p specifies the target package
-quiet suppress wsimport output
-s specify where to place generated source files
-target generate code as per the given JAXWS specification version.
version 2.0 will generate compliant code for JAXWS 2.0 spec.
-verbose output messages about what the compiler is doing
-version print version information
-wsdllocation @WebServiceClient.wsdlLocation value



Examples:
wsimport stock.wsdl -b stock.xml -b stock.xjb
wsimport -d generated http://example.org/stock?wsdl

If you get an output like this then we are done with the installation. we can proceed to the next step. Otherwise refer tot he metro site for installing this. For people using jdk6 everything is set by default and they can verify their installation by typing the above command in a terminal
Now we will find a site which provides free web service. I found a site http://www.webservicex.net/ which hosts lot of free web services organized into different categories. For this example lets us take a service which is called WHOIS web service which is available in the utilities section. The url for this is – http://www.webservicex.net/WCF/ServiceDetails.aspx?SID=51

Now we have to get the WSDL for this web service and compile it using the wsimport utility to get the start-up code for our web service.
To do this open a terminal and type

wsimport -keep -verbose -d whois http://www.webservicex.net/whois.asmx?wsdl

here the -keep tells the command to keep the generated java files and the -d is used to specify the output directory. we would get a output like this


parsing WSDL...


[WARNING] Ignoring SOAP port "whoisSoap12": it uses non-standard SOAP 1.2 binding.
You must specify the "-extension" option to use this binding.
line 113 of http://www.webservicex.net/whois.asmx?wsdl

[WARNING] ignoring port "whoisHttpGet": no SOAP address specified. try running wsimport with -extension switch.
line 116 of http://www.webservicex.net/whois.asmx?wsdl

[WARNING] ignoring port "whoisHttpPost": no SOAP address specified. try running wsimport with -extension switch.
line 119 of http://www.webservicex.net/whois.asmx?wsdl

generating code...
net/webservicex/GetWhoIS.java
net/webservicex/GetWhoISResponse.java
net/webservicex/ObjectFactory.java
net/webservicex/Whois.java
net/webservicex/WhoisSoap.java
net/webservicex/package-info.java

Now go to the directory where these files are created and we can create the client.

Create a java file with the following contents


package net.webservicex;
public class WhoisClient{
public static void main(String args[]){
Whois whois=new Whois();
WhoisSoap whoisSoap=whois.getWhoisSoap();
System.out.println(whoisSoap.getWhoIS("www.google.com"));

}
}

or still more usable as


package net.webservicex;
public class WhoisClient{
public static void main(String args[]){
Whois whois=new Whois();
WhoisSoap whoisSoap=whois.getWhoisSoap();
System.out.println(whoisSoap.getWhoIS(args[0]));

}
}

That is it we are donw with our web service client. Now compile the program by setting the classpath to point to the directory that contains the generated class files using the command


javac WhoisClient.java

Now the program can be run with by typing this in the terminal


java net.webservicex.WhoisClient www.google.com

we would get an output as below


Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

WWW.GOOGLE.COM.VN
WWW.GOOGLE.COM.TW
WWW.GOOGLE.COM.TR
WWW.GOOGLE.COM.SA
WWW.GOOGLE.COM.PE
WWW.GOOGLE.COM.MX
WWW.GOOGLE.COM.CO
WWW.GOOGLE.COM.BR
WWW.GOOGLE.COM.AU
WWW.GOOGLE.COM.AR

To single out one record, look it up with "xxx", where xxx is one of the
of the records displayed above. If the records are the same, look them up
with "=xxx" to receive a full display for each record.

>>> Last update of whois database: Sat, 05 Sep 2009 06:29:11 UTC <<<

NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar. Users may consult the sponsoring registrar's Whois database to
view the registrar's reported date of expiration for this registration.

TERMS OF USE: You are not authorized to access or query our Whois
database through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois database is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois database except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois database in its sole discretion to ensure
operational stability. VeriSign may restrict or terminate your access to the
Whois database for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.

The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.

Here we can give different host names as argument and experiment with it. There are many free web services available at http://www.webservicex.net and almost all of them can be consumed using the same method by using java clients. Thanks for reading

Ubuntu : FireFox Fills whole screen

April 27, 2009

The recent change in my firefox is it always opens in full screen mode hiding the GNOME start bar and the status bar at the bottom. This happened after trying to upgrade some of its features through update manager.
The fix for this is simple just go to full screen by pressing F11 and then pressing F11 again to return to normal mode

Editplus replacement in ubuntu : jEdit

April 16, 2009

I work most of the time on UNIX machines through terminals. We use putty as our terminal client and when we want to edit any files we just copy the file name from putty into Editplus and open it.

When I moved to ubuntu I couldn’t find a replacement for Editplus which allows me to easily edit my files. There are many editors that I found in ubuntu which has FTP and SFTP support but they all open a file tree and they require us to navigate through the file tree to open the files. We used to navigate through various directory structure using putty and edit files from different locations, It is a lot of pain to navigate through different directories in those editors. This is very bad when the FTP connection becomes slow at peak hours.

I was actually looking at the comparison of various text editors and my quest for a Editplus replacement came to an end when I found jedit. It is a wonderful text editor with a host of options and features. It is open source and It is extensible by using various plugins. The plugin which provides support for FTP and SFTP is the FTP plugin. It can be installed by using the “Plugin Manger -> Install” tab. Once the installation is complete it can be found under “Plugins -> FTP”. Select the options “Open from FTP server…” or “Open from secure FTP server” fill in the server details along with user name and password and hit the connect button. Once the connection is established the FTP directory becomes a part of the jEdit VFS and all actions that are valid for a normal file can be performed on the FTP files.

To quickly open files for which the path is known we can use the open file macro found under “Macros -> Files -> Open Path”. We have to prefix the FTP file names with “ftp://user@server:21/path/to/file“.
Example – to open a file .profile use “ftp://user@server:21/~/.profile”

We can even write our own macro to ease this process. Macros are stored under the macros directory under installation directory or settings directory. We can write a simple macro to open a file automatically from a FTP server just by giving the path. This macro releaves us by typing “ftp://user@server:21/” whenever we need to open files from the server. Open a new file in jEdit and type in the following lines

void openPath()
{
String path = Macros.input(view,"Path name:");
if(null==path||path.length()==0){
return;
}
String prefix="ftp://user@server:21";
path=prefix+path;
if(path != null)
jEdit.openFile(view,path);
}

openPath();

and save it under the macros directory as Quick_FTP.bsh.
Now reload the macros list by selecting “Macros -> Rescan Macros” and our “Quick FTP” macro can be found. Select our macro and it asks for the path name . just give the path name to open it from FTP server. This is just a small how to on writing a Macro and demonstrating the robust features of jEdit. You can find lot of Plugins and Macros at the Community and Plugin site.

Tata Indicom CDMA Epivalley modem in ubuntu

December 22, 2008

I recently got a Tata Indicom wireless modem. It is a device from Epivalley and uses the qualcomm chip. It came with a software CD which contained the softwares only for windows. I searched through the forum and I found a very simple way of configuring it in ubuntu. In ubuntu the modem got detected without installing any additional softwares and all I have to do was to set some configuration information for it to connect to the ISP. I had to create some files to put in the settings required by it.

I created the peers file with the  command.

gksudo gedit /etc/ppp/peers/tatagprs

Put these commands starting with a blank line into the file and save it.

noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/tatagprs"
debug
/dev/ttyACM0
460800
defaultroute
noipdefault
user "internet"
password "internet"
remotename tata
ipparam tata

usepeerdns

Next I created the chatscript with the command

gksudo gedit /etc/chatscripts/tatagprs

Then I put these contents into the file and saved it.

ABORT   'BUSY'
ABORT   'NO CARRIER'
ABORT   'ERROR'
''      ATZ
OK      ATDT#777
CONNECT ''

Now to connect to the internet I will open a terminal and type.

pon tatagprs

and to disconnect I simply type

poff tatagprs or
poff

Windows XP and Custom Fonts in Ubuntu

December 22, 2008

I work with both windows and ubuntu and I edit my documents from both of these OS. I want all my formatting to be consistent but, there are many fonts in windows which are not present in ubuntu. This makes editing word files a boaring task as I have to keep changing the fonts whenever I change the OS or use a font which is available in both the OS. There are  also some web sites which require me to install their font to show up in  correct format.

We can install any font in ubuntu by following these simple steps. To start with we need the font file to install. If it is a fovourite font from Windows just copy the font file from the windows fonts directory into a memory stick and copy it to your home directory in ubuntu. Then open up a terminal.

  1. Create a directory to hold our fonts  – sudo mkdir -p /usr/local/share/fonts/truetype
  2. Change to the directory we have created – sudo cd  /usr/local/share/fonts/truetype
  3. Copy the font file – sudo cp ~/<font-file-name>.ttf .
  4. Rebuild font cache – sudo fc-cache -f -v

We could see that the last command updates the font-cache by printing a lot of messages to the console. We are done. Now open the website which asked for the font, it should open with  correct formatting. If we open a document to edit we could find the font we have just installed from the fonts drop down.


Follow

Get every new post delivered to your Inbox.