**This tutorial uses the Ubuntu16.04 version of pure mirroring to build the LAMP environment and then installs composer again, and finally installs the Laravel framework using composer. **
In the process of running according to the tutorial, it is recommended to use the root user to operate.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apache2 -y #Suspend yes by default
sudo a2enmod rewrite #Enable Apache2 to restrict browsing and use this feature to send web pages
Open the browser and enter http://host location/ to check if the installation is successful, if any, the Apache web page will appear
Apache2 on Ubuntu16.04 Commands in the system
sudo service apache2 start #Start Apache2 server
sudo service apache2 restart #Restart the Apache2 server
sudo service apache2 stop #Shut down the Apache2 server
Please make sure that the PHP version is the latest, or that the PHP version is compatible with the Laravel version. If PHP is already installed, but the version is not correct, please remove PHP first:
# Remove packages whose package name starts with PHP
sudo apt-get purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
# Join ondrej/PPA for php:In order to install a new version of PHP
sudo apt install python-software-properties
# Update package index
sudo apt-get update
# Install PHP and PHP components
sudo apt install -y php
sudo apt install -y libapache2-mod-php php-curl php-common php-cli php-mysql php-mbstring php-fpm php-xml php-zip php-gettext
First add test.php in /var/www/html, etc., bring in phpinfo, and then open HTTP: //host location/test.php with a browser to see if there is any phpinfo webpage displayed, if only it is displayed Code, that means PHP was not successfully installed:
Supplement: root privileges are required, it is best to switch to root first before operating.
sudo vim /var/www/html/test.php #Add and edit test.php
#Enter the following code and save
<? php
phpinfo();?>
Displaying the basic PHP interface at the beginning means that the installation is successful.
sudo apt install mysql-server mysql-client -y
The installation process will teach you the MySQL root password entered
Verify that Musql is successfully installed:
# Execute mysql operation command
mysql -uroot -P3306 -p
# enter password
# *******
# Go in successfully, it’s OK, don’t forget to come out
exit();
sudo apt install phpmyadmin
# The pop-up dialog box to select the server I am here is Apache
sudo ln -s /usr/share/phpmyadmin /var/www/html/PhpMyAdmin
Then restart Apache2, enter http://host location/PhpMyAdmin in the browser to see if you see the login screen, there are representatives of success, pay attention to the case. . .
cd ~ sudd
php -r "copy('https://getcomposer.org/installer','composer-setup.php');"
sudo php composer-setup.php
sudo mv composer.phar /usr/local/bin/composer
sudo php -r "unlink('composer-setup.php');"
To verify whether composer is installed successfully, simply enter: composer on the command line, and output the composer operation command to show that the installation is successful.
First switch composer to the Chinese source:
composer config -g repo.packagist composer https://packagist.laravel-china.org
Get Laravel and install it:
composer create-project --prefer-dist laravel/laravel laravel
The installation is complete, but the website cannot be accessed, and authorization is required
chmod 777-R laravel
laravel installed successfully
So far, laravel is installed successfully.
Link to this article: https://www.debuginn.cn/2343.html
This article is licensed under the [CC BY-NC-SA 3.0 Unported] (https://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh) agreement, please keep the link to this article for reprinting
Recommended Posts