Before, each installation is a mess doing a good job, then did not have a good complete recording process, so get after the lead time, sometimes very smooth, sometimes a lot of issues.
So, this time going to put the whole process down, the one for future reference, and secondly to discuss with other people.
Apache
installation
Use the following command to install apache2:
sudo apt-get install apache2
Installed by apt, in general, apache directory is /etc/apache2
.
The default web root directory /var/www/html
.
Start apache command:
sudo service apache2 start
Restart and stop commands as long as the start
change restart
and stop
on it.
test
Test apache2 is installed successfully, enter in the browser address bar 127.0.0.1
or (http://localhost/)
, if the page is displayed it works
. So, apache on the installation was successful.
PHP
installation
Use the following command to install:
sudo apt-get install php5 libapache2-mod-php5
Then install other PHP extensions as needed:
sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
You can delete an unnecessary extension, each extension separated by a space. Generally you need to install php5-mysql php5-mcrypt php-pear
other expansion.
After execution, PHP installation has been completed.
test
Use phpinfo()
function to test whether PHP has been installed successfully.
sudo vim /var/www/html/test.php
In test.php
Enter the code below:
<?php phpinfo(); ?>
Then enter in your browser localhost/test.php
to view, if successful see php configuration information, then the PHP installation is successful.
MySQL
installation
Use the following command to install:
sudo apt-get install mysql-server-5.5 libapache2-mod-auth-mysql
During installation, you will be prompted to set the MySQL root user name password.
test
Ctrl + Alt + T to open the terminal
enter the following command
`mysql -uroot -p`
Enter the password you just set after the carriage return. (behind with -u is the user name with my username is root)
if they can successfully enter, the installation was successful.
At this point, congratulations, LAMP environment has been installed.
phpmyadmin
installation
Use the following command to install:
sudo apt-get install phpmyadmin
During the installation, there are a few things need to fill out or set.
- Before choosing the installation of server software, choose where apache
- Before installing MYSQL root password
- Set the root user password for phpmyadmin
After installation phpmyadmin configuration file need to be included in the apache configuration to, or enter the browser localhost/phpmyadmin
will prompt Not Found
. Edit apache2.conf
:
sudo vim /etc/apache2/apahce2.conf
#Include list in the document of ports to listen to the following paragraphs, add what lines of code:
Include /etc/phpmyadmin/apache.conf
Restart the server:
sudo service apache2 restart
In addition to these methods, we can also build a link
sudo ln -s /usr/share/phpmyadmin/ /var/www/html
In this way, you can access the phpmyadmin. Wherein the above two methods is selected on a line.
test
Open your browser and enter localhost / phpmyadmin
to open, then the installation was successful.
Original link large column https://www.dazhuanlan.com/2019/08/16/5d55fdfbb4132/