Detailed CentOS7.4 building Tomcat build Java Web site (with source package)

Source: Internet
Author: User
Tags java web nslookup tomcat server

Introduction to Java

Java is an object-oriented programming language, not only absorbs the various advantages of the C + + language, but also rejects the difficult to understand C + + inheritance, pointers and other concepts, so the Java language has a powerful and easy to use two features. As the representative of static object-oriented programming language, the Java language implements the object-oriented theory very well. Java has the features of simplicity, object-oriented, distributed, robustness, security, platform independence and portability, multi-threading, and dynamic. Java can write desktop applications, Web applications, distributed systems, and embedded system applications.

About Tomcat

Tomcat is a core project of the Apache Software Foundation's Jakarta Project, developed jointly by Apache, Sun, and other companies and individuals. Tomcat server is a free open source Web application server, belongs to the lightweight application server, in small and medium-sized systems and concurrent access users are not widely used, is the first choice to develop and debug JSP programs. Like a Web server like IIS, Tomcat has the ability to handle HTML pages, and it is also a servlet and JSP container, and the standalone servlet container is the default mode for Tomcat. However, Tomcat is less capable of handling static HTML than the Apache server. Currently, the latest version of Tomcat is 9.0.

Experimental environment
    • System Environment: centos7.4
    • Server IP Address: 192.168.100.71
    • Client IP Address: 192.168.100.77
    • Yum Mount directory:/mnt/sr0
    • Related source package: Baidu Cloud download?? Password: UHZM
Build step one, prepare for work 1, close the firewall and SELinux

[Email protected] ~]# systemctl stop Firewalld.service #关闭防火墙
[Email protected] ~]# systemctl disable Firewalld.service #随开机自动关闭

[Email protected] ~]# Vim/etc/sysconfig/selinux

[email protected] ~]# reboot #重启Linux生效

Second, build the DNS server 1, install the BIND package

[Email protected] ~]# cd/mnt/sr0/packages/
[Email protected] packages]# RPM-IVH bind-9.9.4-50.el7.x86_64.rpm

2. Modify the master configuration file named.conf

[Email protected] ~]# vim/etc/named.conf

3. Create and modify the DNS forward parsing file

[Email protected] ~]# cd/var/named/
[Email protected] named]# cp-p named.localhost bt.com.zone #将模板文件改为正向解析文件进行修改
[Email protected] ~]# Vim/var/named/bt.com.zone #修改正向解析文件

4. Start the DNS server

[Email protected] ~]# systemctl start Named.service

5. Modify the DNS client configuration file

[Email protected] ~]# echo "nameserver 192.168.100.71" >>/etc/resolv.conf

6. Test DNS resolution

[[email protected] ~]# nslookup www.bt.com #nslookup used to query DNS records to see if the domain name resolution is normal

Ii. Building a Tomcat service 1, install C language compiler

[Email protected] ~]# yum-y install gcc gcc-c++

2. Installing the JDK

[Email protected] ~]# tar xvfz jdk-8u91-linux-x64.tar.gz #解压jdk
[Email protected] ~]# MV jdk1.8.0_91//usr/local/java
[Email protected] ~]# Vim/etc/profile #修改系统环境变量配置文件

Add the following four lines at the end:

Java_home=/usr/local/java
Classpath= $JAVA _home/lib/
Path= $PATH: $JAVA _home/bin
Export PATH java_home CLASSPATH

[Email protected] ~]# Source/etc/profile #使配置文件重新生效

3. View Java version

[Email protected] ~]# java-version

4. Install Tomcat

[Email protected] ~]# tar xvfz apache-tomcat-8.5.16.tar.gz #解压tomcat
[Email protected] ~]# MV apache-tomcat-8.5.16//usr/local/tomcat8

5. Check Tomcat configuration file

[Email protected] ~]# cd/usr/local/tomcat8/
[[email protected] tomcat8]# ls

Detailed configuration file:

bin/: Script file to start and close Tomcat on a Windows or Linux platform
conf/: A variety of global configuration files for the Tomcat server, the most important of which are server.xml (master profile) and Web. XML (front end)
lib/: A library file (Java Library) to store the Tomcat runtime
Logs: Storing the log file when Tomcat executes
Webapps:tomcat's main Web publishing directory
Work: Store the class file generated by the JSP compilation

6. Start and stop service

[Email protected] ~]#/usr/local/tomcat8/bin/startup.sh #启动服务
[Email protected] ~]# NETSTAT-ANPT | grep ": 8080"

[Email protected] ~]#/usr/local/tomcat8/bin/shutdown.sh #停止服务

Third, build Java Web site 1, edit the default home page

[Email protected] ~]# Mkdir-pv/web/webapp1 #创建站点目录
[Email protected] ~]# vim/web/webapp1/index.jsp #编辑默认首页

2. Modify the master configuration file

[Email protected] ~]# cd/usr/local/tomcat8/conf/#进入配置文件目录下
[Email protected] conf]# vim server.xml #编辑主配置文件

3. Visit the page

Detailed CentOS7.4 building Tomcat build Java Web site (with source package)

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.