"; */ ?>


11
Sep 08

Install Sun Application Server on Ubuntu

Sun Microsystems

On the client site when working on Java (or should I say JEE) projects, the application servers are most of the time “rotate” between these four: JBoss, Websphere, Weblogic, and someties Geronimo. However there are some clients who have pretty tight contracts with Sun, and in these cases the Sun Application Server is used.

I think now days in development world in general, well except maybe .NET part of it, Ubuntu and/or Mac OS slowly become OSs of choice for developers. Sun app server however is not the most used app server out there, and since its installation could be a bit non-straightforward, here are four simple steps on how to install it on Ubuntu box:

Step 1. Download the “.bin” form sun:

“Sun Java System Application Server”

http://java.sun.com/j2ee/1.4/download.html (I needed 8.2, but there are more recent ones)

Step 2. Change permissions, to make it runnable:

chmod 744 sjsas_pe-8_2-linux.bin

Step 3. If you just run it:

./sjsas_pe-8_2-linux.bin

It is going to complaint that it is missing a standard c++ library:

./sjsas_pe-8_2-linux.bin: error while loading shared libraries: libstdc++-libc6.2-2.so.3: cannot open shared object file: No such file or directory

Having done some “apt-cache” searches ( apt-cache search libstdc++ ), found that Ubuntu has “libstdc++.so.6” in /usr/lib.
From /usr/lib run:

 sudo ln -s libstdc++.so.6 libstdc++-libc6.2-2.so.3

Step 4. Run it now, it will install Sun App Server successfully! * **

* Do not run installation as root – it will fail (for most sun app servers versions)

** If you use any form of Beryl (or some Compiz’es), disable it, or reload window manager as a “Gnome Manager”. This is due to the fact the the installer is written in Swing, and Swing does not get along too well with some display managers.


26
Aug 08

USSR is Winning Olympics 2008

USSR National EmblemI was born and pretty much raised in USSR (Ukraine), and therefore when it comes to sports – not war/politics and definitely not nationalism/silly Soviet patriotism, it makes me feel happy when any of the 15 USSR (former) republics athletes achieve gold/silver/bronze or just a good notable performance.

As a kid, I went to Children’s Olympic Reserve School doing sport gymnastics for several years, where I could see how high our standards were and just how important the role of sport was on the grand scale of things in the country.

So I was looking at “Overall Medal Standings” at the end of 2008 Olympics and came to an interesting conclusion:

NOC Name Total Gold Total Medals
Russia 23 72
Ukraine 7 27
Belarus 4 19
Georgia 3 6
Kazakhstan 2 13
Azerbaijan 1 7
Uzbekistan 1 6
Latvia 1 3
Estonia 1 2
Lithuania 0 5
Kyrgyzstan 0 2
Tajikistan 0 2
Armenia 0 6
Moldova 0 1
Total: 43 171

As the table above shows the (formerly :) ) strong USSR could have taken 43 gold medals, which is 7 medals ahead of US, but still leaves USSR at the second “gold” place after China, however it would take 171 total medals which would make it a 2008 Olympics winner by the total medal count!

One “the very true” argument could be “foo get abour it, USSR is no more” – true. But I was mentally flipping pages through the history, combining the medals of Roman Empire, Osman Empire, and even Delian League, but their medal count did not come even close the third place. (“Persian Empire” came pretty close actually :) )

Just wanted to bounce it against people of www ;)


06
Aug 08

Speed Up Ubuntu Boot Time by Starting Networking on The Background

Ubuntu Boot Up TimeIt is quite a simple change but it makes an Ubuntu laptop to boot 2-3 times faster! What takes the most time during boot in Ubuntu (and many other Linux distros) are DHCP discovery and DHCP timeout that are run by networking startup scripts. This of course can be solved with tweaking the timeout or just configuring a static IP, however this solution is not all that elegant, just because “What if the system needs this particular timeout?” or “What if it is a laptop, and it’s IP cannot be static?”

The idea to solve this is simply to take an advantage of concurrency. So instead of all other boot scripts to wait on the networking script(s) to finish its discovering and “timeouting” during a system boot, these network script(s) could be started in parallel, as separate child processes. This will speed up boot time, since the system should no longer wait on the “networking” to finish.

One thing to understand here, is that networking is not taken out of the boot process – it stills belongs to it (it is its child), and it would still run, and would do its important job – the difference is it would do it in parallel.

Here are two easy steps on howto archive this in Ubuntu (it can be applied to pretty much any Linux/Unix distribution, however the scrips/locations will/might be different) :

Step 1. Find network startup scripts:

cd /etc
 
user@host:/etc$ sudo find . | grep network
./rcS.d/S40networking
./init.d/networking
./network
./network/.interfaces.swp
./network/if-post-down.d
./network/if-post-down.d/avahi-daemon
./network/if-post-down.d/wireless-tools
./network/if-post-down.d/wpasupplicant
./network/interfaces
./network/if-up.d
./network/if-up.d/ntp
./network/if-up.d/clamav-freshclam-ifupdown
./network/if-up.d/ntpdate
./network/if-up.d/avahi-daemon
./network/if-up.d/sendmail
./network/if-up.d/avahi-autoipd
./network/if-up.d/wpasupplicant
./network/if-up.d/mountnfs
./network/if-pre-up.d
./network/if-pre-up.d/wireless-tools
./network/if-pre-up.d/wpasupplicant
./network/if-down.d
./network/if-down.d/clamav-freshclam-ifupdown
./network/if-down.d/sendmail
./network/if-down.d/avahi-autoipd
./network/if-down.d/wpasupplicant
./networks
user@host:/etc$ ll ./rcS.d/S40networking
lrwxrwxrwx 1 root root 20 2007-05-20 18:48 ./rcS.d/S40networking -> ../init.d/networking

FOUND IT: In this case the netwoking script that runs on startup is “../init.d/networking”

Step 2. Extract “start” case into a separate method:

user@host:/etc$ sudo vi ../init.d/networking

here is a “start case” in the original file:

case "$1" in
start)
	log_action_begin_msg "Configuring network interfaces"
        type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 120" || true
	if [ "$VERBOSE" != no ]; then
	    if ifup -a; then
		log_action_end_msg $?
	    else
		log_action_end_msg $?
	    fi
	else
	    if ifup -a >/dev/null 2>&1; then
		log_action_end_msg $?
	    else
		log_action_end_msg $?
	    fi
	fi
        type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 15" || true
	;;

let’s modify it by extracting the “start case” into a separate method so it can be run as a background process on the start up:

here is a “start case” in the modified file:

# adding this method so it can be run as a background process on the start up
start_on_boot () {
 
	log_action_begin_msg "Configuring network interfaces"
        type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 120" || true
	if [ "$VERBOSE" != no ]; then
	    if ifup -a; then
		log_action_end_msg $?
	    else
		log_action_end_msg $?
	    fi
	else
	    if ifup -a >/dev/null 2>&1; then
		log_action_end_msg $?
	    else
		log_action_end_msg $?
	    fi
	fi
        type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 15" || true
}
 
case "$1" in
 
start)
 
	# start networking on the background, so it does not slow down the boot time
	start_on_boot &
 
	;;

Save the file, reboot and enjoy

DONE :)

Interesting related articles:

making ubuntu boot in 19 seconds
understanding bash fork bomb


02
Aug 08

Make rails.vim Work: Compile VIM From Sources

rails.vimEver heard about rails.vim project? “Accept no imitations: rails.vim is the one true Vim plugin for syntax highlighing, easy navigation, and script invocation for all your Ruby on Rails applications, transparently and unobtrusively” says creator Tim Pope.

The very good “rails.vim” guide can be found here or just by reading project’s vimdoc here.

PROBLEM:

There is however one gotcha for Ubuntu Hardy Heron lovers (or other modern Linux distros). Using rails.vim would result in VIM “segmentation fault”crashes similar to:

Vim: Caught deadly signal ABRT
Vim: Finished.
Aborted

REASON:

This is due to the fact that a packaged VIM that comes from some Linux distros repositories has old patches.

SOLUTION:

One of possible solutions would be to download most current VIM sources from http://www.vim.org/sources.php and compile/install it manually. Below is how it is done on Ubuntu (but should be pretty similar on any Linux distro):

1. Get vim sources:

wget ftp://ftp.vim.org/pub/vim/unix/vim-7.1.tar.bz2

(where ‘7.1’ is the current VIM version at the moment of writing)

2. Unpack it

tar -xvjf vim-7.1.tar.bz2

3. Install terminal libraries (vim needs them to compile correctly)

sudo apt-get install libncurses5-dev

4. Configure / Compile / Install

./configure --with-features=huge
make
sudo make install

5. Point your system to newly compiled VIM:

sudo rm /etc/alternatives/vi
sudo rm /etc/alternatives/vim
sudo rm /etc/alternatives/vimdiff
 
sudo ln -s /usr/local/bin/vim /etc/alternatives/vi
sudo ln -s /usr/local/bin/vim /etc/alternatives/vim
sudo ln -s /usr/local/bin/vimdiff /etc/alternatives/vimdiff

DONE


15
Jul 08

Forward VNC through SSH

linuxmce screenshotFrequently I need to access my LinuxMCE machine over VNC, due to different reasons (when I am not home, when my Wii Remote batteries died, etc..). Usually SSH solves most of my needs, but sometimes it is very nice to control my linuxMCE box over VNC.

Here I will show you several very easy steps on how to configure your server/client to be able to tunnel VNC traffic through SSH, and be able to control your server in the GUI way :) This approach will work on most systems (not LinuxMCE specific) although here I chose Ubuntu as an “example OS”.

Before we begin, I would assume that:

  • The server already has ssh server installed, if not:
    sudo apt-get install openssh-server
  • If connecting from the outside (like from work to home box), your router’s firewall forwards port 22 to your server’s IP

Here is how it is done:

Server Side Configuration

1. Installing VNC server, here I chose to install x11vnc, but it could be pretty much any VNC server of your choice (TightVNC, etc..):

sudo apt-get install x11vnc

2. Now let’s finish :) our server configuration by running the VNC server:

x11vnc

by default it is going to run without a password, and on port 5900

Client Side Configuration

1. In order to connect to the VNC server, we need to have a VNC viewer installed:

sudo apt-get install xvncviewer

* again, it can be pretty much any VNC viewer of your choice

2. Now the most interesting part of this whole process – enter this command:

ssh -L 5900:127.0.0.1:5900 yourusername@yourserver.com

this tells your system to tunnel all the traffic from the port 5900 on “yourserver.com” to the local (client’s) port 5900 via SSH. Simple, and yet very powerful – a “magic one-liner” :)

3. Fire up another shell on the client side and enter:

xvncviewer 127.0.0.1

do you see a cute colorful square screen? Do you recognize your server’s Desktop?

Done :)


P.S. For LinuxMCE specifically, you should also add a couple firewall rules:

– Go to the LinuxMCE web admin
– From the upper menu, go to “Advanced -> Network -> Firewall rules”

add this three rules:

tcp  	5900 to 5900  	5900  	192.168.80.1             port_forward
tcp 	5900 to 5900 	0 	0                        core_input
tcp  	22 to 22  	0  	0                        core_input

– The first rule allows external network (Internet) to access the VNC server on the Core (LinuxMCE server)
– The second rule allows anybody inside the home network ( since it is not wise to open 5900 port on your router to the whole world ) to have their 5900 port to be forwarded to the Core.
– The third rule (I think you already have it) allows anybody to access LinuxMCE server via port 22 (SSH)

Be careful about the rules above, as I assume that your LinuxMCE server is behind another firewall, cause you really do not want to open 5900 port to the public