用于初始化阿里云一台 ECS (Ubuntu 22.04)。

安装软件

# 更新源
apt update && apt upgrade -y

# 安装基础工具(大都默认已安装,便于兼容其他云厂商的镜像)
apt install -y git btop wget lrzsz

# nginx & 数据库
apt install -y nginx mysql-server redis-server

# php
apt install -y php8.1-fpm php8.1-dev php8.1-gd \
php8.1-redis php8.1-mysql php8.1-sqlite3 \
php8.1-zip php8.1-xml php8.1-curl php8.1-http \
php8.1-imagick php8.1-mbstring php8.1-bcmath \
php8.1-uuid php8.1-xmlrpc  php8.1-msgpack \
php8.1-oauth php8.1-ldap php8.1-raphf php8.1-uploadprogress \
composer

设置 MySQL 密码

这里安装的 mysql-server 默认是无密码的,需要手动设置一下密码:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Uabc123*'; 

ubuntu 23.04 已升级为 php8.2

apt install -y php8.2-fpm php8.2-dev php8.2-gd \
php8.2-redis php8.2-mysql php8.2-sqlite3 \
php8.2-zip php8.2-xml php8.2-curl php8.2-http \
php8.2-imagick php8.2-mbstring php8.2-bcmath \
php8.2-uuid php8.2-xmlrpc  php8.2-msgpack \
php8.2-oauth php8.2-ldap php8.2-raphf php8.2-uploadprogress \
composer
注意:ubuntu 23.04 默认开启了 ufw,这导致一些常用端口不可用,比如 80 端口。

ufw 开启 80 端口:

sudo ufw allow 80/tcp

# 确认规则已添加
sudo ufw status

标签: ubuntu, ufw

添加新评论