Build the JDK + Tomcat + MySQL environment in Ubuntu

Source: Internet
Author: User
Tags gz file mysql gui
Ubuntu JDK + Tomcat + MySQL environment to build 1. Install Ubuntu-server-10.04.11.1

Write down the user name and password entered during installation.

1.2 set IP

After the installation is complete, set the IP address and enter the terminal:
Sudo VI/etc/Network/interfaces

Replace it with the following content:
Auto Lo
Iface lo Inet loopback
Auto eth0
Iface eth0 Inet static
Address 192.168.1.134
Netmask 255.255.255.0
Gateway 192.168.1.1

Save and exit.

This document assumes that:
The user name is test, the password is 1234, And the IP address is 192.168.1.134.

1.3 Install SSH

Run the following installation method:
Apt-Get install OpenSSH-Server

2. Install winscp + putty2.1 winscp

Winscp is an open-source SFTP client that uses SSH in windows and supports SCP protocol. Its main function is to securely copy files between local and remote computers.
(Green Edition): http://www.xdowns.com/soft/1/98/2008/Soft_40219.html
You can use it without installation.

2.2 putty

Putty is a free, Windows 32 platform telnet, rlogin and SSH client, can be integrated into winscp.
(Green Edition): http://www.onlinedown.net/soft/2186.htm
You can use it without installation.

2.3 Integration

Integration Method:
Open winscp and choose Options> integration/Application> putty, as shown in the following figure:


After integration, you can choose "command-> open in putty" in the winscp menu, for example:


The putty window appears, for example:


You can log on to Ubuntu automatically.

3. Install mysql3.1

Use apt-Get install for installation. Enter the following information on the terminal:
Sudo apt-Get install mysql-server-5.1

(
TIPS:
Search software: APT-cache search software name keyword. Fuzzy search is supported,
For example, Apt-cache search MySQL
)
During the installation process, you are prompted twice to enter the password of the MySQL Root Account. Enter root here and click OK until the installation is complete.

3.2 Create a user

After MySQL is installed, it is automatically started and automatically started by default.
Terminal input:
Mysql-uroot-proot

Go to the MySQL console. Create a user (User name: Test, password: 123456) and authorize the user to remotely access MySQL (if needed ):
Grant all privileges on *. * To test @ "%" identified by "123456" with grant option;

Input:
Exit

Exit MySQL
Terminal input:
Mysql-Utest-p123456

Test whether the created account can log on to MySQL normally.

3.3 modify the MySQL File

Terminal input:
Sudo VI/etc/MySQL/My. CNF

Open the/etc/MySQL/My. CNF file and find the following line:
Bind-address = 127.0.0.1

Comment out this line. Otherwise, MySQL may still be inaccessible remotely.
Save and exit.

3.4 Test Remote Access

Open sqlyog-mysql GUI in windows, enter the IP address of the Ubuntu machine and the MySQL user name and password created above, and test whether the connection is successful. For example:

4. Install jdk4.1 and copy the JDK Installation File.

Use winscp to copy the local jdk6.bin file to Ubuntu and put it in the/home/test/Software Directory (or another directory)

4.2 install JDK

Install JDK in the/usr/local directory, and run CD to enter the/usr/local directory. Terminal input:
CD/usr/local

Install JDK, terminal input:
Chmod U + x/home/test/software/jdk6.bin -- Grant the execution permission to this BIN file
Sudo/home/test/software/jdk6.bin -- execute this BIN file in the current directory
Sudo MV jdk1.6.0 _ 26 jdk6 -- rename, jdk1.6.0 _ 26-> jdk6

4.3 set Environment Variables

Run the VI command to open the/etc/profile file. Enter:
Sudo VI/etc/profile

Add the following before the last line:
Export java_home =/usr/local/jdk6
Export jre_home =/usr/local/jdk6/JRE
Export classpath =.: $ java_home/lib: $ jre_home/lib: $ classpath
Export Path = $ java_home/bin: $ jre_home/bin: $ path

Save and exit.

4.4 Test whether the installation is successful

Terminal input:
Java-version

Check whether the JDK version can be output.

5. install Tomcat and copy the tomcat installation file.

Use winscp to copy the local tomcat6.tar.gz file to Ubuntu and put it in the/home/test/Software Directory (or another directory)

5.2 install Tomcat

The installation file is the decompressed version of Tomcat. Run the following command to decompress the package. Enter the following command on the terminal:
Sudo tar xvf/home/test/software/tomcat6.tar.gz-C/usr/local -- decompress
Sudo mv apache-Tomcat-6.0.32 tomcat6 -- rename
Sudo chown-r test: Test/usr/local/tomcat6 -- authorize
Sudo chmod 775-r/usr/local/tomcat6 -- authorization

5.3 set Environment Variables

Run the VI command to open the/etc/profile file. Enter:
Sudo VI/etc/profile

Add the following before the last line:
Export catalina_home =/usr/local/tomcat6
Export Path = $ catalina_home/bin: $ path

Save and exit.

5.4 start Tomcat

Terminal input:
Startup. Sh

Enter http: // 192.168.1.134: 8080/in the address bar of the browser/
Check whether the Tomcat page is displayed:

5.5 set tomcat to boot automatically

Run the VI command to open the/etc/init. d/tomcat file, and enter:
Sudo VI/etc/init. d/tomcat

This is a new file. Enter the following content:
Export java_home =/usr/local/jdk6
[-F/usr/local/tomcat6/bin/startup. Sh] | exit 0 [-F/usr/local/tomcat6/bin/shutdown. Sh] | exit 0
Case "$1" in
Start)
Echo-n "Starting Tomcat :"
/Usr/local/tomcat6/bin/startup. Sh
Retval =$?
Echo
[$ Retval = 0] & Touch/var/lock/tomcat ;;
Stop)
Echo-n "shutting down Tomcat :"
/Usr/local/tomcat6/bin/shutdown. Sh
Retval =$?
Echo
[$ Retval = 0] & Rm-F/var/lock/tomcat ;;
Restart)
$0 stop
$0 start
;;
Condrestart)
[-E/var/lock/tomcat] & amp; $0 restart ;;
Status)
$0 stop
$0 start
;;
Condrestart)
[-E/var/lock/tomcat] & amp; $0 restart ;;
Status)
Status Tomcat
;;
*)
Echo "Usage: $0 {START | stop | restart | status }"

Exit 1
Esac
Exit 0

Save and exit.

Modify the permission to make the configuration take effect. Enter the terminal:
Sudo chmod 755/etc/init. d/tomcat
Sudo update-rc.d Tomcat ults 85

Restart Ubuntu and enter http: // 192.168.1.134: 8080/in the address bar of the browser/
Check whether the Tomcat page is displayed:

6. Some commands use 6.1 vi

See http://baike.baidu.com/view/27682.htm#sub5889285

6.2 apt-Get

See http://baike.baidu.com/view/1580236.htm

6.3 chmod

See http://baike.baidu.com/view/1229012.htm#2

6.4 tar

See http://baike.baidu.com/view/209679.htm#1

6.5 chown

See http://baike.baidu.com/view/1229019.htm

6.6 set IP

See http://blog.csdn.net/fibbery/archive/2009/05/16/4191634.aspx

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.