在开发日趋激烈的今天,我们可不能再只会编码了,这样搞不好,就成了一辈子的码奴!所以这里简单的分享一下服务器的搭建,由于Linux的安全性等一切因素让它成为了服务器平台的首选环境!今天跟大家分享的是Java项目的服务器搭建,好啦,步骤来了:
1、下载jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
2、下载tomcat
wget http://apache.etoak.com/tomcat/tomcat-7/v7.0.42/bin/apache-tomcat-7.0.42.tar.gz
3、解压jdk和tomcatmkdir /nac/www mkdir /nac/www cd /nac/www tar zxvf jdk-7u25-linux-i586.gz tar zxvf apache-tomcat-7.0.42.tar.gz chmod –R 755 /nac mv jdk1.7.0_25/ jdk mv apache-tomcat-7.0.42 tomcat
vi /etc/profile export JAVA_HOME=/nac/www/jdk export PATH=$JAVA_HOME/bin:$JRE_HOME/jre/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$LCASSPATH export CATALINA_HOME=/nac/www/tomcat export CLASSPATH=.:$JAVA_HOME/lib:$CATALINA_HOME/lib export PATH=$PATH:$CATALINA_HOME/bin 刷新配置 source /etc/profile
cd /apache-tomcat/bin/ chmod 777 *.sh bash catalina.sh start
bash /apache-tomcat/bin/catalina.sh start
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT //添加mysql -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT //添加tomcat
Chkconfig mysqld on Chkconfig mysqld –list 检查开机启动 修改vi /etc/rc.d/rc.local /apache-tomcat/bin/catalina.sh start
Mysql –u root GRANT ALL PRIVILEGES ON *.* TO hupu@"%" IDENTIFIED BY 'hupu' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO hupu@localhost IDENTIFIED BY 'hupu' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'root' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'root' WITH GRANT OPTION;
当看到这里页面的时候,说明一切都ok了,就这样可以运行部署Java项目的服务器就搭建好了!
基于Linux环境Tomcat-MySQL的服务器搭建,布布扣,bubuko.com
原文地址:http://blog.csdn.net/luo201227/article/details/32111067