CentOS7 installation of OpenJDK, Tomcat, and MySQL process introduction

Source: Internet
Author: User

The first is foreplay, recommend a remote tool Xshell and XFTP use, the following is Xshell's official website
Http://www.netsarang.com/products/xsh_overview.html

1.openjdk

How to download and install prebuilt OpenJDK packages

JDK 8

Debian, Ubuntu, etc.

On the command line, type:

$ sudo apt-get install Openjdk-8-jre

The OPENJDK-8-JRE package contains just the Java Runtime environment. If you want to develop Java programs and then, install the OPENJDK-8-JDK package.

Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.

On the command line, type:

$ su-c "Yum Install JAVA-1.8.0-OPENJDK"

The JAVA-1.8.0-OPENJDK package contains just the Java Runtime environment. If you want to develop Java programs then install the Java-1.8.0-openjdk-devel package.

The above said the different system installation, but also pointed out that the command only installed the JRE, if you need to develop an application, but also need to install (already with bold logo), want to install other version details see OPENJDK official website Introduction
http://openjdk.java.net/install/

[root@VM_207_229_centos ~]# java -versionopenjdk version "1.8.0_71"OpenJDK Runtime Environment (build 1.8.0_71-b15)OpenJDK 64-Bit Server VM (build 25.71-b15, mixed mode)
    • 1
    • 2
    • 3
    • 4
2.tomcat
# cd /usr/local# wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz# tar xzf apache-tomcat-8.0.36.tar.gz# mv apache-tomcat-8.0.36 tomcat# lsapache-tomcat-8.0.36.tar.gz etc include lib64 logs sa share tomcat bin games lib libexec qcloud sbin src
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

Personal habits put Tomcat under/user/local, download and unzip, and rename Tomcat
If you want another version ... Find a good path to download at the following address
https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/

Modify config file Conf/server.xml to listen on port 80, default encoding Utf-8, and turn on gzip compression

<Connectorport="80"protocol= "http/1.1"  Connectiontimeout= "20000" redirectport=  "8443" executor= " Tomcatthreadpool "uriencoding=" Utf-8 " compression= "on"  Compressionminsize= "nocompressionuseragents=
                       
                         "Gozilla, Traviata" 
                        compressablemimetype=  "Text/html,text/xml,text/javascript,text/css,text/plain"/> <!--A "Connector" using the shared thread pool-->    
                         
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

Start Tomcat, enter the IP address in the browser, and see the Tomcat kitten page. CentOS7 Open 80 port, Centos 7 replaces the original iptables with Firewalld.

<!-- 启动防火墙 --># systemctl start  firewalld<!-- 开启80端口,出现success表明添加成功 --># firewall-cmd --zone=public --add-port=80/tcp --permanent<!-- 重启防火墙 --># systemctl restart firewalld.service<!-- 检查端口 --># firewall-cmd --permanent --zone=public --list-ports<!-- 自启动防火墙 -->#systemctl enable firewalld
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

Also change the default access address, do not want to see Tomcat kitten (This step to see personal needs)

<EngineName="Catalina"defaulthost="Www.caihongwen.cn" ><RealmClassname="Org.apache.catalina.realm.LockOutRealm" ><RealmClassname="Org.apache.catalina.realm.UserDatabaseRealm"Resourcename="Userdatabase"/></Realm><HostName="Www.caihongwen.cn"Appbase="WebApps"unpackwars="True"autodeploy="True" ><ContextDocbase="Blog"Path=""debug="0"reloadable= "true"/> <!--Access Log processes all example. Documentation at:/docs/config/valve.html note:the pattern used are equivalent to using pattern= "common"--<valve classname=  "org.apache.catalina.valves.AccessLogValve" directory=< Span class= "Hljs-value" > "logs" prefix= "Localhost_access_ Log "suffix=". txt "pattern=< Span class= "Hljs-value" > "%h%l%u%t &quot;%r&quot; %s%b "/> </host> </ENGINE>             
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19

Please take care to add a piece of code between host

<Context docBase="blog" path="" debug="0"  reloadable="true"/>
    • 1

This blog is placed in the WebApps Project War package name, through the IP or domain name directly into the blog, will not appear Tomcat Kitten Management page, the first time to start tomcat slightly slower, the new addition of the war package needs to be restarted to be effective. Another important point is to open port 80 externally.

3.mysql

Using the RPM package for installation, this installation process will automatically complete the relevant configuration of the system, more convenient.
In addition, there is a. tar.gz compressed file installation method, recommend a blog introduction.
http://blog.csdn.net/superchanon/article/details/8546254/

Uninstall the original MySQL or MARIADB installation program
1, CENTOS7 version installed by default mariadb-libs, you must uninstall before you can continue to install MySQL.
A) Find out if Mariadb-libs was previously installed

# rpm -qa | grep -i mariadb-libs
    • 1

b) Uninstall the installed Mariadb-libs

# yum remove mariadb-libs-5.5.44-2.el7.centos.x86_64
    • 1

2. Find out if MySQL was installed before

# rpm -qa | grep -i mysql
    • 1

If there is, also delete

Install MySQL

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm# rpm -ivh mysql-community-release-el7-5.noarch.rpm# yum install mysql-community-server
    • 1
    • 2
    • 3

Restart MySQL service after successful installation

# service mysqld restart
    • 1

The initial installation of MySQL is the root account is no password, the method of setting the password

# mysql -urootmysql> set password for ‘root‘@‘localhost‘ = password(‘mypasswd‘);
    • 1
    • 2

Remotely authorize a connection to MySQL

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘mypasswd‘ WITH GRANT OPTION;FLUSH PRIVILEGES;
    • 1
    • 2

Modify MySQL default encoding

# vim /etc/my.cnf
    • 1

Make the following changes

[client]default-character-set=utf8[mysqld]character_set_server=utf8
    • 1
    • 2
    • 3
    • 4

Then restart MySQL

# service Mysqld restart# mysql-uroot-pMysql> Show variables like ' character% '; +--------------------------+----------------------------+| variable_name | Value |+--------------------------+----------------------------+| Character_set_client | UTF8 | | Character_set_connection | UTF8 | | Character_set_database | UTF8 | | Character_set_filesystem | binary | | character_set_results | utf8 | | Character_set_server | utf8 | | character_set_system | UTF8 |< Span class= "Hljs-header" >| Character_sets_dir | /usr/share/mysql/charsets/|+--------------------------+----------------------------+8 rows in Set (0.00 sec) mysql> show variables like ' collation% '; +----------------------+-----------------+| variable_name | Value |+----------------------+-----------------+| Collation_connection | utf8_general_ci | | collation_ Database | Utf8_general_ci || collation_server | utf8_general_ci |+----- -----------------+-----------------+3 rows in Set (0.00 sec)        
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21st
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27

Installing the MYSQL-JDBC Drive

# yum install mysql-connector-java
    • 1
Completed!!!

Remote connection to MySQL, if not connected, may be not open 3306 port.
Finally, share a MySQL remote management artifact Navicat, you know
Http://pan.baidu.com/s/1mh87vGc

CentOS7 installation of OpenJDK, Tomcat, and MySQL process introduction

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.