1. 修改Linux的基本配置
1.修改主机名
vi /etc/sysconfig/network
NETWORKING=yes HOSTNAME=server1.itcast.cn |
2.修改ip地址
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 TYPE=Ethernet ONBOOT=yes BOOTPROTO=static IPADDR=192.168.0.101 NETMASK=255.255.255.0 |
service network restart
3.修改ip地址和主机名的映射关系
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.0.101 server1.itcast.cn |
4.关闭iptables并设置其开机启动/不启动
service iptables stop
chkconfig iptables on
chkconfig iptables off
2. 安装JDK
1.上传jdk-7u45-linux-x64.tar.gz到Linux上
2.解压jdk到/usr/local目录
tar -zxvf jdk-7u45-linux-x64.tar.gz -C /usr/local/
3.设置环境变量,在/etc/profile文件最后追加相关内容
vi /etc/profile
export JAVA_HOME=/usr/local/jdk1.7.0_45 export PATH=$PATH:$JAVA_HOME/bin |
4.刷新环境变量
source /etc/profile
5.测试java命令是否可用
java -version
3. 安装Tomcat
1.上传apache-tomcat-7.0.68.tar.gz到Linux上
2.解压tomcat
tar -zxvf apache-tomcat-7.0.68.tar.gz -C /usr/local/
3.启动tomcat
/usr/local/apache-tomcat-7.0.68/bin/startup.sh
4.查看tomcat进程是否启动
jps
5.查看tomcat进程端口
netstat -anpt | grep 2465
6.通过浏览器访问tomcat