Linux + Apache + Mysql + Perl/PHP/Python is a group of open-source software commonly used to build dynamic websites or servers. They are independent programs, but they are often used together, with higher compatibility, a powerful Web application platform is formed together. With the rapid development of open source, open source code LAMP has been integrated with J2EE and. net commercial software has formed a three-pronged trend, and the software development project has a low investment cost in software, so it has received the attention of the entire IT industry. From website
Linux + Apache + Mysql + Perl/PHP/Python is a group of open-source software commonly used to build dynamic websites or servers. They are independent programs, but they are often used together, with higher compatibility, a powerful Web application platform is formed together. With the rapid development of open source, open source code LAMP has been integrated with J2EE and. net commercial software has formed a three-pronged trend, and the software development project has a low investment cost in software, so it has received the attention of the entire IT industry. More than 70% of website traffic is provided by LAMP, which is the most powerful website solution.
To install the LAMP server, you must install apache, mysql, and PHP in sequence.
I. apache compilation and Installation
Download the httpd-2.2.21.tar installation package first.
A component that GCC uses to install the source code package,
Start installation: install the following package in sequence to complete GCC installation.
Rpm-ivh kernel-headers-2.6.18-53.el5.i386.rpm
Rpm-ivh glibc-headers-2.5-18.i386.rpm
Rpm-ivh glibc-devel-2.5-18.i386.rpm
Rpm-ivh libgomp-4.1.2-14.el5.i386.rpm
Rpm-ivh gcc-4.1.2-14.el5.i386.rpm
Rpm-ivh libstdc ++ devel-4.1.2-14.el5.i386.rpm
Rpm-ivh gcc-c ++-4.1.2-14. el5.i386. rpm
Compilation and Installation Steps
1. Release the source code package.
2. configure configuration before Compilation
3. Compile the server program
4. Install compiled programs
Decompress the httpd package
Cp httpd-2.2.21.tar/usr/local/src
Cd/usr/local/src
Tar zxvf httpd-2.2.21.tar
Go to the decompressed directory and run the configure command to configure the files before compilation.
Cd httpd-2.2.21
./Configure -- prefix =/usr/local/apache2 -- enable-so -- enable-rewrite
**************************************** *********
-- Prefix: Specifies the installation directory of the apache server program.
-- Enable-so: specifies that the apache server can dynamically load third-party modules.
-- Enable-rewrite: specifies that the apache server can rewrite the url.
**************************************** *********
Compile the server program
Make
If no error occurs, start installation.
Make install
After the installation is complete, first disable the httpd service that comes with the system. Otherwise, port 80 will conflict when the source code compiling apache server is enabled.
Service httpd stop
/Usr/local/apache2/bin/apachect1 start(Make sure that the path is fully written)
Test on the windows client. The web page displays the default home page of the apache server (different versions may be different)
In apache compiled by source code, httpd. conf can also be configured, which can be found in the/usr/local/apache2/conf path.
ServerRoot "/usr/local/apache2"-- The root directory is the installation directory.
Listen 80-- The listening port is 80.
User daemon-- User Name daemon
Group daemon-- Group daemon
DocumentRoot "/usr/local/apache2/htdocs"-- Home page Directory
Go to the/usr/local/apache2/htdocsdirectory and modify the index.html file,
Enter Welcome to soho2's home in HTML!
Welcome to soho2's home!
Go back to windows browser to view
Ii. Install the mysql database
Decompress the mysql installation package to the/usr/local directory.
# Tar zxvf mysql-5.1.30-linux-i686-glibc23.tar.gz-C/usr/local/
Add mysql users and groups
# Groupadd mysql
# Useradd-g mysql
Create a soft link
# Ln-s/usr/local/mysql-5.1.30-linux-i686-glibc23 mysql
Go to the support-files directory, select a medium-sized database my-medium.cnf, and save it as/etc/my. cnf
# Cp mysql/support-files/my-medium.cnf/etc/my. cnf
After you press enter, you will be prompted to overwrite the original file. This is because RHEL originally has mysql, which can be viewed using rpm-q mysql.
# Rpm-q mysql
Mysql-5.0.77-4.el5_6.
5.0.77 is installed by default, and 5.1.34 is installed. Therefore, overwrite the original file.
Modify the file permissions in the mysql directory
# Cd/usr/local/mysql
# Chown-R root.
# Chgrp-R mysql.
# Chown-R mysql data
Modify/etc/my. cnf, open the password in [client], and set the password.
Initialize the mysql database
# Cd/usr/local/mysql
# Scripts/mysql_install_db -- user = mysql
**************************************** ************
If an error occurs, run
# Sed-I's/log-bin = mysql-bin/# log-bin = mysql-bin/G'/etc/my. cnf
# Sed-I's/binlog_format = mixed/# binlog_format = mixed/G'/etc/my. cnf
# Sed-I's/skip-locking/nmax_connections = 1000/nwait_timeout = 5/G'/etc/my. cnf
Reinitialize
# Scripts/mysql_install_db -- user = mysql
**************************************** ************
Replace the mysql. server File with the original mysql Startup File
# Cp support-files/mysql. server/etc/rc. d/init. d/mysqld
# Chmod 755/etc/rc. d/init. d/mysqld
# Chkconfig -- add mysqld
# Chkconfig mysqld on
Start mysql Service
# Service mysqld start
After the service is enabled, check whether port 3306 of mysql is enabled.
# Netstat-ntl
Create the mysql root Account Password. Here, the root account is the database administrator account, which is separate from the linux root Account.
# Cd/usr/local/mysql
# Bin/mysqladmin-u root password 123456
Log on to the database with root
# Bin/mysql-u root-p
Prompt for password 123456
Enter show databases;
You can find three databases. Now mysql is ready!