CentOS 6.0安装jdk1.7 tomcat7 mysql5.6
时间:2015-03-01 20:10 来源:blog.51cto.com 作者::“Romantic Dev”
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"
# 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
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
# 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
# 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就需要重新配置)
#①当前用户 该方法修改后只对当前用户有效,对该用户的所有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
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
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
# /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
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
root@ZL-host04 ~]
# 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
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
# 开发 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
#
(责任编辑:IT)
1.pre 为了更方便的管理安装的软件需要创建个专用目录
2.setup jdk 采用wget安装,安装源为官方jdk,选择jdk7
(责任编辑:IT) |