Appearance
jdk
shell
# 下载jdk
wget https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.tar.gz
# 解压文件
tar -xvf amazon-corretto-17-x64-linux-jdk.tar.gz -C /usr/local/
# 修改profile文件
vi /etc/profile
# profile中增加环境变量
JAVA_HOME=/usr/local/jdk
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH
# 加载配置文件
source /etc/profile
redis
shell
# 解压文件
unzip redis.zip
# 编译文件
cd redis
make
# 编译完成后将Redis安装到指定目录
make PREFIX=/usr/local/redis install
# 将redis编译目录中的redis.conf文件copy到安装的目录中
cp redis.conf /usr/local/redis/
# 修改配置(redis.conf):后台启动、关闭保护模式、设置密码、关闭绑定ip
daemonize yes
protected-mode no
requirepass pwd
# bind 127.0.0.1
# 启动redis
./bin/redis-server ./redis.conf
# 关闭redis
./bin/redis-cli shutdown
# 查看redis服务进程
ps aux | grep redis
nginx
shell
# 安装yum-utils
yum install yum-utils
#创建yum仓库
vi /etc/yum.repos.d/nginx.repo
#设置仓库地址
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
#安装nginx
yum install nginx
# 进入nginx配置文件
cd /etc/nginx/
#常用命令
nginx
nginx -s reload
nginx -s stop
nginx -t
mysql
- mysql下载地址
- 选择
Red Hat Enterprise Linux/ Oracle Linux
,下载mysql-8.0.xx.el8.x86_64.rpm-bundle.tar
文件
shell
# 解压文件
tar -xvf mysql-8.0.xx.el8.x86_64.rpm-bundle.tar -C /usr/local/mysql/
# 删除mariadb
rpm -qa | grep mariadb
rpm -ev mariadb-xx-xx-1.el8.x86_64
# 安装mysql
rpm -ivh mysql-community-common-8.0.xx.el8.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.xx.el8.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.xx.el8.x86_64.rpm
rpm -ivh mysql-community-client-8.0.xx.el8.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.xx.el8.x86_64.rpm
rpm -ivh mysql-community-server-8.0.xx.el8.x86_64.rpm
# 启动mysql,查看临时密码
systemctl start mysqld
grep password /var/log/mysqld.log
# 登录
mysql -u root -p
# 修改密码(先修改为强密码,才能修改弱密码)
alter user 'root'@'localhost' identified by 'pwd';
SHOW VARIABLES LIKE 'validate_password%';
SET GLOBAL validate_password.policy = 'LOW'; #弱密码
# 开启远程方式1-修改账号
use mysql;
select host,user from user;
update user set host='%' where user='root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
flush privileges;
# 开启远程方式2-创建账号
CREATE USER 'root'@'%' IDENTIFIED BY 'pwd';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
# mysql其他命令
systemctl stop mysqld
systemctl restart mysqld
systemctl status mysqld
# 查看mysql字符集
show variables like 'character%';
# 解决低版本navicat连接不上数据库
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'pwd';
FLUSH PRIVILEGES;
- mysql配置文件(/etc/my.cnf)
shell
port=19036
bind-address=0.0.0.0
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
max_allowed_packet=1024M