centos7安装JDK
方式一(rpm)
- 官网下载jdk的rpm文件(www.oracle.com/technetwork…)
- 到该文件所在目录执行命令
rpm -ivh jdk-8u221-linux-x64.rpm
- 默认安装在
/usr/java/jdk1.8.0_221-amd64
目录下 - 环境变量配置:
vi /etc/profile #文末添加如下配置: JAVA_HOME=/usr/java/jdk1.8.0_221-amd64 CLASSPATH=%JAVA_HOME%/lib:%JAVA_HOME%/jre/lib PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin export PATH CLASSPATH JAVA_HOME 复制代码
- 重新载入profile文件
source /etc/profile
- 检查是否成功
java -version
CentOS7安装maven
方式一(二进制包)
- 下载maven
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz 复制代码
也可以在浏览器去maven官网下载需要的版本,这里安装的是二进制包,所以选择“-bin.tar.gz”结尾的包
- 解压移动文件
tar -xf apache-maven-3.6.3-bin.tar.gz -C /usr/local/ mv /usr/local/apache-maven-3.6.3/ /usr/local/maven3.6 复制代码
- 加入环境变量
vi /etc/profile export PATH=$PATH:/usr/local/maven3.6/bin 复制代码
- 执行
source /etc/profile
,让配置生效 - 验证:
which mvn
显示/usr/local/maven3.6/bin/mvn就说明配置成功了
[rootanode2 opt]# which mvn/usr/local/maven3.6/bin/mvn
centos7安装mysql
方式一(yum安装)
首先查看centos7上有没有安装过mysql ,一定要卸载干净残留,不然会安装或启动失败。
- 列出后如果有就删除
yum list installed mysql* 复制代码
- 删除mysql
sudo yum remove mysql-community-* rm -rf /var/lib/mysql rm /etc/my.cnf 复制代码
- 安装yum源
wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm sudo yum instal mysql80-community-release-el7-1.noarch.rpm 复制代码
- 查看是否安装成功
sudo yum repolist all|grep mysql 复制代码
root@node2 exam-vue]# sudo yum repolist alllgrep mysgl mysql-cluster-7.5-community/x86 64 MySQL Cluster 7.5 Community disabled mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community disabled mysql-cluster-7.6-community/x86 64 MySQL Cluster 7.6 Community disabled mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community disabled mysql-connectors-community-source mysql-connectors-community/x86 64 MySQL Connectors Community enabled:175 MySQL Connectors Community disabled nysql-tools-community/x86 64 MySQL Tools Community enabled: 120 mysql-tools-community-source MySQL Tools Community-Sourc disabled mysql-tools-preview/x86 64 MySQL Tools Preview disabled mysql-tools-preview-source MySOL Tools Preview-Source disabled nysql55-community/x86 64 MySQL 5.5 Community Server disabled mysql55-community-source MySQL 5.5 Community Server - disabled nysql56-community/x86 64 MySQL 5.6 Community Server disabled mysql56-community-source MySQL 5.6 Community Server disabled nysql57-community/x86 64 MySQL 5.7 Community Server disabled mysql57-community-source MySQL 5.7 Community Server disabled mysql80-community/x86 64 MySQL 8.0 Community Server enabled: 211 mysql80-community-source MySQL 8.0 Community Server - disabled
- 配置要安装的mysql版本
sudo vim /etc/yum.repos.d/mysql-community.repo 复制代码
enabled 为1表示启用,将要安装的版本的enabled改为1后保存
- 安装启动mysql
sudo yum install mysql-community-server.x86_64 复制代码
- 等待安装好后启动mysql
sudo service mysqld start //启动mysql sudo service mysqld status //查看mysql状态 sudo systemctl enable mysqld //配置开机启动 复制代码
安装完成后的操作
- mysql安装完成之后,在
/var/log/mysqld.log
文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:
grep 'temporary password' /var/log/mysqld.log //找到默认密码 mysql -uroot -p 复制代码
- 修改密码,注意密码要复杂一些,否则会不能通过。
set password for 'root'@'localhost'=password('NEWPASSWORD'); 或者 ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEWPASSWORD'; 复制代码
- mysql8.0授权远程登录 8.0授权方式不一样,不能授权给自己
create user 'brady'@'%' identified by 'brady'; GRANT ALL PRIVILEGES ON *.* TO 'brady'@'%'; FLUSH PRIVILEGES; 复制代码
如果用Navicat连接的回报不支持caching_sha2_password验证方式的错误。 将远程访问用户的验证方式改为:
msyql_native_password 执行: ALTER USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; FLUSH PRIVILEGES;