Build TOMCAT+MYSQL+JDK environment in Linux environment

Source: Internet
Author: User
Tags file permissions

Note: All the content is sister paper I personally set up a successful operation, if there is a problem, please email to communicate. [Email protected] (this QQ is only used to receive mail, under normal circumstances will not login, all have problems can send e-mail Oh ~ I will reply)

Follow the steps below step by step.

"Linux Environment"

1. Download and install a VMware workstation, which is the platform for the virtual machine, and then build the Linux system in it.

2. Download a CentOS installation package, Linux version has a variety of, such as Redhat, Ubuntu, Deepin, BT3, personal more accustomed to use CentOS, here to download a centos-6.4-i386-bin-dvd1.iso, 6.4 Version of.

3. Create a new virtual machine and import the package into it, remembering that the step in the process is to build a user and set a password, where the user is a general account of the Linux environment, but the password is the root account root and the common user password

4. After the installation is finished, is a graphical interface, generally we have to use the command line interface, so here can be ctrl+alt+f2 with the shortcut key, you can switch to the command interface.

5. Use the command ifconfig to view the IP address, and then consider using Xshell to connect the virtual machine, so that the operation of the command will be more convenient, do not have to switch out frequently or switch out.

"There should be no children's shoes will not install CentOS or configure the IP address, if there is a problem, you can refer to the post I wrote, I will build the process of all the knowledge listed."

"JDK Installation"

1. First download a JDK version, I download here is Jdk-6u45-linux-i586.bin This version, be sure to remember the suffix is bin, or download the normal version of Windows can not be installed in the Linux system.

2. Upload to the Linux environment with XFTP. The upload path is:/usr/local

3. Then execute the installation command in the Xshell window:

1) First to give this installation file permissions, here for convenience, I directly gave the highest authority, command: [[email protected] local] chmod 777-r JDK-6U45-LINUX-I586.JDK Notice here in the local folder, the file path, or you will not be prompted to find the file.

2) then directly execute the installation of this file:./JDK-6U54-LINUX-I586.JDK, after the installation is successful, there will be a done hint at the end.

3) After the installation is complete, to see what the folder name is here, and for the subsequent environment configuration, you can change the file name, the command is as follows:

View All Files directory: LL

Note that the JDK file name after installation is jdk1.6.0_45, and if it is convenient to know which version of the JDK you are, there is no need to modify it.

Now that the JDK has been installed, proceed to the next step below.

"Tomcat"

1. First download a tomcat version, I use the apache-tomcat-6.0.35 version, Apache-tomcat-6.0.35.zip is the corresponding compression package

2. You can use xftp directly to upload the extracted apache-tomcat-6.0.35 to the/usr/local path, upload complete, and then here you need to configure the environment variables, and then the subsequent Tomcat will start smoothly

3. Configure the JDK environment variables:

1) First return to the home path, which is the top level directory, command: CD ~

2) then open and edit the environment variable file, enter the command: Vi. BASHRC

3) Enter the environment variable editing environment and add the following environment variables:

Export java_home=/usr/local/jdk1.6.0_45

Export classpath= $CLASSPATH: $JAVA _home/lib: $JAVA _home/jre/lib

Export path= $JAVA _home/bin: $JAVA _home/jre/bin: $PATH: $HOMR/bin

Export Catalina_home=/usr/local/tomcat6 (here is the location to find CATALINA, find the approximate location, do not need to Conf folder)

4) After editing, save the Content, command: First press ESC, and then enter ": Wq" can be saved.

5) for configuration to take effect after configuration, with command: source ~/.BASHRC

6) Check if the JDK is configured to take effect with the command: java-version

If you see a configuration similar to the following, the configuration is successful.

4. You can start Tomcat to see if the configuration is successful:

1) First switch to the path where the startup command is located: Cd/usr/local/tomcat6/bin

2) Enter the Tomcat boot command:./startup.sh, but here because of the permissions problem, you will see this result, so we need to assign permissions. For the convenience of giving the bin folder the highest permissions directly, the command is as follows:

Cd.. "This command is returned to the top level directory"

chmod 777-r Bin

CD bin

Then execute the Tomcat boot command again:./startup.sh, which appears as follows, indicates a successful start.

3) The general default port is 8080, so directly in the browser input your IP address plus the port number, that is, you can access to Tomcat's homepage. http://ip:8080

4) But any configuration will not be so easy to configure the success, there will be firewall shutdown or port occupancy problems, here we can switch to the bin directory under Tomcat, execute the following command to view the Tomcat log:./catalina.sh run, the general log format is as follows:

Oneself according to the error to judge what is the error, and then to solve some configuration problems, late-problem friends can also send e-mail consultation Oh ~

5) Enter the IP address plus port number in the browser, and if you see the first page of Tomcat, it is successful, as shown below:

"MySQL Configuration"

1. Switch to the path where you need to install MySQL, my path is:/usr/local

2. Online installation methods are many, we are here to build a test environment, you can directly choose to install online, the command is as follows: Yum install Mysql-server, waiting for it to be installed, some steps need to ask whether to continue, enter Y directly

3. After the installation is complete, start the MySQL service, the command is: Service mysqld start, see below, then the installation of MySQL succeeded

4. Generally this installation of MySQL is the default for root user login, password is also default is empty, so enter the following command: Mysql-u root-p, and then enter the password entered, you can log in to the database. As shown below:
That means you've landed on the database.

5. The more important point is how to connect Tomcat and MySQL, which is what we usually say to configure the JDBC connection, where a connected jar package is needed: Mysql-connector-java.jar, which can be downloaded by itself, The following path is then uploaded directly to the Linux environment using XFTP:/usr/local/jdk1.6.0_45/lib

is to put this JDBC-connected jar package into the JDK Lib folder, so that the entire environment has been configured.

The next section will specifically say how to publish the Java War package here, and how to access the database externally for some common problems.

Please look forward to!

Build TOMCAT+MYSQL+JDK environment in Linux environment

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.