一,编译安装httpd
1.安装软件包
# tar zxf httpd-2.2.25.tar.gz
# cd httpd-2.2.25
# ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-cgi --enable-ssl --enable-charset-lite
--------------------------------------分割线 --------------------------------------
Ubuntu 13.04 安装 LAMP\Vsftpd\Webmin\phpMyAdmin 服务及设置 http://www.linuxidc.com/Linux/2013-06/86250.htm
CentOS 5.9下编译安装LAMP(Apache 2.2.44+MySQL 5.6.10+PHP 5.4.12) http://www.linuxidc.com/Linux/2013-03/80333p3.htm
RedHat 5.4下Web服务器架构之源码构建LAMP环境及应用PHPWind http://www.linuxidc.com/Linux/2012-10/72484p2.htm
LAMP源码环境搭建WEB服务器Linux+Apache+MySQL+PHP http://www.linuxidc.com/Linux/2013-05/84882.htm
LAMP+Xcache 环境搭建 http://www.linuxidc.com/Linux/2014-05/101087.htm
--------------------------------------分割线 --------------------------------------
配置参数用途:
--prefix=:指定安装目录
--enable-so:支持动态加载模块
--enable-rewrite :支持网站地址重写
--enable-cgi:支持CGI程序脚本
--enable-ssl:支持SSL加密
--enable-charset-lite:支持多语言编码
配置错误提示:
no SSL-C headers found
configure: error: ...No recognized SSL/TLS toolkit detected
安装相应库文件
# yum -y install openssl-devel
# ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-cgi --enable-ssl --enable-charset-lite
# make && make install
2.建立服务脚本
# cd /usr/local/httpd/bin/
# cp apachectl /etc/init.d/httpd
# vim /etc/init.d/httpd
#!/bin/sh
# chkconfig: 2345 85 35
# description:Apache is a world wide web server
……
# chkconfig --add httpd
# chkconfig --list httpd
httpd 0:off1:off2:on3:on4:on5:on6:off
3.修改主配置文件及启动服务
# vim /usr/local/httpd/conf/httpd.conf
ServerName www.linuxidc.com:80
# service httpd start
[root@client bin]# netstat -ln | grep :80
tcp 0 0 :::80 :::* LISTEN
二.编译安装mysql
1. 添加运行用户
# useradd -M -u 49 -s /sbin/nologin mysql
2.安装软件包
# tar zxf mysql-5.1.62.tar.gz
# cd mysql-5.1.62
# ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=gbk,gb2312
配置参数用途:
--prefix=:指定安装目录
--with-charset=utf8:指定默认字符集
--with-collation=utf8_general_ci:指定默认的校对规则集
--with-extra-charsets=gbk,gb2312:设置支持的其他字符集
配置错误信息:
checking for termcap functions library... configure: error: No curses/termcap library found
安装库文件
# yum -y install ncurses-devel libtermcap-devel
# ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=gbk,gb2312
# make && make install
编译错误信息:
../depcomp: line 571: exec: g++: not found
make[1]: *** [my_new.o] Error 127
make[1]: Leaving directory `/root/Desktop/mysql-5.1.62/mysys'
make: *** [all-recursive] Error 1
# yum -y install gcc gcc-c++ //需要安装软件
再重新配置编译安装
更多详情见请继续阅读下一页的精彩内容: http://www.linuxidc.com/Linux/2014-05/101171p2.htm
3.初始化设置
# cd MySQL-5.1.62/support-files/
# cp my-medium.cnf /etc/my.cnf //复制样本配置文件
# cd /usr/local/mysql/bin/
# ./mysql_install_db --user=mysql //初始化库表
4.权限调整及执行优化
# chown -R root:mysql /usr/local/mysql/
# chown -R mysql /usr/local/mysql/var/ //使用户mysql有权写库
# ln -s /usr/local/mysql/bin/* /usr/local/bin/ //建程序快捷方式
# ln -s /usr/local/mysql/lib/mysql/* /usr/lib64/ //链接库文件
# ln -s /usr/local/mysql/include/mysql/* /usr/include/ //链接头文件
5.添加为系统服务,并启动服务
# cd mysql-5.1.62/support-files/
# cp mysql.server /etc/init.d/mysqld //复***务脚本
# chmod +x /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# service mysqld start
//如果启动失败,先killall -9 mysqld,再service mysqld restart
三.编译安装php
1.安装软件包
# yum -y install libxml2-devel //配置需要这个库文件
# tar zxf php-5.4.19.tar.gz
# cd /usr/src/php-5.4.19/
# ./configure \
--prefix=/usr/local/php --enable-mbstring --enable-sockets \
--with-apxs2=/usr/local/httpd/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-config-file-path=/usr/local/php
关键配置参数
--prefix=:指定安装目录
--enable-mbstring:支持多字节字符
关注公众号,解锁完整文章
微信扫码关注 星哥玩云,
在公众号对话框回复关键词 星哥玩云博客 获取验证码。输入后即可阅读全文,
一次解锁全站文章通用。