LAMP installation notes (lamp installation configuration test in linux)

Source: Internet
Author: User
LAMP installation note (lamp installation and configuration test in linux)-Linux Enterprise Application-Linux server application information. For details, see the following. I set up lamp 2nd times and read related materials online, but some details are not the same. So now let's take a look at the relevant records for future convenience. However, in some cases, it is complicated to write and you must forgive me. There are no problems with my tests. If you have any problems, please point them out!

Platform is linux as4 + httpd-2.2.8 + mysql-5.0.22 + php-5.2.6

First install the package httpd-2.2.8.tar.gz, mysql-5.0.22.tar.gz, php-5.2.6.tar.gz. These packages can be downloaded on the official website for free. Put them in the/usr/localsrc directory and decompress them. /Usr/local/src is the directory where the source code is stored. In general, people are used to putting the source code file here.

1. Install Mysql
? Source code file directory decompressed by ysql
./Configure -- prefix =/usr/local/mysql # Set the installation path of mysql
Make & make install # compile and install.
Configure mysql
Groupadd mysql # Add a mysql Group
Useradd-g mysql # Add a mysql user and add it to the mysql Group
Cd/usr/local/mysql/# Switch to the cd/usr/local/mysql/directory
Chown-R mysql. # change the owner of the current directory to a mysql user
Chgrp-R mysql. # change the mysql user files in the current directory to the mysql Group
Cd/usr/local/src/mysql-5.0.22/support-files # To the support-files under the source mysql directory
Cp my-medium.cnf/etc/my. cnf # copy file to/etc/overwrite my. cnf File
Cd/usr/local/mysql/bin # change the directory to/usr/local/mysql/bin
./Mysql_install_db -- user = mysql # initialize the database as mysql
Cd/usr/local/mysql # change the directory to/usr/local/mysql
Chown-R mysql: mysql var # change the mysql user of the var directory to the mysql Group
Chmod 755 var # change the var directory permission
Cd/usr/local/mysql/bin # change the directory to/usr/local/mysql/bin
./Mysqld_safe -- user = mysql & # generate a socket with the mysql user Startup Library
Netstat-ant | grep 3306 # Check whether mysql is started. mysql uses port 3306.
Mysqladmin-u root password 'admin' # Set the password for the root user of mysql
Cd/usr/local/src/mysql-5.0.22/support-files/# Change Contents to cd/usr/local/src/mysql-5.0.22/support-files/
Cp mysql. server/etc/init. d/mysqld # copy the file for Automatic startup upon startup
Chmod 755/etc/init. d/mysqld # Grant mysqld Permissions
Chkconfig -- add mysqld # add the mysqld service to the System
Chkconfig mysqld on # Open the myslqd Service
Service mysqld restart # Start the mysql service
Test mysql:
Cd/usr/local/mysql/bin # change the directory to cd/usr/local/mysql/bin
Mysql-u root-p # log on to mysql
Show databases; # view database tables

2. install Apache
First, check whether the apache that comes with linux is installed. If yes, uninstall it.
Command: rpm-qa | grep httpd # query installed software
Rpm-e -- nodeps software name # uninstall software to check Dependencies
Go to the Apache decompressed source code directory
. /Configure -- prefix =/usr/local/httpd -- with-mysql =/usr/local/mysql/-- enable-module = so -- enable-mod-shared = max # Set Apache installation path, specify the mysql path and open the so module. The so module is the apache core module supported by DSO. All modules are loaded as dynamic modules.
Make & make install # compile and install.
Cp/usr/local/httpd/bin/apachectl/etc/init. d/httpd # copy the Startup File and run the httpd service automatically when the system starts.
Run # chkconfig:-85 15
# Description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
Copy the content to the/etc/init. d/httpd file #! /Bin/bash.
The chkconfig tool must have a description of chkconfig and description in the script.
For more information about chkconfig, see the man documentation.
Chkconfig -- add httpd # add the httpd service to the System
Chkconfig httpd on # Open the httpd service
Service httpd start # start the httpd service
Netstart-ant | grep: 80 # Check whether the service is started
Configure Apache
Vi/usr/local/httpd/conf/httpd. conf
Remove "#" before "ServerName" and add ip addresses, domain names, and ports.
Example: ServerName 192.168.0.11: 80
Test APache:
Enter your own ip address and port in the browser for testing.
For example, enter http: // 192.168.0.11: 80 in the browser.

3. install Php
Go to the php decompressed source code file directory
. /Configure -- prefix =/usr/local/php -- with-mysql =/usr/local/mysql -- with-apxs2 =/usr/local/httpd/bin/apxs -- with-apxs2 =/usr /local/httpd/bin/apxs
Make & make install # compile and install.
Cp php. ini-dist/usr/local/lib/php. ini
Vi/etc/httpd. conf
Find "# AddType application/x-gzip. gz. tgz"
And add
AddType application/x-httpd-php. php
AddType application/x-httpd-php-source. phps
These two lines aim to enable apache to recognize php.
Find "DirectoryIndex index.html"
Add index. php to make index. php a response page.
Test environment:
Cd/usr/local/httpd/htdocs/
# Vi/usr/local/httpd/htdocs/index. php
Input:
Phpinfo ();
?>
# Service httpd restart apache server
For example, enter http: // 192.168.0.11/index. php In the browser to test the function. If it succeeds, you will be prompted to save the file content.
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.