Build and configure mysql and tomcat test environments on ubuntu
Source: Internet
Author: User
The ununtu system uses version 11.10. if you use a virtual machine, we recommend that you use a version later than vmware6.5 for installation. if the version is old, the IRQ error will always occur during installation. after the system is installed, it is best to update it again, the update package will be relatively large, do not use built-in... here, the ununtu system uses version 11.10. if you use a virtual machine, we recommend that you use versions later than vmware 6.5 for installation. if the version is old, IRQ errors will always occur during installation.
After the system is installed, it is best to update the system again. The update package will be relatively large. do not use the default data source that comes with it. the speed will be slow and sometimes cannot be connected, go to [System Settings]-[software source]. on the pop-up page, replace [downloaded from] with other sites. the 163 and cn99 sites are faster. finally, run the sudo apt-get update command in the terminal window to make the changed data source take effect.
JAVA environment
Download the java bin installation package. after the installation is complete, you must set the environment variables to make them take effect globally,
Directly edit the/etc/profile file and add the following to the end:
Export JAVA_HOME =/usr/local/java/jdk1.6.0 _ 30 (based on the actual path)
Export PATH = $ PATH: $ JAVA_HOME/bin
Export CLASSPATH =.: $ JAVA_HOME/jre/lib: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
MYSQL installation configuration
There are many ways to install MYSQL. you can download the corresponding installation package from the official website, but it is relatively difficult to configure. it is very easy to install the ubuntu system online.
Open the terminal window and execute sudo apt-get install mysql-server. after the installation is complete, the system will automatically configure it. at last, set the password for the root user. we recommend that you enter it. do not leave it blank. run whereis mysql to know the corresponding installation path.
1. start and stop
The following are related commands.
Sudo/etc/init. d/mysql restart
/Etc/init. d/mysql start
/Etc/init. d/mysql stop
/Etc/init. d/mysql restart
2. modify the encoding format
Locate the/etc/mysql/my. cnf file, or directly edit sudo gedit/etc/mysql/my. cnf. add the following content in [client] and [mysqld:
[Client]
Default-character-set = utf8
[Mysqld]
Default-character-set = utf8
Restart MYSQL and enter show variables like 'character _ set _ %.
3. enable remote management
Enter the mysql terminal, mysql-u user-p password
Run grant all privileges on *. * TO user @ "%" identified by "password" with grant option
Open the gedit/etc/mysql/my. cnf file and find bind-address = 127.0.0.1 and change it to bind-address = 0.0.0.0.
In this way, you can manage through a remote connection.
TOMCAT configuration
Download the TOMCAT package from the official website, decompress it to/usr/local/tomcat, and run chmod 755 * in the bin directory *. sh: grant The permission. if you do not have The permission, an error is returned when The startup script is executed: The BASEDIR environment variable is not defined correctly This environment variable is needed to run this program.
The environment variable value is set in the startup script and can be added to the system:
Export CATALINA_HOME =/usr/local/tomcat
Export JRE_HOME =/usr/local/java/jdk1.6.0 _ 30
Tomcat startup, it is best not to directly execute startup from the/usr/local/tomcat/bin directory. sh script, because if your application is placed under webapps, it is not on the server. configure context in xml. a path error will be reported during startup: the given file doesn't exist (/usr/local/tomcat/bin/usr/local/tomcat/webapps/sync/WEB-INF/classes), found that The paths are duplicated. run/usr/local/tomcat/bin/startup in the terminal window. sh is normal
Generally, tomcat is registered as a service and managed by commands. in etc/init. d Directory, create a script named tomcat. you can directly COPY the following content and modify the tomcat directory according to your actual path.
#! /Bin/sh
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