Install jdk1.7 tomcat7 mysql5.6 on CentOS 6.0

Source: Internet
Author: User

Install jdk1.7 tomcat7 mysql5.6 on CentOS 6.0

1. pre

To facilitate the management of installed software, you need to create a dedicated directory

Cd ~ Mkdirdata # diskcddatamkdirsoftware # software installation location mkdirtar_box # tar package storage location

2. setup jdk

Use wget to install jdk. Select jdk 7 as the installation source.

#cd/data/software #wget--no-cookies--no-check-certificate--header"Cookie:gpw_e24=http%3A%2F%2Fwww.oracle.com%2F;oraclelicense=accept-securebackup-cookie""http://download.oracle.com/otn-pub/java/jdk/7u75-b13/jdk-7u75-linux-x64.tar.gz"

Install Java with Alternatives

#cd.. #tarxzvf/data/software/tar_box/jdk-7u75-linux-x64.tar.gz #ortarxzvf/tar_box/jdk-7u75-linux-x64.tar.gz #cd/data/software/jdk1.7.0_75/ #alternatives--install/usr/bin/javajava/data/software/jdk1.7.0_75/bin/java2 #alternatives--configjava

Now you may also required to set upjavacandjarcommands path using alternatives command.

alternatives-- install /usr/bin/jar jar /data/software/jdk1 .7.0_75 /bin/jar 2 alternatives-- install /usr/bin/javac javac /data/software/jdk1 .7.0_75 /bin/javac 2 alternatives-- set jar /data/software/jdk1 .7.0_75 /bin/jar alternatives-- set javac /data/software/jdk1 .7.0_75 /bin/javac

-------------------------------- Jdk8 ------------------------------------------

Jdk8 Installation Method

#wget--no-cookies--no-check-certificate--header"Cookie:gpw_e24=http%3A%2F%2Fwww.oracle.com%2F;oraclelicense=accept-securebackup-cookie""http://download.oracle.com/otn-pub/java/jdk/8u31-b13/jdk-8u31-linux-x64.tar.gz"#tarxzfjdk-8u31-linux-x64.tar.gz

--------------------------------------------------------------------------

Loading ing Environment Variables

#exportJAVA_HOME=/data/software/jdk1.7.0_75#exportJRE_HOME=/data/software/jdk1.7.0_75/jre#exportPATH=$PATH:/data/software/jdk1.7.0_75/bin:/data/software/jdk1.7.0_75/jre/bin# Set variables in Shell (this method is only valid for the current shell. You need to reconfigure it if you open another shell)

We use the following two methods:

# ① The method modified by the current user is only valid for the current user and valid for all the shells of the usercd~#. Bashrc is under the root directoryvi.bashrcexportJAVA_HOME=/data/software/jdk1.7.0_75exportPATH=$PATH:$JAVA_HOME/binexportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarsource~/.bashrc# ② Modify the/etc/profile file (this method is set once and for all, valid for all users)cd~#. Bashrc is under the root directoryvi.bashrc#exportJAVA_HOME=/data/software/jdk1.7.0_75#exportPATH=$PATH:$JAVA_HOME/bin#exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarsource~/.bashrcexportJAVA_HOME=/data/software/jdk1.7.0_75exportJRE_HOME=$JAVA_HOME/jreexportPATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/binsource~/.bashrc

After the configuration is complete, make it take effect and check it. The output is as follows:

[Root @ iZ23e9wcapqZ ~] # Source ~ /. Bashrc

[Root @ iZ23e9wcapqZ ~] # Echo $ JAVA_HOME

/Data/software/jdk1.7.0 _ 75

[Root @ iZ23e9wcapqZ ~] #

Check whether jdk is correctly installed and configured

2. tomcat install

Install the SDK before installation.

JAVA is the first requirement for Tomcat 7 installation. Make sure you haveJava se 6 or Later versioninstalled in your system. Use following command to check if you have java installed already on your system.

2.1 download the tomacat jar

cd/data/software##wgethttp://apache.bytenet.in/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.tar.gz#wgethttp://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.59/bin/apache-tomcat-7.0.59.tar.gz#wgethttp://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.59/bin/apache-tomcat-7.0.59-deployer.tar.gz#wgethttp://apache.fayea.com/tomcat/tomcat-8/v8.0.20/bin/apache-tomcat-8.0.20.tar.gz

2.2 extract and setup the jar

cd/data/software/tarzxvftar_box/apache-tomcat-7.0.59.tar.gzmvapache-tomcat-7.0.59tomcat-7.0.59-8181

Tomcatis very easy to use,Thereare no need to compile its source.Yousimple extract the archive and start the tomcat server.Tomcatby default start on port8080,Makesure no other services are running on same port using‘telnet localhost8080′.

tomcat-7.0.59-8181/bin/startup.sh

Sample Output

Using CATALINA_BASE: /data/software/tomcat-7.0.59-8181

Using CATALINA_HOME: /data/software/tomcat-7.0.59-8181

Using CATALINA_TMPDIR: /data/software/tomcat-7.0.59-8181/temp

Using JRE_HOME: /usr

Using CLASSPATH: /data/software/tomcat-7.0.59-8181/bin/bootstrap.jar:/data/software/tomcat-7.0.59-8181/bin/tomcat-juli.jar

Tomcat started.

2.3 If You Need Internet access, make sure the firewall is disabled or the tomcat port is opened!

------------------------ Tips ---------------------------

Check whether the port is enabled

Netstat-an | grep 8181

Check which application uses the Port:

Netstat-apn

Ps-ef

---------------------------------------------------

Check whether the 8181 port in the firewall is enabled

Service iptables status

If not, you need:

#/sbin/iptables-IINPUT-ptcp–dport80-jACCEPT#/sbin/iptables-IINPUT-ptcp–dport22-jACCEPT#/sbin/iptables-IINPUT-ptcp–dport8181-jACCEPT#add#/etc/rc.d/init.d/iptablessave

#/Etc/init. d/iptablesrestart # Do not restart the computer to take effectTakes effect immediately and becomes invalid after restartEnable: serviceiptablesstartDisable: serviceiptablesstopEffective after restartEnable: chkconfigiptablesonClose: chkconfigiptablesoff

Ex:

vi/etc/sysconfig/iptablesAdd-AINPUT-ptcp-mstate--stateNEW-mtcp--dport8181-jACCEPT-AINPUT-ptcp-mstate--stateNEW-mtcp--dport3306-jACCEPTYy current row, p PasteNote that-AINPUT-jREJECT--reject-withicmp-host-prohibited-AFORWARD-jREJECT--reject-withicmp-host-prohibitedOtherwise, the rule may not take effect)Restart the firewall serviceiptablesrestart

root@ZL-host04~]#serviceiptablesstatusTable:filterChainINPUT(policyACCEPT)numtargetprotoptsourcedestination1ACCEPTall--0.0.0.0/00.0.0.0/0stateRELATED,ESTABLISHED2ACCEPTicmp--0.0.0.0/00.0.0.0/03ACCEPTall--0.0.0.0/00.0.0.0/04ACCEPTtcp--0.0.0.0/00.0.0.0/0stateNEWtcpdpt:225ACCEPTtcp--0.0.0.0/00.0.0.0/0stateNEWtcpdpt:81816ACCEPTtcp--0.0.0.0/00.0.0.0/0stateNEWtcpdpt:33067REJECTall--0.0.0.0/00.0.0.0/0reject-withicmp-host-prohibitedChainFORWARD(policyACCEPT)numtargetprotoptsourcedestination1REJECTall--0.0.0.0/00.0.0.0/0reject-withicmp-host-prohibitedChainOUTPUT(policyACCEPT)numtargetprotoptsourcedestination

The port has been opened, as shown above!

3. mysql install

3.1 pre

yumremovemysqlyuminstallgccyuminstallgcc-c++yuminstallcmakePerl installation or not#cripts/mysql_install_db--user=mysql# Perl missing#yum-yinstallperl-Net-Telnet

3.2 mysql-jar

# Developing sourcecode#wgethttp://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.5-m15-linux-glibc2.5-x86_64.tar.gz#generalwechoosethisversion#wgethttp://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz#

This article is from the "Romantic Dev" blog, be sure to keep this source http://xinbaby88.blog.51cto.com/9943025/1616072

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.