1. 更新系统sudo apt-get upgrade
sudo apt-get update
2. 安装apache
sudo apt install apache2
启动必要模块
sudo a2enmod rewrite
sudo a2enmod ssl
sudo systemctl restart apache2
3. 安装php8
A. 执行如下命令启用 ondrej/php 的 PHP 存储库
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
B. 使用apache安装php8
sudo apt-get update
sudo apt install php8.0 libapache2-mod-php8.0
sudo apt install php8.0-dom php8.0-imagick php8.0-mbstring php8.0-zip php8.0-intl
sudo systemctl restart apache2
4. 配置 PHP-FPM
A. PHP-FPM 是一个 PHP 的 FastCGI 管理器
sudo apt-get update
sudo apt install php8.0-fpm libapache2-mod-fcgid
B. 在apache中启用PHP-FPM
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.0-fpm
sudo systemctl restart apache2
5. 安装mysql8
sudo apt-get install mysql-server -y
mysql8默认无密码需创建密码
sudo mysql_secure_installation
或者
$ mysql -u root
myslq> use mysql;
mysql> UPDATE mysql.user SET authentication_string=password('你设置的密码') WHERE User='root' AND Host ='localhost';
mysql> UPDATE user SET plugin="mysql_native_password";
mysql> flush privileges;
mysql> exit;
6. 安装php插件
sudo apt install php8.0-mysql php8.0-gd
sudo apt install php8.0-mbstring php8.0-zip php8.0-json php8.0-curl
7. 安装phpmyadmin
sudo apt install phpmyadmin -y
关于E: Sub-process /usr/bin/dpkg returned an error code (1)错误解决
sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_old
sudo mkdir /var/lib/dpkg/info
sudo apt-get update
sudo apt-get -f install
sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_old
sudo rm -rf /var/lib/dpkg/info
sudo mv /var/lib/dpkg/info_old /var/lib/dpkg/info
文章评论
您好,这是一条评论。第一篇个人日志。
If you desire to improve your know-how just keep visiting this website and be updated with the most recent news update posted here.