下载tomcat7的tar.gz压缩文件
解压到/usr/local目录
1 | $ tar -zxvf apache-tomcat-8.5.31.tar.gz |
编译server.xml文件,修改编码
1 | $ cd apache-tomcat-8.5.31/ |
找到这一行
1 | <Connector port="8080" protocol="HTTP/1.1" |
增加URIEncoding=”UTF-8”,替换为
1 | <Connector port="8080" protocol="HTTP/1.1" |
启动Tomcat71
2
3
4
5
6
7bin/startup.sh
Using CATALINA_BASE: /usr/local/apache-tomcat-8.5.31
Using CATALINA_HOME: /usr/local/apache-tomcat-8.5.31
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.31/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/apache-tomcat-8.5.31/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.31/bin/tomcat-juli.jar
Tomcat started.
查看本地ip地址1
2
3
4
5ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.30 netmask 255.255.255.0 broadcast 192.168.1.255
...
访问http://192.168.1.30:8080
出现下图
表示tomcat7安装并启动成功了。