1.pre
为了更方便的管理安装的软件需要创建个专用目录
cd ~ mkdir data # disk cd data mkdir software # 软件安装位置 mkdir tar_box # tar包存放位置
2.setup jdk
采用wget安装,安装源为官方jdk,选择jdk7
# 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 .. # tar xzvf /data/software/tar_box/jdk-7u75-linux-x64.tar.gz # or tar xzvf /tar_box/jdk-7u75-linux-x64.tar.gz # cd /data/software/jdk1.7.0_75/ # alternatives --install /usr/bin/java java /data/software/jdk1.7.0_75/bin/java 2 # alternatives --config java
Now you may also required to set up javac and jar commands 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安装方式
# 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" # tar xzf jdk-8u31-linux-x64.tar.gz
--------------------------------------------------------------------------
Configuring Environment Variables
# export JAVA_HOME=/data/software/jdk1.7.0_75 # export JRE_HOME=/data/software/jdk1.7.0_75/jre # export PATH=$PATH:/data/software/jdk1.7.0_75/bin:/data/software/jdk1.7.0_75/jre/bin # 在Shell下设置变量(该方法只对当前的shell有效,如果打开另一个shell就需要重新配置)
我们采用下面的2种其一:
#①当前用户 该方法修改后只对当前用户有效,对该用户的所有shell都有效 cd ~ #.bashrc是在根目录下 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
#②修改/etc/profile文件(该方法一劳永逸,设置一次,对所有用户有效) cd ~ #.bashrc是在根目录下 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 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
配置完毕需要使其生效并进行检测,输出如下:
[[email protected] ~]# source ~/.bashrc
[[email protected] ~]# echo $JAVA_HOME
/data/software/jdk1.7.0_75
[[email protected] ~]#
检测jdk是否正确安装并配置
2.tomcat install
安装前需套检查是否安装了
JAVA is the first requirement for Tomcat 7 installation. Make sure you haveJAVA SE 6 or Later version installed 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 ## wget http://apache.bytenet.in/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.tar.gz # wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.59/bin/apache-tomcat-7.0.59.tar.gz # wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.59/bin/apache-tomcat-7.0.59-deployer.tar.gz # wget http://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 zxvf tar_box/apache-tomcat-7.0.59.tar.gz mv apache-tomcat-7.0.59 tomcat-7.0.59-8181
Tomcat is very easy to use, There are no need to compile its source. You simple extract the archive and start the tomcat server. Tomcat by default start on port 8080, Make sure no other services are running on same port using ‘telnet localhost 8080′.
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 如果需要外网访问,请确保防火墙关闭或者tomcat的端口打开!
------------------------tips---------------------------
查看端口是否已经打开
netstat -an|grep 8181
查看端口是被哪个应用程序使用:
netstat -apn
ps -ef
---------------------------------------------------
查看防火墙中8181 port是否打开
service iptables status
如果没有打开需要:
# /sbin/iptables -I INPUT -p tcp –dport 80 -j ACCEPT # /sbin/iptables -I INPUT -p tcp –dport 22 -j ACCEPT # /sbin/iptables -I INPUT -p tcp –dport 8181 -j ACCEPT #add # /etc/rc.d/init.d/iptables save
# /etc/init.d/iptables restart #不重启计算机生效 即时生效,重启后失效 开启: service iptables start 关闭: service iptables stop 重启后生效 开启: chkconfig iptables on 关闭: chkconfig iptables off
ex:
vi /etc/sysconfig/iptables 添加 -A INPUT -p tcp -m state --state NEW -m tcp --dport 8181 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT yy当前行,p 粘贴 ( 注意添加在 -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited 之前,否则可能导致规则不生效) 重启防火墙service iptables restart
[email protected] ~]# service iptables status Table: filter Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8181 6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:3306 7 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) num target prot opt source destination 1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) num target prot opt source destination
端口已打开,如上所示!
3.mysql install
3.1 pre
yum remove mysql yum install gcc yum install gcc-c++ yum install cmake perl 安装与否判断 # cripts/mysql_install_db --user=mysql # 出现缺少perl # yum -y install perl-Net-Telnet
3.2 mysql-jar
# 开发 source code # wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.5-m15-linux-glibc2.5-x86_64.tar.gz # general we choose this version # wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz #
待续!