sudo apt-get update
//1.LAMP
sudo apt-get install apache2
sudo apt-get install PHP
PHP -v
sudo apt-get install libapache2-mod-PHP //PHP libs for apache2
sudo apt-get install MysqL-serverMysqL-secure-installation //install MysqL server
MysqL -hlocalhost -uroot -ppwd //check
sudo apt-get install PHP7.0-MysqL //PHP support MysqL
sudo service MysqL restart
sudo service apache2 restart
sudo apt-get install PHP-mcrypt PHP-MysqL PHP-gd PHP-imap PHP-ldap PHP-mbstring PHP-odbc PHP-pear PHP-xml PHP-xmlrpc PHP-gettext //PHP modules
sudo chmod 777 /var/www/html // aparche2 html root dir permissions
sudo apt-get install PHPmyadin //gui MysqL manager and need PHP-mbstring PHP and PHP-gettext
sudo gedit /etc/apache2/apache2.conf //add 'ServerName server_domain_or_ip'in apache2.conf
sudo gedit /etc/apache2/mods-enabled/dir.conf //modify default page from index.html to index.PHP
sudo systemctl restart apache2
sudo systemctl status apache2 //check on the status of apache2 service
sudo apache2ctl configtest //Syntax ok verity server name
sudo ufw app list //firwall app list
sudo ufw app info "Apache2 Full" //watch ports 80,443/tcp
sudo ufw allow in "Apache2 Full" //allow apache2 in firwall
原文链接:https://www.f2er.com/ubuntu/356270.html