11 October 2009
03 October 2009
Install jboss as daemon (autostart at boot)
This guide will let you run jboss as a daemon, that means you'll have a jboss instance that starts a computer boot. When you download jboss you get some example init scripts for different distributions but none for ubuntu. I did however get it to work with minor changes to the red hat init script. This is how I did it, there might be some better way and if you find better solutions than the ones in this guide please let me now and I'll post them here.
At the end of this tutorial you will have (if everything goes as planned) a jboss instance running that starts at computer boot with the help of a daemon script in /etc/init.d/. To keep things tidy jboss will have a separate user called jboss as process owner.
Ubuntu versions tested
Ubuntu 7.10 32 bit Server Version
Ubuntu 7.10 32 bit Desktop Version
Step 1: Install suns jdk
There have been problems reported with jboss and java 6 in the past. I don't know if there still is compatibility issues but to be safe I use java 5.
The reason to use a separate user account for jboss is to control the permissions of the jboss instance. You don't want jboss running as root with unlimited access to the whole system. There is no password created for the jboss user, and you probably don't need one either (unless you actually want to login as the jboss user).
Go to http://labs.jboss.com/jbossas/downloads/ and get the latest stable version of jboss (4.2.2.GA when this guide was written). Download it to your home directory.
Now you have a file in ~/jboss-4.2.2.GA.zip
I used unzip to extract the archive, to install it run
sidenote:
When I installed jboss on my server I installed it in the /opt/folder instead of /home/jboss/. Where ever you decide to put jboss make sure the jboss user has read and write permission to the jboss folder and it's subfiles/-folders.
Move it to jboss home and extract it. To make a future upgrade of jboss a little easier a symlinc to jboss home is created. When you decide to upgrade jboss you'll just have to edit the symlinc to point to the new version.
All the changes to the red hat init script is in the setup section in the beginning of the script. If you followed my guide to the letter you can download my version of the script thats attached to this post. If you installed java or jboss in other directories it's probably easier to edit the script your self.
Option 1: download my script
Download the scriptattached to this post to your home folder then run this to move it to the correct folder.
Option 2: edit the original red hat script yourself.
Copy the red hat init script to the init.d directory and rename it.
Step 6: Install the init script
Make your script owned by root and executable.
Create run level shortcuts for the script.
Step 7: Redirecting traffic from port 80 to jboss port 8080 (Optional)
The default port for jboss is 8080 but the standard port for http traffic is 80. Port 80 is however a restricted port and can only be bound by root. To get around this little pickle you can redirect the incoming traffic on port 80 to 8080, the same goes for the https traffic on port 443 to jboss 8443. Here's a way to do that.
Remove
If you found a better way to do this or if you just don't want this installed anymore here's what you do.
Warning! All files will be removed from your sytem.
Remove the init daemon script
Some Basic Linux Command
Some Basic Linux Command
Searching and Installing packaages on Centos
yum search jdk
This will find out all available package with name jdk
yum install java-1.6.0-openjdk
This will install package java-1.6.0-openjdk
To See all running services
ps -Al
ps -a
This is like task manager of windows. It will show all proccess being running in console
Download file/folder from internet
lwp-download http://www.perl.com/CPAN/src/latest.tar.gz
and
wget http://www.perl.com/CPAN/src/latest.tar.gz
This will download latest.tar.gz from given url
Create and Edit file
vi filename
saving file
ESC + : +wq
Quit without saving
ESC + : q!
Creating folder
mkdir foldername
Deleting file
rm filename
rm file1 file2 ------ deleting multiple files at a time
Deleting folder
rm –rf foldername
Open File and See content
cat filename
Finding File
find -name ‘*.txt’
and
locate "*.c" -n 10 ---- -n 10 limit result to 10
Copy file to directory
cp file dir1/dir2
Copy folder to directory
cp –r folder dir1/dir2
Renaming file
mv filename1 filename2
Moving file to directory
mv file dir1/file2
Find all username who has currently login
who
Find username of me
whomi
Send message to other user
write username/ip
Change permission on file
chmod 777 filename
Point Tables
R W X
4 2 1
Owner Group Other
Owner = rwx = 4+2+1=7
Group = rwx = 4+2+1=7
Other = rwx = 4+2+1=7
Text Editor Commads
vi filename
Save changes to buffer
ESC + :w
Save changes and quit vi
ESC +:wq
Save file to new file
ESC +:w filename
Quit without saving
ESC + :q!
Save lines to new file
ESC + :10,15w file
Restarting Server
reboot
start/stop/restart services
service httpd start
service httpd stop
service httpd restart
Stoping firewall
iptables stop