Ubuntu under lamp (Php+mysql+apache) Setup + Full Uninstall Uninstall method

Source: Internet
Author: User
Tags chmod install php php web server file permissions phpmyadmin

Build:
Collected from: HTTP://WWW.CLOUDFLY.INFO/ARCHIVES/36


Installing Apache2

sudo Install apache2

When the installation is complete, run the following command to restart:

sudo /etc/init.d/apache2 restart

Enter http://localhost or http://127.0.0.1 in the browser, if you see "It works!", it means that Apache installed successfully, Apache default installation, will be under/var set up a directory called WWW, This is the Web directory, all Web files that can be accessed by the browser should be placed in this directory.


1. Install PHP

sudo Install libapache2-mod-php5 php5 php5-gd php5-mysql

After installation, we will restart Apache and let it load the PHP module:

sudo /etc/init.d/apache2 restart

Next, we'll create a new PHP file under the Web directory to test if PHP works properly.

Phpinfo ();?>

Then save the file, enter the http://localhost/test.php in the browser, if there is a page showing the PHP running parameters, it means that PHP is working properly.


2. Install MySQL

sudo Install mysql-server mysql-client-5.1

At the end of the installation, it will require the root password to be entered, note that the root password here is not the root password of Ubuntu, it is the root password you want to set for MySQL.


3, Installation Phpmyadmin-mysql database management

sudo Install phpMyAdmin

phpMyAdmin settings:
During installation, you will be asked to select Web Server:apache2 or LIGHTTPD, select apache2, press TAB, and then OK. You will then be asked to enter the MySQL database password for the setup password Password of the database ' s administrative user.
Then connect phpMyAdmin with Apache2, in my case: the WWW directory is in the/var/www,phpmyadmin directory in/usr/share/phpmyadmin, so just use the command:

sudo LN -s/usr/share/phpmyadmin/var/www

phpMyAdmin test: Open Http://localhost/phpmyadmin in the browser address bar.

The basic components of the above ALMP are installed, let's look at some other settings:
Set Ubuntu file to execute read and write permissions
After the LAMP is assembled and installed, the default settings for the PHP Web server root directory are:/var/www. Because of the security principle of Linux system, the file read and write permission in the directory is only allowed by root user, so we can't create a new php file in www folder or modify or delete it, we must first modify the read and write permission of the/var/www directory. In the interface manager through the right-click property cannot modify the file permissions, you have to execute the root terminal command: sudo chmod 777 /var/www . You can then write to the HTML or PHP file. If the file permissions for 777 are not very clear, refer to the chmod command.


Configure Apache
1 Enabling the Mod_rewrite module

sudo sudo /etc/init.d/apache2 restart


Configure PHP5

sudo Gedit/etc/php5/apache2/php.ini

Allow the MySQL and GD modules to check if the file finally contains the following code if it is not added on. (default is added at the end of the configuration file, check just in case)
Extension=mysql.soextension=gd.so save and close the file.
Garbled resolution method
To configure Apache character encoding:

sudo gedit/etc/apache2/conf.d/charset

Change the contents to Adddefaultcharset UTF-8
To configure PHP character encoding:

sudo gedit/etc/php5/apache2/php.ini Find code: default_charset = "Iso-8859-1″ changed to code: Default_charset =" UTF -8″ then restart Apache:sudo/etc/init.d/apache2 restar

Full Uninstall:
Collected from: HTTP://WWW.CLOUDFLY.INFO/ARCHIVES/33

 sudo  apt-get–purge remove apache2  Span style= "color: #0000ff;" >sudo  apt-get–purge Remove Apache2-common  sudo  apt-get–purge Remove Apache2-utils  sudo  apt-get autoremove apache2 

(–purge is not to preserve the meaning of the configuration file, this must not be less)
and then  sudo apt-get install apache2   on it. "PS: If you can't, Just erase everything about apache2, because I've already killed everything before I execute these commands.
Delete/etc/apache2 folder:  sudo RM -r/etc/apache2  
Delete/var/www folder:  sudo rm -r/var/www  
Delete/etc/init.d/apache2 file:  sudo

sudo apt-get–purge remove libapache2-mod-php5 php5 php5-gd php5-mysqlsudo apt-get Autoremove PHP5

Here's how to uninstall MySQL:
Enter command under Terminal:

1 sudo apt-get autoremove–purge mysql-server-5.02sudo apt-get remove mysql-  Server3sudo apt-get autoremove mysql-server4sudo apt-get Remove Mysql-common (very important)

The following sentence is clear residue information.

Dpkg-l | grep ^rc| awk ' {print $2} ' | sudo Xargs dpkg-p



Ubuntu under lamp (Php+mysql+apache) Setup + Full Uninstall Uninstall method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.