Configuration and project deployment of tomcat + mysql in centos _ MySQL

Source: Internet
Author: User
Centos tomcat + mysql configuration and project deployment CentOSTomcat

TOMCAT server configuration

1. jre installation

1.1 View and uninstall the original JDK from centos

[root@balakids home]# java -version|grep gcj [root@balakids home]# yum -y remove java java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

1.2 Copy jre-6u38-linux-x64-rpm.bin to directory/opt

cp /home/jre-6u38-linux-x64-rpm.bin /opt/.

1.3 grant the execution permission to the file

chmod +x /opt/jre-6u38-linux-x64-rpm.bin

1.4 run this file to install jre

[root@balakids jre]# ./jre-6u38-linux-x64-rpm.bin  Unpacking... Checksumming... Extracting... UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).  inflating: jre-6u38-linux-amd64.rpm  Preparing...                ########################################### [100%]    1:jre                    ########################################### [100%] Unpacking JAR files...     rt.jar...     jsse.jar...     charsets.jar...     localedata.jar...     plugin.jar...     javaws.jar...     deploy.jar...   Done.

1.5 View java version

[root@balakids jre]# java -versionjava version "1.6.0_38" Java(TM) SE Runtime Environment (build 1.6.0_38-b05) Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)

2 tomcat configuration

2.1 decompress the tomcat package and move it to the desired location

[root@balakids home]# tar -xvf apache-tomcat-6.0.39.tar.gz [root@balakids home]# mv apache-tomcat-6.0.39 /usr/local/tomcat

2.2 Copy the tomcat startup script

[root@balakids conf]# cd /usr/local/tomcat/bin [root@balakids bin]# cp catalina.sh /etc/init.d/tomcatd[root@balakids bin]# chmod +x /etc/init.d/tomcatd

2.3 Change the tomcat startup script to the JRE and TOMCAT directories.

[Root @ balakids ROOT] # rpm-ql jre // query the JRE installation location [root @ balakids conf] # vim/etc/init. d/tomcatd JRE_HOME =/usr/java/jre1.6.0 _ 38 CATALINA_HOME =/usr/local/tomcat

2.4 configure user management for tomcat // optional operations

[root@balakids conf]# vim /usr/local/tomcat/conf/tomcat-users.xml  
      
     
     
   
   [root@balakids conf]# /etc/init.d/tomcatd start

2.5 test using IP address in the browser. The local IP address is 10.10.54.178 and the port number is 8080.


The configured user management is used to access the options on this page.

3 install the required dependency package for mysql5.1.50 3.1

// Previously, yum source was created.

[root@balakids mysql-5.1.50]#yum install gcc-c++ gcc libtermcap-devel.x86_64 -y


3.2 mysql decompression, compilation, and installation

[root@balakids home]# tar xvf mysql-5.1.50.tar.gz[root@balakids home]# cd mysql-5.1.50 [root@balakids mysql-5.1.50]#./configure --prefix=/usr/local/mysql --datadir=/data/mysql --with-charset=utf8 /--with-extra-charsets=complex / --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock / --with-pthread --enable-assembler --with-mysqld-ldflags=-all-static / --with-client-ldflags=-all-static / --with-plugins=partition,archive,csv,federated,heap,innobase,myisam,myisammrg,innodb_plugin,ndbcluster / --with-mysqld-user=mysql[root@balakids mysql-5.1.50]# make && make install

3.3 Create a mysql User and change the user to which the directory belongs.

[root@balakids mysql-5.1.50]# useradd mysql -s /sbin/nologin [root@balakids mysql-5.1.50]# chown mysql.mysql /usr/local/mysql/ -R [root@balakids mysql-5.1.50]# chown mysql.mysql /data/  -R

3.4 copy the configuration file and startup script-copy it in the decompressed package

[Root @ balakids mysql-5.1.50] # cp support-files/my-large.cnf/etc/my. cnf [root @ balakids mysql-5.1.50] # cp support-files/mysql. server/etc/init. d/mysqld [root @ balakids mysql-5.1.50] # chmod + x/etc/init. d/mysqld // modify the configuration file and add the Vim/etc/my directory of datadir. cnf [mysqld] datadir =/data/mysql

3.4 initialize the database

[root@balakids mysql-5.1.50]# /usr/local/mysql/bin/mysql_install_db --user=mysql

If you specify the basedir directory during initialization, the following ERROR is reported: fatal error: cocould not find errmsg. sys.

3.5 add environment variables

[root@balakids mysql-5.1.50]# vim /etc/profile.d/mysql.sh PATH=$PATH:/usr/local/mysql/bin [root@balakids mysql-5.1.50]# source /etc/profile.d/mysql.sh

4. deploy the balakids project. local IP address: 10.10.54.178

Copy the project to webapps under tomcat

4.1 change the Balakids project to the mysql database as the root user and the password as mysql.

[root@balakids lib]# mysqladmin -uroot -p123456 password 'mysql' mysql> update user set host='10.10.54.178' where host='localhost';

// Of course, you can re-create the user on your own, but do not forget to change some files in the project, the following describes the content to be configured in the project. 4.2 modify the tomcat configuration file

[root@balakids tomcat]# vim /usr/local/tomcat/conf/server.xml
 
  
 

// The default defaultHost in the above configuration file is localhost and changed to the local IP address.

4.3 The most important file in the file project to be noted in the project is the connection to the database. in this case, context. xml

Absolute path:/usr/local/tomcat/webapps/balakids/META-INF/context. xml

The content is:

 
  
          
  
   
  
 

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.