1.1下载jdk安装包
wget --no-cookies --no-check-certificate --header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” “http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz”
1.2 mv移动到/usr/local/jdk下,解压缩
1.3 配置环境变量:修改/etc/profile文件,在最后添加
export JAVA_HOME=/usr/local/jdk/jdk1.7.0_79(JDK的解压目录)
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
保存退出
1.4 使文件立即生效: source /etc/profile
1.5 检验 java -version, javac -version
2安装MYSQL
2.1
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall mysql57-community-release-el7-8.noarch.rpm
检查mysql源是否安装成功
yum repolist enabled | grep “mysql.*-community.*”
可以修改vim /etc/yum.repos.d/mysql-community.repo源,改变默认安装的mysql版本。比如要安装5.6版本,将5.7源的enabled=1改成enabled=0。然后再将5.6源的enabled=0改成enabled=1即可
2.3 安装
yum install mysql-community-server
2.4 启动MySQL服务
systemctl start mysqld
##查看MySQL状态
systemctl status mysqld
2.4开机启动
systemctl enable mysqld
systemctl daemon-reload
2.5 修改root本地密码
mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:
shell> grep ‘temporary password’ /var/log/mysqld.log
shell> mysql -uroot -p
mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘MyNewPass4!’;
或者
mysql> set password for ‘yue’@‘localhost’=password(‘yue’);
默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。
2.6
修改密码策略
在/etc/my.cnf文件添加validate_password_policy配置,指定密码策略
validate_password_policy=0
如果不需要密码策略,添加my.cnf文件中添加如下配置禁用即可:
validate_password = off
重新启动mysql服务使配置生效:
2.7
添加远程登录用户
默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须修改root允许远程连接,或者添加一个允许远程连接的帐户,为了安全起见,我添加一个新的帐户:
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘yue’@’%’ IDENTIFIED BY ‘yue’ WITH GRANT OPTION;
systemctl restart mysqld
2.8
配置默认编码为utf8
修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置,如下所示:
[mysqld]
character_set_server=utf8
init_connect=‘SET NAMES utf8’
重新启动mysql服务,查看数据库默认编码如下所示:
mysql> show variables like ‘%character%’;
2.9
默认配置文件路径:
配置文件:/etc/my.cnf
日志文件:/var/log//var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid
3 安装redis https://www.cnblogs.com/zuidongfeng/p/8032505.html