Linux安装java、maven、mysql、rabbitmq

安装java

下载

Java SE Development Kit 8 Downloads

安装

  • 将文件.tar.gz移动到/usr/java
  • 解压:tar -zxvf 文件.tar.gz
  • 打开/etc/profile(vim /etc/profile)在最后面添加如下内容: apple js export JAVA_HOME=/usr/jdk安装目录 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_HOME/bin:$PATH
  • win环境变量配置
    %JAVA_HOME%\bin;%Java_Home%\jre\bin;
    
  • source /etc/profile

安装maven

下载

Downloading Apache Maven 3.5.3

安装

  • 将下载文件放到/usr/maven
  • 解压:tar -zxvf 文件
  • 配置环境在/etc/profile加入 apple js export MAVEN_HOME=/usr/maven/maven文件 export MAVEN_HOME export PATH=$PATH:$MAVEN_HOME/bin
  • source /etc/profile

安装RabbitMQ

安装Mysql

提前关闭防火墙

1
2
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html

  • 查看Linux发行版本
    cat /etc/redhat-release
    
  • 下载MySQL官方的Yum Repository Download MySQL Yum Repository
  • 安装MySQL的Yum Repository
    wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
    yum localinstall mysql80-community-release-el7-1.noarch.rpm
    
  • 选择版本 ``` yum repolist all | grep mysql

yum-config-manager –disable mysql80-community yum-config-manager –enable mysql57-community

1
2
3
* 安装MySQL数据库的服务器版本
````$xslt
yum -y install mysql-community-server
  • 启动数据库 ````$xslt service mysqld start

service mysqld status

1
2
3
4
5
6
7
8
* 重启和关闭
```
service mysqld restart
service mysqld stop
```
* 获取初始密码
````$xslt
grep "password" /var/log/mysqld.log
  • 修改root用户密码
    mysql -uroot -p
    ALTER USER 'root'@'localhost' IDENTIFIED BY '[email protected]';
    use mysql;
    update user set host = '%'  where user ='root';
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '[email protected]' WITH GRANT OPTION;
    flush privileges;
    
  • 设置密码的安全级别 附6.5.3.2 Password Validation Options and Variables apple js SHOW VARIABLES LIKE 'validate_password.%'; set global validate_password.policy=0;

  • mysql8 :客户端连接caching-sha2-password问题 apple js ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则 ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码 FLUSH PRIVILEGES; #刷新权限 ALTER USER 'root'@'%' IDENTIFIED BY 'password';

MySQL binlog配置

  • 修改 my.cnf
    1
    2
    log-bin=/var/lib/mysql/mysql-bin
    server-id=1
    
  • 查看
    1
    show variables like '%log_bin%'
    

mysql time zone

1
SET GLOBAL time_zone = '+8:00';