###JDK安装
###下载jdk安装包
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
###创建java目录
mkdir -p /usr/java/
###xftp上传服务器后解压
rpm -ivh jdk-8u171-linux-x64.rpm
###解压后1.8.171版本会默认生成软链接
###添加jdk的环境变量
#vim /etc/profileexport JAVA_HOME=/usr/java/defaultexport CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/libexport CATALINA_HOME=/opt/developer/apache-tomcat-8.5.31export PATH=$JAVA_HOME/bin:$CATALINA_HOME/bin:$PATH:
###使修改生效
source /etc/profile
###检查jdk环境是否OK
java -version
###Tomcat安装
去apache官网下载apache-tomcat-8.5.31.tar.gz
###解压
tar -zxvf apache-tomcat-8.5.31
###修改编码(conf/server.xml)
###启动
./startup.sh
###配置防火墙
vi /etc/sysconfig/iptables
###添加8080端口的防火墙,允许访问.
*filter:INPUT ACCEPT [0:0]:FORWARD ACCEPT [0:0]:OUTPUT ACCEPT [0:0]-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT-A INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT-A INPUT -j REJECT --reject-with icmp-host-prohibited-A FORWARD -j REJECT --reject-with icmp-host-prohibited
###重启防火墙
service iptables restart
这样就可以在window上访问虚拟机里的linux了。
记录一下,以后或许会用到