Set up a Java platform in the Jsp environment in Linux Tomcat install MySQL installation configuration

Source: Internet
Author: User
Install software 1. install JDK (because JDK contains JRE, if JRE is installed when LumaQQ is installed, uninstall the JRE rpm Package first to save MB of space) (1) install: # cd/tmp/myDown #. /jdk-1_5_0-linux-i586-rpm.bin so JDK is installed to/usr/java/jdk1.5.0 Directory (2) Edit file/etc/prof install software
1. install JDK (because JDK contains JRE, if JRE is installed when LumaQQ is installed, uninstall the JRE rpm Package first to save MB of space)
(1) installation:
# Cd/tmp/myDown
#./Jdk-1_5_0-linux-i586-rpm.bin
In this way, JDK is installed in the/usr/java/jdk1.5.0 directory.
(2) edit the file/etc/profile and add the following at the end:
Export JAVA_HOME =/usr/java/jdk1.5.0


Export CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib/tools. jar: $ JAVA_HOME/lib/dt. jar :.
Export PATH = $ PATH: $ JAVA_HOME/bin
(3) to make the new configuration take effect, run # source/etc/profile
(4) Test: use a text editor to write a java program for verification and save it in the/tmp/myDown Directory. the file name of www.linuxidc.com is HelloWorld. java. enter the following content:
Public class HelloWorld {
Public static void main (String args []) {
System. out. println ("Hello, Wrold ");
}
}
Then, run:
# Cd/tmp/myDwon
# Javac HelloWorld. java
# Java HelloWorld
If "Hello, World" appears, it indicates that your JAVA compiling and running environment has been set up.
2. install Tomcat
(1) in the graphic environment, click the jakarta-tomcat-5.5.4.tar.gz file icon on the right and select the/usr/local directory.
For ease of use, run the following command on the terminal:
# Cd/usr/local
# Ln-s jakarta-tomcat-5.5.4 tomcat
(2) edit the file/etc/profile and add: export CATALINA_HOME =/usr/local/tomcat at the end.
(3) If you require the system to automatically start tomcat upon startup (this step is not required if you do not have this requirement), change/usr/local/tomcat/bin/startup. sh:
Export JAVA_HOME =/usr/java/jdk1.5.0
Export CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib/tools. jar: $ JAVA_HOME/lib/dt. jar :.
Export PATH = $ PATH: $ JAVA_HOME/bin
Export CATALINA_HOME =/usr/local/tomcat
/Usr/local/tomcat/bin/catalina. sh start
Add/usr/local/tomcat/bin/startup. sh to/etc/rc. d/rc. local.
(4) run # source/etc/profile to make the configuration take effect. run/usr/local/tomcat/bin/startup. sh to start tomcat.
(5) for testing, enter [localhost: 8080] in the browser. if the welcome page of Tomcat appears, the installation is successful.
Install mysql
First, check whether mysql is installed on the system. If yes, uninstall it.
Rpm-qa | grep mysql
Note that mysql is case sensitive and case sensitive.
Rpm-e -- nodeps mysql *
Be sure to use -- nodeps to uninstall without checking the dependency. Create a user mysql
Groupadd mysql
Useradd-g mysql
Passwd mysql creates a mysql folder under/usr/local
After that, the installation file will be uploaded to the server. the tar.gz file is used, and the rpm package can be used. However, the rpm Package cannot specify the installation directory, so it is not used.
Tar zxvf mysql-5.0.45.tar.gz
Cd mysql-5.0.45
./Configure -- prefix =/usr/local/mysql -- with-charset = gb2312
Specify the installation directory as/usr/local/mysql and the character set as gb2312.
Make
Make install
Install and restart
First, let's change the ownership of the MySQL directory and file to the mysql User and root group:
# Cd/usr/local
# Chown-R mysql: root mysql-3.22.21-pc-linux-gnu-i686 mysql


Then run a small script program to create the initialized MySQL database. Please complete this task as a mysql User, which is the only opportunity for us to directly use this account.
# Su mysql
$ Cd mysql
$ Scripts/mysql_install_db
$ Exit
If no error information is displayed, you can.

Automatically run MySQL

In the MySQL binary package, there is a startup script program named myslq. server. Copy it to the/etc/rc. d/init. d Directory:

# Cd/etc/rc. d/init. d
# Cp/usr/local/mysql/support-files/mysql. server mysql

Change its attribute to "x" (executable, executable)
# Chmod + x mysql

Run chkconfig to add MySQL to the startup service group of your system.
#/Sbin/chkconfig -- del mysql
#/Sbin/chkconfig -- add mysql

Test MySQL

MySQL has a simple database example test, and its internal database keeps monitoring of permissions and accounts, so run mysql first to see if it can work.
Start MySQL first:
#/Etc/rc. d/init. d/mysql start (#/usr/local/mysql/support-files/mysql. server start)
If everything is normal, you will see the following information:
Starting mysqld daemon with databases from/var/lib/mysql

Close mysql:
#/Etc/rc. d/init. d/mysql stop (#/usr/local/mysql/support-files/mysql. server stop)
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.