1、安装java
sudo yum install java-1.8.0-openjdk.x86_64
2、配置java 环境
vim /etc/profile
文件输入
#JAVA_HOME为你安装jdk的目录
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export JRE_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64/jre
export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-8.5.35
export CATALINA_BASE=/usr/local/tomcat/apache-tomcat-8.5.35
3、执行配置文件
. /etc/profile //点后面有一个空格
4、查看java版本
java -version
5、下载tomcat
网上很多源都失效了。最好从tomcat 官网下载tar包
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.35/bin/apache-tomcat-8.5.35.tar.gz
6、安装tomcat
cd /usr/local
mkdir tomcat
cd
cp apache-tomcat-8.5.35.tar.gz /usr/local/tomcat
cd /usr/local/tomcat
sudo tar -zxvf apache-tomcat-8.5.35.tar.gz
解压以后配置用户名密码权限,然后在server.xml里面配置https协议的规则,这里需要证书
注意:tomcat在centos6中正常运行,如果在contos7中需要注意防火墙权限
7、安装mysql
检查系统是否安装其他版本的MYSQL数据
#yum list installed | grep mysql
#yum -y remove mysql-libs.x86_64
安装及配置
# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
# rpm -ivh mysql-community-release-el6-5.noarch.rpm
# yum repolist all | grep mysql
安装MYSQL数据库
# yum install mysql-community-server -y
设置为开机启动(2、3、4都是on代表开机自动启动)
# chkconfig --list | grep mysqld
# chkconfig mysqld on
启动mysql
# service mysqld start
设置root密码
# mysql_secure_installation
登陆root账号
# mysql -uroot -p
建立远程root用户
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
flush privileges;
查看mysql原本编码:
show variables like 'character%';
设置编码
# vi /etc/my.cnf
标准文件如下:
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
performance_schema_max_table_instances=400
table_definition_cache=400
table_open_cache=256
# 修改
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
[mysql]
default-character-set = utf8
[mysql.server]
default-character-set = utf8
[mysqld_safe]
default-character-set = utf8
[client]
default-character-set = utf8
修改好后,重启mysql
# service mysqld restart
再次查看数据库
show variables like 'character%';