LAMP配置

1.安装mysql

shell> groupadd -g 500 mysql
shell> useradd -u500 -gmysql -M mysql
shell> tar -xzf mysql.**.tar.gz
shell> cd mysql.**
shell> ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
shell> make
shell> make install
shell> cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql //开机启动mysql
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &

注意直接执行后会出现下面错误:
Starting mysqld daemon with databases from /usr/local/mysql/data STOPPING server from pid file /usr/local/mysql/data/localhost.localdomain.pid 070514 19:15:13 mysqld ended
需执行 shell> chown -R mysql.mysql data

修改root密码:
use mysql
update user set Password=password("123456") where User="root";
delete from user where User="";

2.apache安装
shell> tar -xzf httpd-2.2.4.tar.gz
shell> cd httpd-2.2.4
shell> ./configure --prefix=/usr/local/apache2 --enable-rewrite=shared --enable-speling=shared --enable-module=so
shell> make
shell> make install

3.iconv安装
shell> ./configure --prefix=/usr/local/iconv
shell> make
shell> make install

4.gd部分安装
zlib包
shell> ./configure --prefix=/usr/local/zlib
shell> make check
shell> make install

libpng包(支持PNG)
shell> ./configure --prefix=/usr/local/libpng
shell> make
shell> make install

jpeg-6b包(支持jpg格式)
shell> ./configure --prefix=/usr/local/jpeg-6b --enable-share --enable-static
shell> make test
shell> make
shell> make install
shell> make install-lib

freetype包(字体支持)
shell> ./configure --prefix=/usr/local/freetype
shell> make
shell> make install

最后安装gd包
shell> ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg-6b --with-zlib-dir=/usr/local/zlib --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype
shell> make
shell> make install

make时会出现
make[2]: *** [gd_png.lo] Error 1
make[2]: Leaving directory `/tmp/gd-2.0.26gif'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/gd-2.0.26gif'
make: *** [all] Error 2
需要复制/usr/local/libpng/include/目录下的cp /usr/local/libpng/include/pngconf.h /home/jong/tmp/gd-2.0.34
cp /usr/local/libpng/include/png.h /home/jong/tmp/gd-2.0.34

5.安装php

shell> ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-gd=/usr/local/gd2 --with-jpeg-dir=/usr/local/jpeg-6b --with-zlib-dir=/usr/local/zlib --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype --enable-trace-vars -with-mysql=/usr/local/mysql -with-iconv=/usr/local/iconv --enable-mbstring=all --with-curl --enable-track-vars --with-DBA --enable-mbstr-enc-trans --enable-mbregex --with-config-file-path=/usr/local/php --with-xml --with-gettext
shell> make
shell> make install
shell> cp php.ini-dist /usr/local/php/php.ini

编辑apache配置档
shell> cd /usr/local/apache2/conf
shell> vi httpd.conf
在LoadModule php4_module modules/libphp4.so
添加AddType application/x-httpd-php .php

OK,基本的安装已经完成,如果重新起动APACHE出现:/usr/local/apache2/bin/apachectl start Syntax error on line 232 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp4.so into server: /usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied
那就要按照下面的方法解决:

编辑/etc/selinux/config,找到这段:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing

把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:
SELINUX=disabled
保存,关闭。

编辑/etc/sysconfig/selinux,找到:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing

如果SELINUX已经是 SELINUX=disabled,那么就不用改了,否则就把SELINUX=enforcing 注释掉,新加一行:
SELINUX=disabled
保存,退出。

如果你碰到其他类似提示:
cannot restore segment prot after reloc: Permission denied
哪应该是SELinux的问题,可以考虑把它关闭。

相关网站:
phpbulo http://www.phpbulo.com
apache http://www.apache.org
php http://www.php.net
mysql http://www.mysql.org
gd http://www.libgd.org/
png http://www.libpng.org/
zlib http://www.zlib.net/
jpeg ftp://ftp.uu.net/graphics/jpeg/
freetype http://www.freetype.org/ http://savannah.nongnu.org/projects/freetype 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值