ubuntu 安装mysql+redis+nginx

1. mysql安装

vim /etc/apt/sources.list 

追加一下内容

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
# 清华镜像源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
sudo apt update    # 更新镜像源
# 安装MySQL5.7(需要输入两次mysql的root用户的密
sudo apt install -y mysql-server-5.7

#密码
Aisheji%188588

配置开机自启动

systemctl restart mysql
systemctl enable mysql

2. redis安装

 sudo apt install redis-server -y

 修改配置

vim /etc/redis/redis.conf 

# 注释掉绑定地址#bind 127.0.0.1,让Redis可远程访问
bind 0.0.0.0 ::1

#取消注释requirepass 启动密码认证,并设置访问密码
requirepass Z3OvRFiTiKN@8*N18hKDF

# 以守护进程运行Redis 
daemonize yes
systemctl restart redis-server
systemctl enable redis-server

3.安装nginx

sudo apt install -y nginx
sudo systemctl restart nginx
sudo systemctl enable nginx

 

posted @ 2024-11-08 18:57  王竹笙  阅读(11)  评论(0编辑  收藏  举报