CentOS6.5 install MySql, Apache, and PHP
1. install MySql
1. uninstall MySql from CentOS
To obtain the root permission, uninstall MySql that comes with CentOS.
yum remove mysql
2. install cmake
Download cmake
wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
Install
cd cmake-2.8.5./configure --prefix=/usr/local/cmakemakemake install
3. install MySql
Download the mysql.tar.gzpackage, which uses mysql-5.6.17.tar.gz.
So here we need to create an msyql user and group
/usr/sbin/groupadd mysql/usr/sbin/useradd -g mysql mysql
Create directory
mkdir /usr/local/mysql mkdir /usr/local/mysql/data
Unzip and install the mysql-5.6.17.tar.gz
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysqlmakemake install
Add permissions
chmod +w /usr/local/mysqlchown -R mysql:mysql /usr/local/mysql
Go to the/usr/local/mysql Directory
Scripts/mysql_install_db -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data -- user = mysql // initialize MySql database cp support-files/my-medium.cnf/usr /local/mysql/my. cnf // copy the configuration file
Modify the configuration file/usr/local/mysql/my. cnf
[mysqld] basedir = /usr/local/mysql datadir = /usr/local/mysql/data port = 3306user = mysql
Start MySql
cd /usr/local/mysql/support-files/cp ./mysql.server /etc/init.d/mysqld/etc/init.d/mysqld start
Disable MySql
/etc/init.d/mysqld stop
II. install apache server
1. uninstall httpd
rpm -qa|grep httpdrpm -e xxx
2. download apache-server
Before installation, you have to install APR, APR-util (both http://apr.apache.org/download.cgi), and pcre (http://ftp.exim.llorien.org/pcre)
1) install apr. otherwise, error: APR not found will occur during./configure httpd.
mkdir /usr/local/aprtar -zxf apr-1.5.1.tar.gz./configure --prefix=/usr/local/aprmakemake install
2) install apr-util. otherwise, error: APR-util not found will occur when./configure httpd is installed.
mkdir /usr/local/aprtar -zxf apr-util-1.5.3.tar.gz./configure --prefix=/usr/local/apr-utilmakemake install
3) install pcre. otherwise, error: pcre-config for libpcre not found will occur during./configure httpd.
mkdir /usr/local/pcreunzip -o pcre-8.35.zipcd pcre-8.35/configure --prefix=/usr/local/pcremakemake install
4) finally install httpd
mkdir /usr/local/apachetar zxvf httpd-2.4.9.tar.gzcd httpd-2.4.9./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/makemake install
5) start
/usr/local/apache/bin/apachectl start
The browser returns http: // localhost
Show It works !, OK, the apache server is configured.
3. install PHP
1. Download PHP and use php-5.5.12.tar.gz.
2. preparations
yum install libxml2yum install libxml2-devel -y
Missed this step, will report to wait./configure php, will report xml2-config not found.
For more information, see here http://www.jsjtt.com/xitongyingyong/linux/17.html
yum install libjpeg-devel
If you miss this step, an error is reported when you wait for php./configure.
If an error occurs below./configure php, refer to here solution http://www.cnlvzi.com/index.php/Index/article/id/143
3. install PHP
1) installation
tar zxvf php-5.5.12.tar.gzcd php-5.5.12./configure --with-apxs2=/usr/local/apache/bin/apxs --with-zlib-dir --with-libxml-dir --with-jpeg-dir --with-png-dir --with-gd --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring make make install
2) configure the php. ini file. The operation is located in the decompressed directory.
cp php.ini-development /usr/local/php/lib/php.ini
3) configure apache to support php
Modify vi/usr/lcoal/apache/conf/httpd. conf
Use "/" to find AddType application/x-gzip. tgz. Note that it is not marked with #. find AddType application/x-gzip. add the following content to tgz:
AddType application/x-httpd-php .php .phtmlAddType application/x-httpd-php-source .phps
Indicates that php files can be parsed in apache.
Restart apache
/usr/local/apache/bin/apachectrl start