0. Create a personal Folder
# use Yum to install Tomcat and MySQL
# Create folders
cd/usr/local
1. Install Rzsz
# 1. Install Rzsz
Yum list lrzsz*
2. Installation Jdk,path and so on has been automatically set up
# 2. Install JDK
Yum list java*
3. Install MySQL
# 3. Install MySQL
yum list mysql*
yum install mysql-server*-y
# Modify/ETC/MY.CNF Set database default encoding and storage location, if possible, optimize memory configuration
3.1 The approximate MySQL configuration file is as follows:
[Mysqld]
# datadir=/var/lib/mysql
datadir=/usr/local/hehe/mysql_data
socket=/var/lib/mysql/mysql.sock
user= MySQL
# Disabling symbolic-links is recommended to prevent assorted
security risks Default-character-set=utf8
[Mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/ Mysqld.pid
[MySQL]
Where the VI default entry is the command mode, to enter the editing mode, you can use the key "I" to represent insert, insert mode.
and exit edit mode, use Esc key, exit edit mode, is in command mode, in command mode input instructions will not be added to the content,
In command mode, direct input line number, such as 22, enter, then the cursor jumps to 22 lines, and use the colon plus the command, you can perform related operations, such as
: Wq is written to the file and exits
: wq! means to force writing to the file and exit, suitable for read-only files or something.
Remember to add the ENTER key.
About MySQL memory settings, you can also refer to: MySQL 5.6 Initial configuration tuning
Of course, if you do not consider the mobility, the proposed use of Aliyun mysql,5 block money for one months, very worry, if you use other cloud platform, you can also use cloud services, High-performance Low-cost, save time and effort.
4. Install Tomcat
# 4. Install Tomcat
cd/usr/local
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.63/bin/ apache-tomcat-7.0.63.tar.gz
tar-zxf apache-tomcat-7.0.63.tar.gz
4.1 Modifying the configuration file
cd/usr/local/tomcat/conf
# Modify configuration file Server.xml, cannot have Chinese.
# Configure the port number, bind the domain name, alias, and set the thread pool to map the context folder
Then modify the server section, of course, you can use FTP, or other tools to download to Windows Editor, and then upload back, remember if there is a Chinese annotation or something, you need to modify the encoding for UTF-8, otherwise pure English, use the default ANSI can also.
<service name= "Catalina" > lt; Executor name= "Tomcatthreadpool" nameprefix= "catalina-exec-" maxthreads= "" minsparethreads= "/>" <
Connector port= protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443" compression= "on" Compressionminsize= "2048" nocompressionuseragents= "Gozilla,traviata" compressablemimetype= "Text/html,text/xml, Text/javascript,text/css,text/plain,application/json,application/javascript,application/x-javascript "/> < Connector port= "8009" protocol= "ajp/1.3" "redirectport=" 8443 "executor=" Tomcatthreadpool "/> <engine" name= "
Catalina "defaulthost=" wwwhehe.com "> <realm classname=" Org.apache.catalina.realm.UserDatabaseRealm "
Resourcename= "Userdatabase"/>
5. Start mysqld service, and Tomcat
--5. Start the Mysqld service, and Tomcat
cd/usr/local/hehe
mkdir mysql_data
# must modify the owning user Oh, if you modify the MySQL data File save directory
chown Mysql:mysql mysql_data
Service mysqld start
5.1 Set Tomcat to start automatically
There are a number of ways, such as setting up a service, or loading with rc.local.
To modify the/etc/rc.d/rc.local file:
Add a script to start Tomcat inside and save it. The final results are as follows:
[Root@xxx bin]# cat/etc/rc.d/rc.local
#!/bin/sh
# This script'll be executed *after* all of the other
INI T scripts.
# You can put your own initialization stuff in-if you don ' t # want to do the full
Sys V style init stuff.
Touch/var/lock/subsys/local
# Start Tomcat
As you can see, we only added the last line. This means that when the Linux boot is complete and the other initial scripts are loaded, the command to start Tomcat is executed.
Of course, starting other programs can also use this method, but it is a bit of dirt, and can not be configured and invoked using Chkconfig (that is, not the way to install the service).
6. Since the corresponding Tomcat context has been modified, there is nothing to visit.
Here's a corresponding Java EE app.
The above is a small set to introduce the CentOS under the Yum installed MySQL, JDK and Tomcat method, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!