修改软件源
这里使用阿里云的源,阿里云的镜像地址为:https://opsx.alibaba.com/mirror
1、备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下载新的CentOS-Base.repo
到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3、之后运行yum makecache
生成缓存
安装以及配置JDK
1、卸载预装的OpenJDK
rpm -qa | grep jdk
sudo yum remove ****(软件包名,上条命令的输出结果)
2、从Oracle官网下载JDK
3、下载完成后,进行安装
# 安装
sudo rpm -ivh jdk-8u181-linux-x64.rpm
# 验证安装是否成功
java -version
安装&配置Tomcat
安装操作如下
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.33/bin/apache-tomcat-8.5.33.tar.gz
tar -xzvf apache-tomcat-8.5.33.tar.gz
sudo vim /etc/profile
# 添加CATALINA_HOME到最后一行
# export CATALINA_HOME=/home/asahi/devtools/apache-tomcat-8.5.33
# 保存-退出
source /etc/profile
配置UTF-8字符集
因为默认不使用UTF-8,所以我们在web中使用中文时,会出现乱码。
所要修改文件的位置:conf/server.xml
文件需要修改的地方: