1、安装mariadb
apt-get -y install mariadb-server mariadb-client
2、安装apache2
apt-get -y install apache2
3、安装php7.0
apt-get -y install php7.0 libapache2-mod-php7.0
4、安装模块使mariadb数据库获得php支持
apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php7.0-memcache php7.0-pspell php7.0-recode php7.0-snmp php7.0-sqlite php7.0-tidy php7.0-xmlrpc php7.0-xsl
5、安装phpmyadmin
apt-get -y install phpmyadmin
注意:如果安装数据库时未提示设置密码,需手动设置。运行以下命令:
mysql_secure_installation
但是此时,用 phpmyadmin 或者 adminer 访问的時候,还是会提示 Access denied for user 'root'@'localhost' ,运行命令:
mysql -u root
>use mysql;
>update user set plugin='' where User='root';
>flush privileges;
>exit;