以下是Debian LAMP(Linux+Apache+MySQL/MariaDB+PHP)环境的常用命令:
sudo apt update && sudo apt upgrade -y
sudo reboot
sudo apt install apache2
sudo systemctl start/stop/restart apache2
sudo systemctl status apache2
sudo apache2ctl configtest
sudo tail -f /var/log/apache2/error.log
sudo apt install mariadb-server
sudo systemctl start/stop/restart mariadb
sudo mysql_secure_installation
mysql -u root -p
SHOW DATABASES;
(登录后执行)sudo apt install php libapache2-mod-php php-mysql php-fpm
php -v
sudo nano /etc/php/版本号/apache2/php.ini
(如/etc/php/8.2/apache2/php.ini
)sudo systemctl restart php8.2-fpm
(版本号需替换)sudo ufw allow 80/tcp
(允许HTTP)sudo ufw allow 443/tcp
(允许HTTPS)df -h
free -m
以上命令覆盖LAMP环境的基础安装、配置及维护,可根据实际需求选择使用[1,2,3,4,5,6,7,8,9,10,11,12,13]。