Thursday, May 19, 2011

JBoss 5.1.0GA with Ubuntu 10.04

That was the first time that I tried to install Jboss server on a linux platform(it doesn't mean that I installed it on a different OS :P). After downloading "installation and getting started guide", I started to follow installation steps and configure our server environment. I won't rephrase what is already written in the guide so I want to share some important points that may help you. 

1. Configure your java environment: If sun jdk is not installed on your system, you have to start with this step. 
  • DO NOT forget adding java related environment variables for your users. It is a good idea to set those variables within .bashrc files. Add those lines to your files:
    export JAVA_HOME=/usr/java/jdk_versionNo
    export PATH=$PATH:$JAVA_HOME/bin

    Update your java home path as you prefer.
  • DO NOT forget to update your java alternatives. Because it is possible that you have more than one java installation, and you have to tell your system which java version to use. Use the command:

    $ update-alternatives --config java

    Note: It is possible that you don't see your previously downloaded java version. In this case, you have to manually add this option using the command:

    $ update alternatives --install "/usr/bin/java" "java" "/usr/lib/Java6/bin/java" 1

    Parameters are respectively as the following: system-wide java command, for "java", your previously installed java installation path and priority. After adding this option, you can update your java version as described above.
2. Download JBoss: In my case, I downloaded binary zip file of JBoss 5.1.0GA, and extracted files to a folder.

3. Set the JBOSS_HOME variable: As we set java environment variables, this time we will set jboss related environment variables. You will edit .bashrc files of your users, and specify jboss home path by adding those lines:

export JBOSS_HOME=/usr/jboss/jboss-release_no
export PATH=$PATH:$JBOSS_HOME/bin
Update your jboss home location as you prefer. 

4. Test your installation: The most exciting part is this step :) Simply, you go to JBOSS_HOME/bin directory and execute "run.sh" script as the following:
$ ./run.sh
Note that you need to have privileges to execute this command. 

If everything goes well, go to "localhost:8080" page on your favourite web browser, then you will see a jboss welcome page. Good news! :) Note that instead of "localhost", you have to type "127.0.0.1" for some systems. 

If there is no other application using your 8080 port, and you work on a local machine, all steps described above will help you to set up your jboss server. I needed to work more on it because I did this installation on a server environment, thus I needed to start Jboss on a specific ip using 8080 as port number. Again you need to execute "run.sh" script but with additional parameters:
$ ./run.sh -b "ip_number"
That command will start Jboss server on this ip with the default port 8080. 

Everything is going well, we started the server without any problem. BUT.. Of course, we need additonal things!.. What if your system reboots? Jboss won't start because we didn't do anything about it. So let's work on a init script. This page helped me to do things right. 

5. Add an init script: In our JBOSS_HOME/bin directory, you will see some init script example files. I used "jboss_init_redhat.sh" as a template, modified jboss home, jboss user, java path, jboss bind address(-b parameter value) settings. Find this line:
JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"} and above this line insert this one:
JBOSS_HOST=${JBOSS_HOST:-"ip_number"} If not specified Jboss server will start on localhost. 

Then, rename this file as "jboss" and move it to your "/etc/init.d" directory.
  • DO NOT forget to make this script executable. And again, take care of user access rights as necessary according to your needs. 
  • Use this command to create necessary symbolic links for yout init script:
    /etc/init.d/$ update-rc.d jboss defaults
    Now your script will run on boot up.
6. Test and update your init script: Run the following command:
$ service jboss start
It works as expected, you can check it by opening "localhost:8080". But when trying to stopping the server, I had many errors and server didn't shut down.  This is because, we need to add "host" parameter to our shutdown command. Find the line beginning with "JBOSS_CMD_STOP" and update it as the following:
JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP org.jboss.Shutdown --shutdown -s jnp://${JBOSS_HOST}:1099"} Bold text is the part that you have to add to this line. 

After this modification use those commands for following actions:
service jboss start --> start jboss server
service jboss stop --> stop jboss server
service jboss restart --> restart jboss server

7. (optional) Adding logging feature to your init script: Default server log files are included in:
$JBOSS_HOME/server/$JBOSS_CONF/log/ directory. JBOSS_CONF is default, minimal etc as you specified in your script file. By default, it is set to be "default". So I prefered to log init script logging in this directory, you can specify any other folder if you want. To add logging functionality to your script, update your script as the following:
JBOSS_CONSOLE="$JBOSS_HOME/server/$JBOSS_CONF/log/init_script.log" So you replace "/dev/null" by a real file. 

8. (optional) Upload your java project: After opening "localhost:8080" page, click on "Administration Console" link. Default user/pass is "admin"/"admin". You can use this page to manage your Jboss server. Go to "Web Applications" link and upload your project. 

If you want to change user settings, or add new users for administration console, you can simply edit ..server/configuration/conf/props/jmx-console-users.properties
..server/configuration/conf/props/jmx-console-roles.properties
files in your system.

Hope this blog post will help you. Enjoy it :)

Wednesday, March 30, 2011

Switching from Chrome to Firefox 4.0

For a while, I was using Chrome browser which was fast, fancy and easy to use. I haven't thought about switching from Chrome to another browser, before reading this post. I loved the idea to customize a browser. And it is true that, Chrome is not allowing its users to customize it in the way that users are comfortable with.

Also check this post, if you want to use Firefox title bar as the container of your tabs and window controls(close, minimize and maximize buttons). Note that this solution works for linux users.

At a first glance, I can say that Firefox 4 is as fast as Chrome now. Let's see, what is coming next..  Ohh.. Here is a screenshot from my Firefox 4:



(Click on the image above, to see a larger version)












Saturday, February 26, 2011

Setup Cisco VPN using VPNC Ubuntu 10.04

This post will help you to setup Cisco VPN on a linux distribution, Ubuntu 10.04 in my case. If you google about it, you will find many many solutions to setup it. I tried many of them, got frustrated then. And here you can find that solution which worked well for me, and I hope it will be useful for you too.

First of all, we need to install vpnc framework.

$ sudo apt-get install network-manager-vpnc

Then, browse to the vpnc installation directory as a root user.

$ cd /etc/vpnc

It's a good idea to create a configuration file once, then use it whenever you want to use vpn. "default.conf" file is the default configuration file that will be used by vpnc by default. So let's create this file.

$ touch default.conf

Now, you have to edit this configuration file with your favourite text editor. Put the lines below and modify bold text with your settings:


IPSec gateway hostName
IPSec ID groupName -- used for connecting to the hostname defined previously
IPSec secret groupPassword -- used for connecting to the hostname defined previously 
Domain domainName -- (optional) use a domain name if necessary
Xauth username userName -- used for authentication
Xauth password password -- used for authentication


And now we are ready to use our connection. Open a terminal and write that command.

$ sudo vpnc-connect

If everything goes well, we can see that our connection is established and running in background.


Connect Banner:
| Authentication OK
| Welcome on  VPN

| Don't forget to disconnect you at the end of your session!!!!



VPNC started in background (pid: 10351)...


As mentioned above, when you're done with that connection do not forget to disconnect you. You can do it using the following command:

$ sudo vpnc-disconnect

And you have to see something like that:

Terminating vpnc daemon (pid: 10351)


Note that the pid corresponding to this process is the same(10351 in my case), as expected. Otherwise it means that you killed a different process :P

You don't have to keep your configuration details in a file, you can just provide this information at run time, using the interactive mode of vpnc framework. For that, use this command:

$ sudo vpnc

And it will ask your connection settings, as mentioned above, and then, your connection will be established. You can use the same command to disconnect you at the end of your session.

Hope it helps..

Sunday, December 19, 2010

How to run Internet Explorer 6.0 on Ubuntu Lucid Lynx

Well, I am not a big fan of Windows and related Windows applications.. As you can guess, sometimes we need to run some OS dependent applications on different systems..

Wine is a quite popular "free" software to run Windows applications on other operating systems.. I can say that it works like a charm on Ubuntu..

Today, I needed to run Internet Explorer on my Ubuntu.. Of course, first thing to do is googling about it.. But as it is a common topic, I found many many entries about that topic.. Installed too many things, then deleted them.. And all this process took me a long time..

At the end, I realized that the solution was really easy.. He he.. And this is why I am writing these lines for you guys.. Here is how to do:

$ sudo apt-get install wine

And you have to install all the dependencies for that package.. Note that a package called "winetricks" is also installed.. and this is our "key" package! :)

After that installation, you are ready to install Internet Explorer 6..

$ winetricks ie6

Then you will be prompted by an installation window.. Just follow the instructions, it takes 10 minutes to have an Internet Explorer running on your linux distribution.. :)

Then create an application launcher for your browser. Note that command will look something like:

wine "C:\Program Files\Internet Explorer\IEXPLORE.EXE"

He he.. Then enjoy with your new browser.. Of course not always.. but when you need it!.. Arghh!..

Sunday, October 31, 2010

Ubuntu 10.10 on a Tablet PC: HP 2730p

If you have one of these cool Tablet PC's, you probably have a Windows operating system installed on it.. Don't you think that it is time to switch to a Linux distribution?.. And that was exactly what I had been thinking for a quite time.. I got bored of all Windows applications and its neverending problems.. Additionally, I'm the kind of person who is not able to use Windows Vista =) Sooo big time!..

First of all, there is always some risks to take.. because it is difficult to be sure, if everything will function properly or not.. Well, I thought of the worst case which is using that Tablet PC as a normal laptop PC without tablet functionalities =) Ok, this is still a big risk, but anyway I decided once and went for it..

Am a fan of Ubuntu, so I wanted to install Ubuntu 10.10(latest version for now) on HP2730p.. Everything went well, Ubuntu installation was completed in 15-20 minutes.. I didn't have any driver problems, so I was in the worst case now =)

After googling around, I found some nice softwares for Tablet PCs:
  • Cellwriter: It's a grid-entry natural handwriting input panel.. And I can say that it works like a charm.. After spending 5-10 minutes for the training part, it recognizes quickly your handwriting..
  • Xournal It's an application for notetaking, sketching, keeping a journal using a stylus. It's also a very nice application that you can use for taking notes.
I also configured Gimp and InkScape by enabling tablet input devices such as stylus, eraser and cursor; which is described in Ubuntu Community page.

Everything was fine, but I realized that I had some problems related to screen rotation.. because as an example, while reading an e-book, it is better to rotate the screen.. Googled about it, many solutions many scripts.. tried many of them.. some worked but not completely.. then, I combined some solutions and finally had that feature working..

I suppose that you have "wacom-tools" package installed, if not please install it first.. Then, type on a terminal:

$ xinput --list

You'll have an output similar to that one:

⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ HID 04b3:3107 id=10 [slave pointer (2)]
⎜ ↳ PS/2 Generic Mouse id=12 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)]
↳ Serial Wacom Tablet stylus id=15 [slave pointer (2)]
↳ Serial Wacom Tablet eraser id=14 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ CKA7240 id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
↳ HP WMI hotkeys id=16 [slave keyboard (3)]

Important entries are represented as bold text.. Now, we will use this information to rotate the screen and related tablet input devices.. I modified these two scripts written by "Justin Linuturk Phelps", to have screen rotation functionality for my case..

1. laptopmode.sh
#!/bin/bash

xrandr -o normal && xsetwacom set "Serial Wacom Tablet stylus" Rotate none && xsetwacom set "Serial Wacom Tablet eraser" Rotate none
exit 0

This mode is your normal mode that you can use without tablet pc functionalities..

2. tabletpcmode.sh
#!/bin/bash

xrandr -o right && xsetwacom set "Serial Wacom Tablet stylus" Rotate CW && xsetwacom set "Serial Wacom Tablet eraser" Rotate CW
exit 0

This mode is your tablet mode that you can use with a screen rotation..

Replace bold texts, with the outputs that you get when listing inputs..

After saving these two files as scripts(with .sh extension), move them to /usr/local/bin folder and then, type in a terminal:
/usr/local/bin$ sudo chmod +x laptopmode.sh
/usr/local/bin$ sudo chmod +x tabletpcmode.sh

Now, these scripts are executable by the user.. It is easier to create application launchers, instead of running scripts from a terminal..
1. Right click on your Ubuntu panel, and choose "Add to Panel"..
2. Double click on "Custom Application Launcher", as a name type: "Laptop Mode" and as the command type: "laptopmode.sh". You can also change the icon of your custom application.
3. Click ok.

Do the same thing for "Tablet Mode" application launcher..

Finally, you have two icons on your panel that you can use to switch from Laptop Mode to Tablet Mode and vice-versa.. Hope this helps.. Thankfully, I made a good choice and it works perfectly.. Thanks to everyone who submitted useful information on web...