Friday, October 17, 2008

Install Java, Tomcat and MySQL On OpenSUSE 11

We will install the JRE, Tomcat and MySQL for hosting JSP application website. Most of the installation will be done through the YaST management tools.

Launch YaST

Computer --> YaST (at system menu) --> enter root password --> Software (at YaST control center) --> Software Management.

Install JRE

1. We will require JRE in order to run Tomcat later. If you wish to do a development using Java programming, you may install both JDK and JRE together. At the filter field, type jdk.

2. Select java-1_6_0-openjdk for JRE (or java-1_6_0-openjdk-devel for JDK – for development). Next, click the Install button. Click Apply to download and install.

Install Tomcat
1. Download the tomcat 5.5 from http://tomcat.apache.org/ and saved it to desktop. Here, apache-tomcat-5.5.26.tar.gz been used. Right click on the file and click on Extract Here.

2. Rename the folder to tomcat for easier to remember the folder name. It is good idea to move the tomcat to /usr/local directory.

3. Type the command sudo mv tomcat-on-your-desktop-path /usr/local

4. You need to tell the tomcat where the JRE has been installed and to do this you need to define the JAVA_HOME environment variable in .bashrc file.

5. At the terminal, type the command gedit ~/.bashrc
6. At the end of the file type export JAVA_HOME=your/java/home and save the file.

7. Start the tomcat with the command: sh /usr/loca/tomcat/bin/startup.sh

8. Open the Mozilla Firefox browser and browse to http://localhost:8080 and should see the Tomcat welcome screen.

9. To stop the tomcat, type: sh /usr/loca/tomcat/bin/shutdown.sh

Install MySQL
1. Launch YaST. At the filters field type mysql and select the mysql package to install.

2. You may prompt to insert the openSuse-DVD 11. Insert the DVD and click retry to continue.

3. The installation process will take place.

Friday, August 29, 2008

Server connection failure during transaction. Due to underlying exception: 'java.net.ConnectException: Connection refused'. Attempted reconnect 3 time

Just would like to remind anyone who refering to both Remote Access To MySQL Database and Setup Java, Tomcat, MySQL on Ubuntu (JSP Hosting), do remember to change the datasource property which defined via JNDI.

If you are attempting to connect to the database which sit on localhost or other host, make sure the JDBC driver URL is defined exact same on both JNDI and my.cnf. So, the JNDI would able to point to the right host where the database is sit.



Else not, your web application would not able to connect to the database and you will get error similar as below:

javax.servlet.ServletException: Unable to get connection, DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Server connection failure during transaction. Due to underlying exception: 'java.net.ConnectException: Connection refused'.Attempted reconnect 3 times. Giving up.)"

Thursday, August 21, 2008

Ubuntu Share Folder Using SAMBA

Sharing folder from Ubuntu between the network is very easy. The shared folder can be access by the same platform or Windows using SAMBA services.

Share folder on GNOME @ Ubuntu 8.04.

1. Create a new folder that you want to share.


2. Right click on the folder --> Sharing Options


3. Tick on the Share this folder


4. Click at the Install service.


5. Enter the administrator password.


6. Downloading and installing...please wait.


7. Click the close.


8. Restart the Ubuntu and it should works.

Generally,SAMBA services can be installed by:
1. At the terminal, type sudo apt-get install smbfs to download and install SAMBA.
2. Set the password for the user by sudo smbpasswd -a username. (Be sure you had created the user account. To do this: System --> Administration --> Users and Groups).


Monday, August 18, 2008

Install antivirus for Ubuntu

Download and install AVG
After installed Ubuntu, I would highly recommend to proceed with patches update and install the antivirus. The chances of Ubuntu affected by virus are rare. However, if you are connected within the network, it is recommended to have one. At this moment, I am using AVG 7.5.51 antivirus to protect my file from viruses.

You can download the free AVG from here (.deb). Once downloaded, right click and select Open with “GDebi Package Installer”. Follow the instructions carefully.


Click on the Install Packages button.


Installing..please wait.


Click the close button.


Launch the program and do the update
Once the installation done, you can start AVG by going to Applications -->Accessories -->AVG for Linux Workstation. Do the update to download the latest virus definition.


If you encountered the update problem with the message below, you may need to configure the right permission.


Open the User and Groups panel.


Click on Unlock button and sign in as the power user. Click on the Manage Groups button.


Select the avg group and click on the Properties button.



Tick on the user to assign to AVG group.


Logout and do the update again. You should able to retrieve the update.


Alternative, at terminal you can type sudo avgupdate -o to download the update. The -o parameter indicate online update from the Internet.

Friday, August 15, 2008

Remote Access To MySQL Database

Configure my.cnf
1. We will need to edit the my.cnf file. I am assuming you are using GNOME, so open the terminal and type sudo gedit /etc/mysql/my.cnf

2. Change the bind-address to your server IP address (not to 127.0.0.1). Example, I found out my server IP is 192.168.30.30 by using the ifconfig command. So here are the changes,
bind-address = 192.168.30.30



3. Be sure to comment out the skip-networking.
# skip-networking

4. Save and close the file.

Create MySQL New User Account
** Assuming to create the superuser having all privileges and accessed from localhost and other host.
5. Open terminal and start the mysql program.

6. Type this:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'some_user’@'localhost'
-> IDENTIFIED BY 'some_password' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'some_user'@'%'
-> IDENTIFIED BY 'some_password' WITH GRANT OPTION;



7. Restart the MySQL server by open the terminal and type sudo /etc/init.d/mysql restart