1505112345 星期一 CentOS-6.5-x86_64-minimal-httpd-2.4.12-mysql-5.6.23-php-5.6.8


CentOS-6.5-x86_64-minimal-httpd-2.4.12-mysql-5.6.23-php-5.6.8

------------------------------ 软件准备

http://mirror.bit.edu.cn/apache/apr/apr-1.5.2.tar.gz
http://mirror.bit.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz

http://www.memcached.org/files/memcached-1.4.24.tar.gz
http://pecl.php.net/get/memcache-3.0.8.tgz

http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.12.tar.gz
ftp://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6/mysql-5.6.23.tar.gz
http://cn2.php.net/get/php-5.6.8.tar.gz/from/this/mirror

[root@localhost ~]# ls /usr/local/src/
apr-1.5.2.tar.gz
apr-util-1.5.4.tar.gz
pcre-8.37.tar.gz
httpd-2.4.12.tar.gz
mysql-5.6.23.tar.gz
php-5.6.8.tar.gz
memcache-3.0.8.tgz // php extension
memcached-1.4.24.tar.gz

yum install gcc gcc-c++ cmake lynx autoconf bison automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* -y

wget http://mirror.bit.edu.cn/apache/apr/apr-1.5.2.tar.gz
./configure --prefix=/usr/local/apr

wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
./configure --prefix=/usr/local/pcre

------------------------------ apache install

[root@localhost httpd-2.4.12]# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-so
[root@localhost httpd-2.4.12]# make && make install
[root@localhost ~]# /usr/local/apache/bin/apachectl start
[root@localhost ~]# cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd

[root@localhost ~]# vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
[root@localhost ~]# services iptables restart

------------------------------ mysql install

[root@localhost mysql-5.6.23]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306

[root@localhost mysql-5.6.23]# make && make install

[root@localhost ~]# groupadd mysql

[root@localhost ~]# useradd -r -g mysql mysql

[root@localhost ~]# chown -R mysql /usr/local/mysql

[root@localhost ~]# chgrp -R mysql /usr/local/mysql

[root@localhost ~]# chmod 775 /usr/local/mysql

[root@localhost ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

[root@localhost ~]# chown -R root /usr/local/mysql

[root@localhost ~]# chown -R mysql /usr/local/mysql/data

[root@localhost ~]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

[root@localhost ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

[root@localhost ~]# /etc/init.d/mysqld start
Starting MySQL... SUCCESS!

[root@localhost ~]# ln -s /usr/local/mysql/bin/mysql /usr/bin
[root@localhost ~]# /usr/local/mysql/bin/mysqladmin -u root password ‘root‘

mysql> select host,user,password from user;

mysql> delete from user where password=‘‘;

mysql> grant all privileges on *.* to hzw@‘%‘ identified by "123456";

mysql> flush privileges;

[root@localhost ~]# vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
[root@localhost ~]# services iptables restart

------------------------------ php install

[root@localhost php-5.6.8]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql

[root@localhost php-5.6.8]# make && make install

修改apache配置文件 /usr/local/apache/conf/httpd.conf
LoadModule php5_module modules/libphp5.so

AddType application/x-httpd-php .php 或者

<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

通过phpinfo(); 找到php.ini 和 extension 的目录
/usr/local/apache/htdocs/phpinfo.php
Configuration File (php.ini) Path /usr/local/php/lib
Loaded Configuration File /usr/local/php/lib/php.ini
extension_dir /usr/local/php/lib/php/extensions/no-debug-zts-20131226

[root@localhost ~]# cp /usr/local/src/php-5.6.8/php.ini-development /usr/local/php/lib/php.ini

------------------------------ 总结

[root@localhost ~]# /usr/local/apache/bin/apachectl start
[root@localhost ~]# /etc/rc.d/init.d/httpd start
[root@localhost ~]# /etc/init.d/mysqld start

配置开机启动 vim /etc/rc.d/rc.local加入
/etc/init.d/httpd start
/etc/init.d/mysqld start
svnserve -d -r /data/svn

------------------------------ php install extension

[root@localhost ~]# wget http://pecl.php.net/get/memcache-3.0.8.tgz
[root@localhost ~]# tar zxf memcache-3.0.8.tgz
[root@localhost memcache-3.0.8]# /usr/local/php/bin/phpize --with-php-config=/usr/local/php/bin/php-config
[root@localhost memcache-3.0.8]# ./configure --with-php-config=/usr/local/php/bin/php-config
[root@localhost memcache-3.0.8]# make && make install
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
[root@localhost memcache-3.0.8]# vim /usr/local/php/lib/php.ini
extension=/usr/local/php/lib/php/extensions/no-debug-zts-20131226/memcache.so

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。