I new in the ubuntu and i install java in this using oracle VM virtual box. I download jdk after what doing for java install and than after install apache tomcat 7. please help me both software install in ubuntu. Thanks .
1 Answers
1- Install Sun JRE 7
Download the sun jre 7 tar file
Extract the tar file:
tar -xvzf jre-7u4-linux-x64.tar.gz
Move extracted folder to this location:
sudo mv jre1.7.0_04 /usr/lib/jvm/
Install new java source in system:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0_04/bin/java 1
Choose default java:
sudo update-alternatives --config java
java version test:
java -version
Verify the symlinks all point to the new java location:
ls -la /etc/alternatives/java*
2- Install Sun JDK 7
Download the sun jdk 7 tar file
Extract the tar file:
tar -xvzf jdk-7u4-linux-x64.tar.gz
Move extracted folder to this location:
sudo mv jdk1.7.0_04 /usr/lib/jvm/
Install new java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_04/bin/javac
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_04/bin/java 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_04/bin/javaws 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.7.0_04/bin/jar 1
Choose default java:
sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws
java version test:
java -version
Verify the symlinks all point to the new java location:
ls -la /etc/alternatives/java*
3- Install Tomcat
to install tomcat easily
sudo apt-get install tomcat7
4- Autostart Tomcat when booting
Create the init script in /etc/init.d/tomcat7
#!/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
start() {
sh /usr/share/tomcat7/bin/startup.sh
}
stop() {
sh /usr/share/tomcat7/bin/shutdown.sh
}
case $1 in
start|stop) $1;;
restart) stop; start;;
*) echo "Run as $0 <start|stop|restart>"; exit 1;;
esac
Change its permissions and add the correct symlinks automatically:
chmod 755 /etc/init.d/tomcat7
update-rc.d tomcat7 defaults
And from now on it will be automatically started and shut down upon entering the appropriate runlevels.
- 87,123