LAMP 环境源码安装配置过程
内容介绍: 1,安装完 Linux 后的操作 2,编译安装 apache2 3,编译安装 mysql 4,编译安装 php 5,为 PHP 添加 mysqli 扩展支持 6,为 PHP 添加 mcrypt 扩展支持 7,为 PHP 安装 GD 扩展 8,安装 phpMyAdmin 9,介绍基于指令行的网页浏览器 lynx 1,安装完 Linux 后的操作 安装完 Linux 后,卸载自带的 apache, mysql, php 等残余的较旧的 rpm 软件包; rpm 系列的发行版用 rpm –e xxxx.rpm 卸载; 2,编译安装 apache2 进入源码文件夹。查看 INSTALL 文件: Prerequisite knowledge and software for compiling: * Basic Unix skills (being able to operate "make" and a C compiler) * An ANSI C compiler * flex: Version 2.5.4 * bison: Version 1.28 (preferred), 1.35, or 1.75 * A web server * Any module specific components (such as gd, pdf libs, etc.) 下载 gnu.org/software/flex/和 gnu.org/software/bison/ 安装 flex 和 bison 先安装 bison: configure;make;make install;即可; 然后安装 flex: configure;make;make instal;即可 进入 httpd 源码包开始编译 [root@localhost httpd-2.4.1]# ./configure --enable-so Configuring Apache Portable Runtime library ... (报错) checking for APR... no configure: error: APR not found. Please read the documentation. 需要安装依赖包 apr(apache portable runtime) apr-1.4.6.tar.bz2; apr-iconv-1.2.1.tar.bz2; apr-util-1.4.1.tar.bz2;
apache 的 apr 项目目前有三部分组成,分别是 apr、apr-util、apr-iconv apr 中包含了一些通用的开发组件,包括 mmap,DSO 等等 apr-util 该目录中也是包含了一些常用的开发组件。这些组件与 apr 目录下的相比,它们与 apache 的关系更加密切一些。比如存储段和存储段组,加密等等。 apr-iconv 包中的文件主要用于实现 iconv 编码。 [root@localhost apr-1.4.6]# ./configure config.status: executing libtool commands rm: cannot remove `libtoolT': No such file or directory config.status: executing default commands 提示缺少 libtool 这步包依赖比较麻烦 偷个懒 直接 yum install libtool; [root@localhost apr-1.4.6]# yum install libtool
Dependencies Resolved ================================================================================================ Package Arch Version Repository Size ================================================================================================ Installing: libtool i686 2.4-9.fc15 updates 575 k Installing for dependencies: autoconf noarch 2.68-2.fc15 fedora 858 k automake noarch 1.11.1-5.fc14 fedora 545 k Updating for dependencies: cpp i686 4.6.3-2.fc15 updates 3.9 M gcc i686 4.6.3-2.fc15 updates 11 M libgcc i686 4.6.3-2.fc15 updates 100 k libgomp i686 4.6.3-2.fc15 updates 103 k Transaction Summary ================================================================================================ Install 3 Package(s) Upgrade 4 Package(s) Total download size: 17 M
然后就可以安装 apr-1.2.6; make
; make install; 然后安装 apr-util-1.4 [root@localhost apr-util-1.4.1]# ./configure --with-apr=/usr/local/apr 然后 make make install 完成 然后安装 apr-iconv-1.2.1 [root@localhost apr-iconv-1.2.1]# ./configure --with-apr=/usr/local/apr make ; make install 然后再进入 httpd 源码文件夹 [root@localhost httpd-2.4.1]# ./configure --enable-so 又有新报错,依赖包: checking for pcre-config... false configure: error: pcre-config for libpcre not found. PCRE is required and available from pcre.org/
然后安装 pcre-0.8 configure; make 的时候报错 安装 pcre 出现 libtool: compile: unrecognized option `-DHAVE_CONFIG_H' libtool: compile: Try `libtool --help' for more information. make[1]: *** [pcrecpp.lo] Error 1 make[1]: Leaving directory `/root/pcre-8.30' make: *** [all] Error 2 更新最新的 gcc-c++ 包即可通过编译 yum install gcc-c++ 然后重新 configure;make;make install;
然后再进入 httpd 源码文件夹 [root@localhost httpd-2.4.1]# ./configure --enable-so 这次终于没再报错,make;make install;
可执行文件安装的到/usr/local/apache2/bin [root@localhost bin]# ./apachectl start 开启 apache 用 lynx(指令行模式的浏览器)查看 apache 测试页; # lynx localhost 显示 It works!表示 apache 安装成功; 然后把 apache 停了继续安装 Mysql. 3,编译安装 mysql 编译安装 mysql 之前需要创建 mysql 用户: # groupadd mysql # useradd -r -g mysql mysql 然后 cpnfigure [root@localhost mysql-5.1.62]#./configure --prefix=/usr/local/mysql \ > --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static \ > --with-extra-charsets=all --with-plugins=innobase,myisam \ > --with-unix-socket-path=/usr/local/mysql/sock/mysql.sock \ > --enable-thread-safe-client --enable-assembler --without-embedded-server
解释: --with-mysqld-ldflags=-all-static //以静态方式编译服务器端 --with-client-ldflags=-all-static //以静态方式编译客户端 --with-extra-charsets=all //添加所有字符集 --with-plugins=innobase,myisam //添加 mysql 存储引擎 --with-unix-socket-path=/usr/local/mysql/sock/mysql.sock --enable-thread-safe-client //以线程方式编译客户端,提高性能
--enable-assembler //使用汇编,提高性能 --without-embedded-server //去除 embedded
添加所有字符集的效果: checking "character sets"... default: latin1, collation: latin1_swedish_ci; compiled in: latin1 latin1 utf8 binary armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257 cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8 greek hebrew hp8 keybcs2 koi8r koi8u latin1 latin2 latin5 latin7 macce macroman sjis swe7 tis620 ucs2 ujis utf8
但是在 configure 最后出现报错信息: checking for termcap functions library... configure: error: No curses/termcap library found 然后下载 termcap 源码包。configure;make;make install 即可; 此处安装的是 termcap-1.3.1 重新 configure mysql 然后出现了 Thank you for choosing MySQ
L!,然后就可以 make; make install 了; Postinstallation setup(安装后设置) # cp source_file/support-files/my-mediumf /etc/myf 修改配置文件 myf # The MySQL server [mysqld] port = 3306 socket = /usr/local/mysql/sock/mysql.sock 在这儿加入一行,修改一行 datadir = /usr/local/mysql/data skip-external-locking # 这行原来是 skip-locking,出现 warning: [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead # cd /usr/local/mysql # mkdir data # chown -R mysql . # chgrp -R mysql . # bin/mysql_install_db --user=mysql \ --basedir=/usr/local/mysql \ --datadir=/usr/local/mysql/data # chown -R root . # chown -R mysql data # cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld # chkconfig --add mysqld
# chkconfig mysqld on # bin/mysqld_safe --user=mysql &; 然后登陆 mysql 测试 #/usr/local/mysql/bin/mysql 出现 mysql> 4,编译安装 php 然后编译安装 php 先安装 libxml2 下载地址:ftp://xmlsoft.org/libxml2/ 这里安装 libxml2-2.7.7.tar.gz configure;make;make install 即可; 然后安装 libpng 软件包 configure;make;make install 即可; 然后安装 libmcrypt 下载地址 ftp://mcrypt.hellug.gr/pub/crypto/mcry
上一篇:
用tar方式快速起个WEB环境的错误解决方法_必须编绎PHP_php代码
下一篇:
重庆交通大学机电与汽车工程学院毕业设计(论文)工作规范修订20140430