Tomcat and mysql java deployment environment

Quickly build java environment for the development of new projects in time to get the test, which is a basic requirement for a system engineer. Ado, here I share the project experience:

1. Installation configuration tomcat and mysql, java environment

My system environment: rhel6.3, yum environment has been configured, do not know how to configure yum please visit: http://stlong.blog.51cto.com

installation:

[root@localhost ~]# yum install tomcat* #安装tomcat

[Root @ localhost ~] # yum install mysql * # install mysql and its tools

[root@localhost ~]# yum install java* #安装java

Configure mysql and tomcat:

[Root @ localhost ~] # rpm -ql mysql-server # mysql-server installation view all files

[Root @ localhost ~] # cp /usr/share/mysql/my-medium.cnf /etc/my.cnf # build mysql configuration file

[Root @ localhost ~] # vim /etc/my.cnf # editorial adjustments mysql

[Mysql] ## client module add the following line

default-character-set = utf8 # Set the default language for the mysql utf8

[Mysqld] ## the server module, add the following line

default-character-set = utf8 # Set the default language for the mysql utf8

[Root @ localhost ~] # /etc/init.d/mysqld start # start mysql service

[Root @ localhost ~] # /etc/init.d/tomcat6 start # start the tomcat service

[Root @ localhost ~] # chkconfig tomcat6 on # boot

[root@localhost ~]# chkconfig mysqld on

2. Upload project

Use pscp.exe (a small green software, no installation, can be pscp.exe copied to the folder where the project file is in use, using these methods) software to upload project in the windows command prompt:

D: \> pscp jboa.war [email protected]: / var / lib / tomcat6 / webapps / #### pscp on behalf of the command body, jboa.war is the name of the project, as the root of the jboa.war copied to 192.168 / var / lib / tomcat6 on .8.63 server / webapps directory

3. Debugging Project: Verification Project in linux

[root@localhost ~]# ls /var/lib/tomcat6/webapps/

jboa jboa.war

[root@localhost ~]# cd /var/lib/tomcat6/webapps/

[Root @ localhost webapps] # mv jboa.war ROOT.war # project will be renamed ROOT.war, when such access is the default project

[root@localhost ~]# service tomcat6 restart #重启tomcat

[Root @ localhost ~] # mysqladmin -uroot password "123123" # set a password to the database

[Root @ localhost ~] # mysql -uroot -p123123 # login database, u specified user, -p specify a password

mysql> create database jboa; # create database

Query OK, 1 row affected (0.02 sec)

mysql> use jboa; # use database

Database changed

mysql> show tables; # View table

Empty set (0.03 sec)

[Root @ localhost ~] # mysql -uroot -p123123 jboa <jboa.2013-02-02.sql # into the database

[Root @ localhost ~] # mysql -uroot -p123123 # Log database

mysql> use jboa # use database

Database changed

mysql> show tables; # View Data Sheet

+----------------------+

| Tables_in_jboa |

+----------------------+

| ac_function |

[root@localhost classes]# service tomcat6 start #启动tomcat

Starting tomcat6: [OK]

Note: The items in connection with the password database file and must be consistent and mysql, otherwise can not connect. Save this password page document can ask developers because they are defined in this document. In general: the / var / lib / tomcat6 / webapps / ROOT / WEB-INF.

Also note that firewall and selinux closed until after the end of the test you want to set rules:

Setenforce 0

Iptables –F

In the browser input: project http://192.168.8.63:8080 access deployments :

clip_image002

Guess you like

Origin blog.51cto.com/14380057/2407777