一.更换yum源
把yum换为阿里云的。
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
CentOS 6
wget -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
3、运行yum makecache生成缓存
二.安装jdk1、查看有哪些版本jdk
yum search jdk
2、安转1.7版
yum -y install java-1.7.0-openjdk*
3、查看Java安装的相关路径 (注意要在/目录下)
[root@VM_171_114_centos /]# find -name java
4、查看版本信息
java -version
三、安装tomcat
1、下载tomcat tar.gz
2、将上传的Tomcat8.0解压,解压之后重命名为tomcat
tar -zxvf apache-tomcat-8.0.29.tar.gz
mv apache-tomcat-8.0.29 tomcat8.0
2.1解决tomcat 编码为utf8
cd tomcat8.0
cd conf
vi server.xml
按i进入编辑模式。在TOMCAT中的conf/server.xml中的<Connector中添加两个设置
useBodyEncodingForURI="true" //设置POST和GET使用相同编码
URIEncoding="UTF-8" //对URI使用utf-8编码处理
useBodyEncodingForURI="true" //设置POST和GET使用相同编码
URIEncoding="UTF-8" //对URI使用utf-8编码处理
按Esc进入命令模式,按:输入wq保存退出。
2.2打开tomcat服务
进入tomcat8.0/bin目录下,运行代码
./startup.sh
yum install mysql
yum install mysql-server
yum install mysql-devel
开启服务
扫描二维码关注公众号,回复:
173818 查看本文章
service mysqld start
查看服务状态
service mysqld status
关闭服务
service mysqld stop
设置密码为root
set password for 'root'@'localhost'=PASSWORD('root');
登陆:mysql -uroot -p
设置编码utf8
show variables like 'character%';
set names 'utf8';