Thursday, March 27, 2008

Tomcat+Java Installation.

Java Installation


I chose to install Sun's Java 2 Platform, Standard Edition, which can be downloaded from http://java.sun.com/j2se/). I chose the J2SE v1.4.2 SDK Linux self-extracting binary file.

Change to the directory where you downloaded the SDK and make the self-extracting binary executable:

chmod +x j2sdk-1_4_2-linux-i586.bin

Run the self-extracting binary:

./j2sdk-1_4_2-linux-i586.bin

here should now be a directory called j2sdk1.4.2 in the download directory. Move the SDK directory to where you want it to be installed. I chose to install it in /usr/java. Create /usr/java if it doesn't exist. Here is the command I used from inside the download directory:


mv j2sdk1.4.2 /usr/java


Set the JAVA_HOME environment variable, by modifying /etc/profile so it includes the following:

JAVA_HOME="/usr/java/j2sdk1.4.2"
export JAVA_HOME

/etc/profile is run at startup and when a user logs into the system, so you will need to log out and log back in for JAVA_HOME to be defined.


You should have to logout from the server to check whether its workgin fine.

exit
su -

Check to make sure JAVA_HOME is defined correctly using the command below. You should see the path to your Java SDK.

Check to make sure JAVA_HOME is defined correctly using the command below. You should see the path to your Java SDK.


TOMCAT Installation


Download it from

http://tomcat.apache.org/

You will install and configure Tomcat as root; however, you should create a dedicated group and user account for Tomcat to run under as follows:

groupadd tomcat

useradd -g tomcat tomcat

tar xvzf apche-tomcat-5.0.28.tar.gz

mv jakarta-tomcat-5.0.28 /usr/local/

chown -R tomcat.tomcat /usr/local/apache-tomcat-5.0.28


cd /usr/local/apache-tomcat-5.0.28/bin

tar -xvzf jsvc.tar.gz


cd jsvc-src

chmod +x configure

./configure

make

cp jsvc ..

cd ..

./startup.sh

open web browser and type http://localhost:8080/ you should see the Tomcat Administration page


go to webapps/ROOT in the tomcat directory and create page hello.html and write in it

Hello Tomcat

open the URL http://localhost:8080/hello.html you should see your page

* Make JSP page

go to webapps/ROOT in the tomcat directory and create page hello.jsp and write in it the following lines

< %=new String("Hello Ahmed Hashim")% >


< %=new java.util.Date()% >




save and run the following URL http://localhost:8080/hello.jsp you should see my Name

* Monitor Tomcat

you can see the log file in the logs directory

* Stop Tomcat

go to the tomcat bin directory

#./shutdown.sh



You can add users in

cd /usr/local/tomcat/conf
vi tomcat-users.xml


And access it at

http://localhost:8080/manager/html

Username : from tomcat-users.xml
Password : l...

Sunday, March 16, 2008

Spamd Failed

Error : spamd failed @ Tue Jan 28 04:20:06 2008. A restart was attempted automatically.

Here is possible way to fix this problem. It appears to happen because of some bad CPAN links setup through cpanel. This should clear it out and hopefully restart spamd.

Logged in as root via ssh do the following:

rm -rf /home/.cpan
rm -rf /root/.cpan
rm -rf /root/.cpcpan
/scripts/updatenow
/scripts/perlinstaller
/scripts/exim4

/scripts/eximup --force
/etc/init.d/exim restart
/scripts/restartsrv_spamd

Hopes this will fix the issue. :)

Saturday, March 15, 2008

Notes

Solaris----Similiar to TOP ---> prstat

ps -el --->full listing of all process running on s/m

prtdiag --->no of cpus present in the s/m

linuz
-------

pkill -9 -u username

Litspeed
--------

/opt/lsws/conf/httpd_config.xml

There are two ways to restart LiteSpeed:

1. Login to LiteSpeed's control panel and go to "Control -> Apply Changes/Graceful Restart".
2. Connect to your account using an SSH client and execute the following commands:

cd ~/webapps/(Application Name)/bin/
./lswsctrl restart

/opt/lsws/bin/lswsctrl restart


MYSQL ROOT PASS RESET
-----------------------------------------


Stop mysql server

/etc/init.d/mysql.server stop

Start mysql in safe mode

/usr/local/mysql/bin/mysqld_safe --user=root --skip-grant-tables --skip-networking &

NOw the mysql will be running in the background in safe mode. You will be able to klogin as root by just using

mysql -u root

Once you got in you can use the following commands to reset the root password.

UPDATE mysql.user SET Password=PASSWORD('qwert123') WHERE User='root'; //Here password is qwert123

FLUSH PRIVILEGES;

Now just quit from the mysql prompt and try using the new password

mysql -u root -p

When it ask for passwprd, provide the new password. It will work.


------------------------------------

http://www.mydigitallife.info/2006/06/06/change-and-reset-mysql-root-password/
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-unix

http://ketan404.blogspot.com/2007/09/mysql-root-password-reset.html

Wednesday, March 12, 2008

RPM Upgrade

rpm -vv --rebuilddb

we have added the option -vv here, so that there is visible progress and lots of detail during the rebuild process -- A worried admin is often impatient at a lack of visible progress -- this option causes the rebuild process to be quite verbose

The way a rpm --rebuilddb command works, it creates a temporary directory to work in at: /var/lib/, next to the 'parent' one at: /var/lib/rpm/ and attempts a rebuild. As it gets to the very bottom of a normal rebuild, it replaces the new content over top of the old files.