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 user
cd
~
#. Bashrc is under the root directory
vi
.bashrc
export
JAVA_HOME=
/data/software/jdk1
.7.0_75
export
PATH=$PATH:$JAVA_HOME
/bin
export
CLASSPATH=.:$JAVA_HOME
/lib/dt
.jar:$JAVA_HOME
/lib/tools
.jar
source
~/.bashrc
# ② Modify the/etc/profile file (this method is set once and for all, valid for all users)
cd
~
#. Bashrc is under the root directory
vi
.bashrc
#exportJAVA_HOME=/data/software/jdk1.7.0_75
#exportPATH=$PATH:$JAVA_HOME/bin
#exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
source
~/.bashrc
export
JAVA_HOME=
/data/software/jdk1
.7.0_75
export
JRE_HOME=$JAVA_HOME
/jre
export
PATH=$PATH:$JAVA_HOME
/bin
:$JRE_HOME
/bin
source
~/.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/
tar
zxvftar_box
/apache-tomcat-7
.0.59.
tar
.gz
mv
apache-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 effect
Takes effect immediately and becomes invalid after restart
Enable: serviceiptablesstart
Disable: serviceiptablesstop
Effective after restart
Enable: chkconfigiptableson
Close: chkconfigiptablesoff
Ex:
vi
/etc/sysconfig/iptables
Add
-AINPUT-ptcp-mstate--stateNEW-mtcp--dport8181-jACCEPT
-AINPUT-ptcp-mstate--stateNEW-mtcp--dport3306-jACCEPT
Yy current row, p Paste
(
Note that
-AINPUT-jREJECT--reject-withicmp-host-prohibited
-AFORWARD-jREJECT--reject-withicmp-host-prohibited
Otherwise, the rule may not take effect)
Restart the firewall serviceiptablesrestart
root@ZL-host04~]
#serviceiptablesstatus
Table:filter
ChainINPUT(policyACCEPT)
numtargetprotopt
source
destination
1ACCEPTall--0.0.0.0
/0
0.0.0.0
/0
stateRELATED,ESTABLISHED
2ACCEPTicmp--0.0.0.0
/0
0.0.0.0
/0
3ACCEPTall--0.0.0.0
/0
0.0.0.0
/0
4ACCEPTtcp--0.0.0.0
/0
0.0.0.0
/0
stateNEWtcpdpt:22
5ACCEPTtcp--0.0.0.0
/0
0.0.0.0
/0
stateNEWtcpdpt:8181
6ACCEPTtcp--0.0.0.0
/0
0.0.0.0
/0
stateNEWtcpdpt:3306
7REJECTall--0.0.0.0
/0
0.0.0.0
/0
reject-withicmp-host-prohibited
ChainFORWARD(policyACCEPT)
numtargetprotopt
source
destination
1REJECTall--0.0.0.0
/0
0.0.0.0
/0
reject-withicmp-host-prohibited
ChainOUTPUT(policyACCEPT)
numtargetprotopt
source
destination
The port has been opened, as shown above!
3. mysql install
3.1 pre
yumremovemysql
yum
install
gcc
yum
install
gcc-c++
yum
install
cmake
Perl 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