sun官方下载jdk版本 注意jdk6--->tomcat6 jdk7---->tomcat7 ...一次类推
#chmod +755 jdk-6u1-linux-i586.bin
#./jdk-6u1-linux-i586.bin
过程中如果出错 ./install.sfx.1873: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
则运行:
yum install glibc.i686
配置环境
在 /etc/profile中加入如下内容(可以使用vi进行编辑profile):
JAVA_HOME=/usr/java/jdk1.6.0_01
CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export PATH CLASSPATH JAVA_HOME
执行
#source /etc/profile
二、安装Tomcat
1)下载apache-tomcat-6.0.10.tar.gz
2)#tar -zxvf apache-tomcat-6.0.10.tar.gz ; //解压
3)拷贝apache-tomcat-6.0.10到/usr/local/下并重命名为tomcat
[root@linux bin]#cp -R apache-tomcat-6.0.10 /usr/local/tomcat ;
4)启动tomcat
[root@linux bin]#/usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk/jdk1.6.0_17
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar
去掉web-app下所有文件,保留ROOT 和Root中的index.jsp文件 修改jsp文件内容为:
<%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JVM memory</title>
</head>
<body>
<%
double total = (Runtime.getRuntime().totalMemory()) / (1024.0 * 1024);
double max = (Runtime.getRuntime().maxMemory()) / (1024.0 * 1024);
double free = (Runtime.getRuntime().freeMemory()) / (1024.0 * 1024);
out.println("Java 虚拟机试图使用的最大内存量(当前JVM的最大可用内存)maxMemory(): " + max + "MB<br/>");
out.println("Java 虚拟机中的内存总量(当前JVM占用的内存总数)totalMemory(): " + total + "MB<br/>");
out.println("Java 虚拟机中的空闲内存量(当前JVM空闲内存)freeMemory(): " + free + "MB<br/>");
out.println("因为JVM只有在需要内存时才占用物理内存使用,所以freeMemory()的值一般情况下都很小,<br/>" +
"而JVM实际可用内存并不等于freeMemory(),而应该等于 maxMemory()-totalMemory()+freeMemory()。<br/>");
out.println("JVM实际可用内存: " + (max - total + free) + "MB<br/>");
%>
</body>
</html>
3 . 安装mysql
yum list mysql*
yum install mysql-server* -y
#conf修改
vi /etc/my.cnf
- [mysqld]
- # datadir=/var/lib/mysql
- datadir=/usr/local/renfufei/mysql_data
- socket=/var/lib/mysql/mysql.sock
- user=mysql
- # Disabling symbolic-links is recommended to prevent assorted security risks
- symbolic-links=0
- default-character-set=utf8
- [mysqld_safe]
- log-error=/var/log/mysqld.log
- pid-file=/var/run/mysqld/mysqld.pid
- [mysql]
- default-character-set=utf8
启动服务 > service mysqld start
尝试连接 > mysql
> ctrl+c退出
设置开机启动 > chkconfig mysqld on
开启可外部访问> /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
> /etc/rc.d/init.d/iptables save
设置mysql密码 > use mysql;
> update user set password=password('密码') where user='root';
> flush privileges;
授权帐号可外部访问:> grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;