Build LAMP and php development tools in Ubuntu,
The so-called LAMP refers to: Linux + Apache + Mysql + Php
Make a memorandum only for this article
Step1. install Apache
1. Enter the command in terminal and execute:
Sudo apt-get install apache2
2. Test whether Apache is successfully installed:
Open your browser and enter 127.0.0.1 in the address bar. If "It works!" appears !", Indicates that the installation is successful.
Note: 127.0.0.1 refers to the local host, which is specified in the IP address editing. If you have learned TCP/IP, you must know this. Of course, you can also enter http: // localhost/in the address bar for testing. |
Step 2 install php5
1. In terminal, enter:
Sudo apt-get install php5 libapache2-mod-php5 php5-mysql
Restart apache2:
Sudo/etc/init. d/apache2 restart
Note: To disable the apache service, run the following command: Sudo/etc/init. d/apache2 stop To open the apache service, run the following command: Sudo/etc/init. d/apache2 start The restart, close, and start commands of mysql are similar to those of apache2. |
2. Test whether php5 is successfully installed:
Sudo gedit/var/www/testphp. php
In the open file, enter the following php code:
Save and close the file. In the address bar of the browser, enter the following ip Address: 127.0.0.1/testphp. php. If a bunch of php-related information appears, it indicates that php is successfully installed.
Note: This page is often used, because it contains a lot of information about php on our local machine. If you read this page carefully, you will find that |
Step 3 install mysql
1. Enter the following command in terminal and execute it:
Sudo apt-get install mysql-server mysql-client
During the installation process, you will be asked to set a password for the root user in mysql:
Just follow the prompts. If you do not enter the password, it is blank by default, then perform the following operations:
Mysql-u root-p
In this case, you will be asked to enter the password. Because you have not set the password before, just enter a blank line. Then you should enter mysql and enter the following mysql query:
Set password for 'root' @ 'localhost' = PASSWORD ('Password ');
Here, 'Password' is the password you want to set
Step 4. Install phpmyadmin
1. Enter the following command in terminal and execute
Sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
If you want to select the server to be associated during installation, there are a lot of settings and the like:
Select apache2. If you want to enter the user's root password, enter the root password you just set for mysql.
2. Configure phpmyadmin and apache2
Cp/etc/phpmyadmin/apache. conf/etc/apache2/sites-available/phpmyadmin
Cd/etc/apache2/sites-enabled/
Sudo ln-s ../sites-available/phpmyadmin
Sudo/etc/init. d/apache2 restart
After configuration, phpmyadmin can be used normally. You can enter 127.0.0.1/phpmyadmin in the address bar. On the logon page, enter a mysql user name and password to log on.
Step 5. Install git
Git is a very useful version control system. It is very convenient to use it to help us manage code.
1. Install git and its dependent tools
Sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
Sudo apt-get install git-core
2. simple configuration: Use the -- global option of git config to configure ~ /. Gitconfig
Git config -- global user. name "yourName"
Git config -- global user. email yourEmailAddress
In the preceding command, set yourName to your git username and yourEmailAdress to your email address.
Step 6. Install eclipse for php developers
Go to the link on the right and select a suitable version to download eclipse for php developers.
What I get after downloading is: eclipse-php-helios-linux-gtk.tar.gz, unzip:
Tar-zxvf eclipse-php-helios-linux-gtk.tar.gz
Add a desktop startup Item:
Sudo gedit/usr/share/applications/eclipsePHP. desktop
Add the following content to the file:
[Desktop Entry]
Encoding = UTF-8
Name = eclipse for php
Comment = Eclipse IDE
Exec =/home/sakura/Applications/eclipse
Icon =/home/sakura/Applications/eclipse/icon. xpm
Terminal = false
StartupNotify = true
Type = Application
Categories = Application; Development;
In the preceding sections of Exec and Icon, "/home/sakura/Applications/eclipse/" is the path of the folder obtained after decompression, and the Name can be changed as needed.
Save and close the file, and then you can find the eclipse for php application icon in the desktop startup Item.
So far, we have finally finished it.