一、查看CentOS版本,IP,是否开启sshd
1.查看ip
ifconfig eth0
2.查看sshd是否开启
chkconfig --list sshd
3.开启sshd
chkconfig sshd on
4.查看操作系统
uname
5.查看内核版本
uname -r
6.查看GentOS版本
cat /etc/redhat-release
7.增加用户
useradd usrname
8.修改用户密码
passwd username
9.修改新增用户的管理为root
vi /etc/passwd
找到用户,设置userid为0.groupid为0
10.修改hostname
vi /etc/hosts
增加
192.168.1.121 edu-provider-01
重新打开窗口会发现hostname变了
二、使用WinSCP通过sshd上传可解压jdk1.7、tomcat7压缩包,以新建用户登录(我这里是yxq)
三、使用xshell来安装jdk1.7,tomcat7
Connecting to 192.168.1.121:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Wed Mar 23 06:58:49 2016 from 192.168.11.1
[root@edu-provider-01 ~]# ls
apache-tomcat-7.0.61.tar.gz jdk1.7.0_45.tar.gz
[root@edu-provider-01 ~]#
[root@edu-provider-01 ~]# mkdir /usr/java
[root@edu-provider-01 ~]# ls
apache-tomcat-7.0.61.tar.gz jdk1.7.0_45.tar.gz
[root@edu-provider-01 ~]# tar -zxvf jdk1.7.0_45.tar.gz -C /usr/java
[root@edu-provider-01 ~]# ln -s /usr/java/jdk1.7.0_45 /usr/jdk
[root@edu-provider-01 ~]# vi /etc/profile
文件中加入:
JAVA_HOME=/usr/jdk
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH
[root@edu-provider-01 ~]# source /etc/profile
[root@edu-provider-01 ~]# java -version
"1.7.0_45"Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
[root@edu-provider-01 ~]#
2.安装tomcat7[root@edu-provider-01 ~]# mkdir /usr/local/tomcat
[root@edu-provider-01 ~]# tar -xzvf apache-tomcat-7.0.61.tar.gz -C /usr/local/tomcat
[root@edu-provider-01 ~]# ln -s /usr/local/tomcat/apache-tomcat-7.0.61/ /usr/local/tomcat7
[root@edu-provider-01 ~]# vi /etc/sysconfig/iptables
[root@edu-provider-01 ~]# cat /etc/sysconfig/iptables | grep 8080
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
[root@edu-provider-01 ~]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
[root@edu-provider-01 ~]#
4.启动,停止.重启tomcat7及查看日志
[root@edu-provider-01 ~]# /usr/local/tomcat7/bin/startup.sh start
Using CATALINA_BASE: /usr/local/tomcat7
Using CATALINA_HOME: /usr/local/tomcat7
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
Using JRE_HOME: /usr/jdk
Using CLASSPATH: /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
Tomcat started.
[root@edu-provider-01 ~]# /usr/local/tomcat7/bin/startup.sh stop
Using CATALINA_BASE: /usr/local/tomcat7
Using CATALINA_HOME: /usr/local/tomcat7
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
Using JRE_HOME: /usr/jdk
Using CLASSPATH: /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
Tomcat started.
[root@edu-provider-01 ~]# /usr/local/tomcat7/bin/startup.sh restart
Using CATALINA_BASE: /usr/local/tomcat7
Using CATALINA_HOME: /usr/local/tomcat7
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
Using JRE_HOME: /usr/jdk
Using CLASSPATH: /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
Tomcat started.
[root@edu-provider-01 ~]# tail -f /usr/local/tomcat7/logs/catalina.out
Mar 23, 2016 7:45:51 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Mar 23, 2016 7:45:51 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Mar 23, 2016 7:45:51 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Mar 23, 2016 7:45:51 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Mar 23, 2016 7:45:51 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
4.验证tomcat7是否成功安装