linux下安装apache,mysql,php5简单过程和整理

安装apache
tar -xvzf httpd-2.2.22.tar.gz
./configure --enable-dav --enable-so --enable-mods-shared=all --prefix=/usr/local/apache2 --with-included-apr
make
make install
可能会遇到的错误:
modules/http/.libs/libmod_http.a(byterange_filter.o): In function `ap_set_byterange':
byterange_filter.c:(.text+0x12c1): undefined reference to `apr_array_clear'
collect2: ld returned 1 exit status
make[1]: *** [httpd] Error 1
make[1]: Leaving directory `/root/httpd-2.2.22'
make: *** [all-recursive] Error 1
解决:
编译时加入--with-included-apr

apache加入到自启动行列
Apache安装路径为:/usr/local/apache2
Linux的启动级别为5,版本为Linux AS4

Apache安装完后,发现Apache无法自动启动,查看/etc/rc.d/rc5.d/下,应该没有S打头,httpd结尾的链接文档。
1、将apachectl文档拷贝到/etc/rc.d/init.d 中,然后在/etc/rc.d/rc5.d/下加入链接即可。
命令如下:
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd //假如有其他的版本的Apache存在,也能够直接覆盖掉
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S85httpd //建立链接(85的意义后面介绍)
此时Apache就能够自动启动了。
2、运行chkconfig --list,发现没有linux服务列表中httpd,通过chkconfig --add httpd来添加,但是提示:httpd服务不支持 chkconfig。需要编辑/etc/rc.d/init.d/httpd,添加以下注释信息:
# chkconfig: 345 85 15
# description: Apache
第一行3个数字参数意义分别为:哪些Linux级别需要启动httpd(3,4,5);启动序号(85);关闭序号(15)。
保存后执行:chkconfig --add httpd,成功添加。
在rc3.d、rc4.d、rc5.d路径中会出现S85httpd的链接文档,其他运行级别路径中会出现K61httpd的链接文档。
3、运行chkconfig --list,httpd在其中。

安装mysql5

rpm -ivh Mysql—Server-xxxx.rpm

问题:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

解决: 原因是,/var/lib/mysql 的访问权限问题。
shell> chown -R mysql:mysql /var/lib/mysql

修改密码:usr/bin/mysqladmin -u root password 'new-password'
格式:mysqladmin -u用户名 -p旧密码 password 新密码


安装php5.3.8
tar -zxvf  php**

编译配置:    ./configure --prefix=/usr/local/php --with-mysql=/usr/ --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc

指定Mysql,必须先安装Mysql-dev**.rpm

猜你喜欢

转载自smallboby.iteye.com/blog/1572383
今日推荐