目录
JDK
安装JDK步骤:
1、创建目录mkdir /opt/jdk
2、将jdk压缩包通过xftp6上传到该目录
3、cd /opt/jdk
4、tar -zxvf jdk-8u151-linux-x64.tar.gz
5、mkdir /usr/local/java
6、mv /opt/jdk/jdk1.8.0_151 /usr/local/java
7、修改环境变量配置文件vim /etc/profile
8、export JAVA_HOME=/usr/local/java/jdk1.8.0_151
9、export PATH=$JAVA_HOME/bin:$PATH
10、更新环境变量source /etc/profile
测试是否配置成功,编写hello.java输出hello java。
Tomcat
安装Tomcat步骤:
1、创建文件夹mkdir /opt/ tomcat
2、将apache-tomcat-8.5.95.tar.gz上传至该文件夹
(注意:不要下载src源码版或exe二进制版的包)
3、解压tar -zxvf apache-tomcat-8.5.95.tar.gz
4、进入解压目录/bin,./startup.sh启动tomcat(用户要有执行权限)
5、防火墙开放8080端口
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
MySQL
安装MySQL步骤:
1、从Mysql官网或阿里云镜像网站https://mirrors.aliyun.com/mysql
,下载MySQL的安装包mysql-5.7.38-1.el7.x86_64.rpm-bundle.tar
2、新建文件夹/opt/mysql
3、删除CentOS原有的Mariadb数据库,通过rpm -qa | grep maria查看
4、删除mariadb
rpm -e --nodeps maria
rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
5、通过xftp将下载好的mysql安装包传输到/opt/mysql下
6、解安装包mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar,得到rpm包如下
tar -xvf mysql-5.7.38-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-5.7.38-1.el7.x86_64.rpm
mysql-community-common-5.7.38-1.el7.x86_64.rpm
mysql-community-devel-5.7.38-1.el7.x86_64.rpm
mysql-community-embedded-5.7.38-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.38-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.38-1.el7.x86_64.rpm
mysql-community-libs-5.7.38-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.38-1.el7.x86_64.rpm
mysql-community-server-5.7.38-1.el7.x86_64.rpm
mysql-community-test-5.7.38-1.el7.x86_64.rpm
7、开始安装对应rpm包
rpm -ivh mysql-community-common-5.7.38-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugin-5.7.38-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.38-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.38-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.38-1.el7.x86_64.rpm
8、运行mysql
systemctl start mysqld.service
(默认开机自启动)
9、查看当前mysql密码
grep "password" /var/log/mysqld.log
10、登录mysql修改密码
mysql -u root -p 密码
set password for 'root'@'localhost'=password("12345678");
或
update user set authentication_string=password("12345678") where user='root';
或
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';
可设置密码策略:默认为1,要求长度,数字,字母大小写,特殊字符。
set global validate_password.policy=0;
11、使密码生效,flush privileges;
12、Ctrl+Z退出