1、首先安装Apache:
走自己的路,让别人说去吧!
我就像一只趴在玻璃上的苍蝇,前途一片光明,但又找不到出路!
下载的是
http://httpd.apache.org/download.cgi#apache24,Unix Source
解压后进入相应目录,
./configure --prefix=/usr/local/apache --enable-shared=max --enable-module=rewrite --enable-module=so
这里通过enable-module参数告诉设置脚本,需要启动so和rewrite模块,so模块是用来提DSO支持的Apache核心模块,而rewrite模块则是用意实现地址重写的模块,由于rewrite模块需要DBM支持,如果在初次安装时没有编译进Apache。
结果出现如下错误:
Configure:error: APR not found, please read documetation
好吧,安装apr,网上找到的:
$wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
$tar -zxf apr-1.4.5.tar.gz
$cd apr-1.4.5
$./configure --prefix=/usr/local/apr
$make && sudo make install
再次安装,还有问题:
Configure:error: APR-util not found, please read documetation
好吧,再找了一个
$wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
$tar -zxf apr-1.4.5.tar.gz
$cd apr-1.4.5
$./configure--prefix=/usr/local/apr
$make&& sudo make install
还有一个问题:
Configure:error: pcre not found, please read documetation
再来:
$ wgethttp://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
$ unzip -o pcre-8.10.zip
$ cd pcre-8.10
$./configure--prefix=/usr/local/pcre
$make && sudo makeinstall
最后安装变成这样,不然还是找不到:
$ ./configure --prefix=/usr/local/apache--enable-shared=max --enable-module=rewrite --enable-module=so--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util--with-pcre=/usr/local/pcre
$make & sudo make install
一切顺利,可是到最后,
/usr/local/apache/bin/httpd -k start 启动时出问题了
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
大体意思是不能获得服务器的域名
网上找了找,说是配置一下httpd.conf,具体如下:
$ sudo vim /usr/local/apache/conf/httpd.conf
找到#ServerName www.example.com:80 把#去掉,再重启apache即可没事了
OK! 浏览器输入localhost:80显示 It works!
2、安装php,我装得版本是5.4.8:
./configure --prefix=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-mysql
结果出错了,错误如下:
error: xml2-config not found. Please check your libxml2 installation
果断百度之,原因是缺少支持php的库造成的,那就安装吧,需要的是这个:
sudo apt-get install libxml2-dev
装完,再次
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql
OK ,出现:
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
OK,开始编译,make,make install
还有一处是将解压后的PHP文件夹中的php.ini-development或者php.ini-production移到/usr/local/lib/php.ini,不然无法解析php,以前的版本好像是php.ini-dnist吧
sudo mv php.ini-development /usr/local/apache/lib/php.ini
编辑/usr/local/apache/conf/httpd.conf
sudo vi /usr/local/apache/conf/httpd.conf
加入
LoadModule php5_module modules/libphp5.so
注意是 modules/libphp5.so,和以前版本不一样的地方
再加入:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
重启一下apache,测试一下,
<?php
PHPinfo();
?>
保存为test.php,写入../apache/htdocs/test.php
在浏览器输入
http://127.0.0.1/test.php,就能看到一些PHP信息。
3、安装mysql: 都是从解压厚的INSTALL_SOURCE文档中获得的,所以大家可以参考该文件
初始工具:gcc,cmake,make
增加用户组和用户
shell> sudo groupadd mysql
shell> sudo useradd -r -g mysql mysql
将压缩包.tar.gz解压缩到所需的目录
进入解压缩的目录
shell> sudo cmake .
安装遇到错误:
– MySQL 5.5.11
– Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:82 (MESSAGE):
Curses library not found. Please install appropriate package,
下载工具libncurses5-dev,如果在RedHat 下是ncurses-devel。
shell> sudo apt-get install libncurses5-dev
下载之后先移除目录中的CMakeCache.txt
shell> sudo rm CMakeCache.txt
然后输入
shell> sudo cmake .
shell> sudo make
shell> sudo make install
编译结束
shell>ln -s mysql-5.5.28 mysql //创建链接
shell> cd /usr/local/mysql
shell>sudo chown -R mysql . //修改mysql目录的所有者
shell> sudo chgrp -R mysql . //修改mysql目录的所有群组
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell>cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql & //安全模式下启动
可以按照下面的方式启动:
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
/etc/init.d/mysqld start
也可以添加环境变量如下:
sudo vi /etc/profile
//,加入如下信息:
export MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:${MYSQL_HOME}/bin
export MYSQL_HOME PATH
这样就可以在任何目录下运行mysql来启动了。
![](https://i-blog.csdnimg.cn/blog_migrate/aced233e305a2ce2979e4952b32a72e7.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/5acbfc39595c5f95112133fd45de50d9.gif)