LAMP is the abbreviation of Linux Apache MySQL PHP, in fact, the Apache, MySQL and PHP installed on the Linux system, to form an environment to run PHP scripting language. As for what is the PHP scripting language, I no longer introduce, please check your own information. Apache is the most common web services software, and MySQL is a relatively small database software, both software and PHP can be installed on the Windows machine. Let me teach you how to build this lamp environment.
"Install MySQL"
In general, we usually install MySQL is the source package installed, but because it needs to compile a long time, so, the author recommends that you install the binary-free compiler package. You can go to the MySQL official website to download: http://www.mysql.com/downloads/specific version according to your platform and requirements, the current more commonly used mysql-5.1.x and mysql-5.3.x below is the installation steps:
1. Download MySQL to/usr/local/src/
cd/usr/local/src/
wget http://syslab.comsenz.com/downloads/linux/mysql-5.0.86-linux-i686-icc-glibc23.tar.gz
2. Decompression
Tar zxvf/usr/local/src/mysql-5.0.86-linux-i686-icc-glibc23.tar.gz
3. Move the extracted data to the/usr/local/mysql
MV Mysql-5.0.86-linux-i686-icc-glibc23/usr/local/mysql
4. Establish MySQL User
Useradd MySQL
5. Initializing the database
The code is as follows |
Copy Code |
Cd/usr/local/mysql Mkdir/data/mysql; Chown-r Mysql:mysql/data/mysql ./scripts/mysql_install_db--user=mysql--datadir=/data/mysql--user
|
Defines the owner of the database,--datadir defines where the database is installed, and recommends placing it on a large-space partition that needs to be created by itself.
6. Copy configuration file
The code is as follows |
Copy Code |
CP Support-files/my-large.cnf/etc/my.cnf7. Copy startup script file and modify its properties CP Support-files/mysql.server/etc/init.d/mysqld chmod 755/etc/init.d/mysqld8.
|
Modify Startup script
Vim/etc/init.d/mysqld need to be modified where there is datadir=/data/mysql (the directory defined before initializing the database)
9. Add the boot script to the system service and set boot up and start MySQL
If it does not start, check the error log under/data/mysql/, which is usually the hostname. Err.
"Install Apache"
The code is as follows |
Copy Code |
cd/usr/local/src/ wget http://syslab.comsenz.com/downloads/linux/httpd-2.2.11.tar.gz Useradd www (add Apache run account) Tar zvxf httpd-2.2.11.tar.bz2 CD httpd-2.2.11 ./configure--prefix=/usr/local/apache2--with-included-apr--enable-so--enable-deflate=shared--enable-expires= Shared--enable-rewrite=shared--enable-static-support--disable-userdir Make Make install
|
"Install PHP"
code is as follows |
copy code |
wget http://syslab.comsenz.com/downloads/linux/php-5.2.10.tar.gz Tar zvxf php-5.2.10.tar.gz CD php-5.2.10 ./configure--prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-sockets --enable-exif --disable-ipv6 Make && make install Mkdir/usr/local/php/etc CP Php.ini-dist/usr/local/php/etc/php.ini |
"Apache combines PHP"