Java Web Development Environment preparation for Linux, Java Web development for linux

Source: Internet
Author: User

Java Web Development Environment preparation for Linux, Java Web development for linux
01 Linux environment preparation(This article uses VMware12 + Ubuntu14.04 on win10)Steps:1. JDK installation and related configuration 2. Tomcat installation and related configuration 3. Mysql installation and related configuration steps:1. JDK installation and related configurationRefer:Http://blog.csdn.net/sxdtzhaoxinguo/article/details/43731677#a) download a jdk, such as jdk-7u45-linux-x64.tar.gz; save to the downloads directory B) (if there is) uninstall open-jdk first

java -versionrpm -qa | grep java

Find and Uninstall all installed software packages containing the string java

Rpm-e -- name of the file searched by nodeps

 

C) Installation

Create a folder:
hemi@ubuntu:~$ sudo mkdir /usr/local/webhemi@ubuntu:~$ sudo mkdir /usr/local/web/jdk

Copy the downloaded jdk file to the created Folder:

hemi@ubuntu:~/Downloads$ sudo cp jdk-7u67-linux-i586.tar.gz /usr/local/web/jdk

Run the sudo tar-zxvf file name command to decompress the file. For example, if you want to install the file in the/usr/local/web/jdk directory, enter the directory.

hemi@ubuntu:~$ sudo tar -zxvf jdk-7u67-linux-i586.tar.gz

Rename the decompressed jdk1.7.0 _ 25 folder to java to facilitate writing:

hemi@ubuntu:~$ sudo mv jdk1.7.0_25 java

 

D) Configure environment variables:
hemi@ubuntu:~$ sudo vi /etc/profile

Add at the end:

JAVA_HOME=/usr/local/web/jdk/javaPATH=.:$JAVA_HOME/bin:$PATHexport JAVA_HOME PATH

[Note] move the cursor to the position where you want to add text. Press the 'I' key on the keyboard to enter the insert mode. Enter the content. If you want to exit the text editing mode and save the text you just edited, click 'esc 'and enter ": wq" to save and exit. If you do not want to save it, press "ESC" and enter ": q!"

E) Run source/etc/profile to make the configuration take effect;

F) Finally, run the java-version command to test. 2, Tomcat installation and related configuration Refer:Http://www.linuxidc.com/linux/2009-07/21073.htmtomcatinstallation: create a directory:
hemi@ubuntu:~$ sudo mkdir /usr/local/web/tomcat

Copy the downloaded file to the created Folder:

hemi@ubuntu:~/Downloads$ sudo cp apache-tomcat-7.0.69.tar.gz /usr/local/web/tomcat

Decompress the package to this folder:

hemi@ubuntu:/usr/local/web/tomcat/$ sudo tar -zxvf apache-tomcat-7.0.69.tar.gz

Modify the catalina. sh file in the bin of tomcat and insert the following content after commenting on the file:

JAVA_HOME="/usr/local/web/jdk/java"

[TomcatRelated Operations]:

First, go to the bin directory under Tomcat, for example, cd/usr/local/web/tomcat/bin.

Start Tomcat:./startup. sh

Disable Tomcat:./shutdown. sh

Check whether Tomcat is disabled: ps-ef | grep java. If more information is displayed, it indicates that Tomcat is not disabled. Otherwise, it is disabled.

Tomcat view log: tail-f catalina. out (catalina. the out is located in the logs directory. tail indicates viewing at the end, and-f indicates dynamic viewing. You can also use tail-100f catalina. out indicates dynamically viewing the last 100 lines of logs) Enable, disable, and restart tomcat easily
sudo vi ~/.bashrc

In ~ /Add reference in the bashrc file:

alias starttomcat='sudo /usr/local/web/tomcat/at/bin/startup.sh'alias shutdowntomcat='sudo /usr/local/web/tomcat/at/bin/shutdown.sh'alias restarttomcat='shutdowntomcat && starttomcat'

Then execute configure to make the configuration take effect.

source ~/.bashrc

 

3, Mysql installation and related configurationA) if it already exists, uninstall it first.
Rpm-qa | grep mysqlrpm-e -- name of the file searched by nodeps

B) Installing mysql on ubuntu is very simple and can be completed with only three commands.

1. sudo apt-get install mysql-server2. sudo apt-get isntall mysql-client3. sudo apt-get install libmysqlclient-dev

During the installation process, you will be prompted to set the password or something. Do not forget to set the password. After the installation is complete, run the following command to check whether the installation is successful:

sudo netstat -tap | grep mysql

After the preceding command check, if mysql's socket is in the listen status, the installation is successful.

To log on to the mysql database, run the following command:
mysql -u root -p

 

02 project deployment and startup

Copy the developed project war package to the webapps directory of tomcat and start the tomcat server. Access address: http: // localhost: 8080/Project Name (war file name)

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.