LAMP详细安装过程
安装OpenSSL 的步骤如下:
(1)获取源代码:http://www.openssl.org/source/
openssl-
(2)解压软件tar -zxvf openssl-
(3)进入源代码目录:cd openssl-
(5)编译:makemake test #测试
(6)安装make install执行后将把相关的文件拷贝到/usr/local/openssl 的对应目录下。
在安装完OpenSSL 后,接下来就可以安装Apache 了,安装Apache 的步骤如下:
(1)获取源代码创建存放软件的目录:mkdir /root/software 到http://www.apache.org/下载最新稳定版的源代码。
httpd-
(2)解压软件包tar –jxvf httpd-
(4)编译并安装make && make instal
l从源代码安装PHPPHP 是一种嵌入在 HTML 并由服务器解释的脚本语言。它可以用于管理动态内容、支持数据库、处理会话跟踪,甚至构建整个电子商务站点。它支持许多流行的数据库,包括 MySQL、PostgreSQL、Oracle、Sybase、Informix 和 Microsoft SQLServer。要使PHP 支持相关的功能那么在安装前需要安装相应的软件,例如要使PHP支持MySQL 数据库,在编译PHP 之前,必须首先安装MySQL 数据库.
第一步:下载mysql-5.0.67.tar.gz
第二步:安装mysql-5.0.67
<1>解压mysql-5.0.67.tar.gz
# tar xzvf mysql-5.0.67.tar.gz
<2>创建安装目录
# mkdir /usr/local/mysql
<3>安装配置
# cd mysql-5.0.67 ← 修改为可执行
# ./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-comment=Source --with-server-suffix=-Community --with-mysqld-user=mysql --without-debug --with-big-tables --with-charset=utf8 --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-innodb --without-ndb-debug
注意:配置成功后会提示
MySQL has a Web site at
http://www.mysql.com/
which carries details on the
latest release, upcoming features, and other information to make your
work or play with MySQL more productive. There you can also find
information about mailing lists for MySQL discussion.
Remember to check the platform specific part of the reference manual for
hints about installing MySQL on your platform. Also have a look at the
files in the Docs directory.
Thank you for choosing MySQL!
第三步:编译·安装
<1># make ← 由于安装配置时做了很多优化,因而过程比较长,请耐心等待
<2># make install
第四步:安装后的配置
# useradd mysql ← 添加 mysql 用户
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql
# chown -R root:mysql . ← 设置权限,注意后面有一个 "."
# chown -R mysql /var/lib/mysql ← 设置 mysql 目录权限
# chgrp -R mysql . ← 注意后面有一个 "."
# cp share/mysql/my-huge.cnf /etc/my.cnf
# cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld ← 开机自动启动 mysql。
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# /etc/rc.d/init.d/mysqld start ← 启动 MySQL
# bin/mysqladmin -u root password 123456
# service mysqld stop ← 关闭 MySQL
第六步:运行方法
# cd /usr/local/mysql/bin
# ./mysql -uroot -p123456
在安装完Apache 和MySQL 后,可以开始安装PHP 了。安装PHP 的步骤如下:
(1)获取源代码创建存放软件的目录:http://www.php.net/下载最新稳定版的源代码
php-
(2)解压tar –jxvf php-
其中--with-apxs2=/usr/local/apache2/bin/apxs 选项的作用是:在安装时会修改APACHE 的配置文件,加入PHP 模块,同时将模块复制到apache 的模块目录下。
(4)编译并安装makemake install
(5)拷贝php 的配置文件cp php.ini-dist /usr/local/php/php/php.ini在编译php 时使用--with-config-file-path=[dir]来明确指明配置文件的存储位置,那么就拷贝到指定位置,否则就拷贝到:安装目录/usr/local/php/ 测试安装是否成功要进行测试,vi /usr/local/apache2/conf/httpd.conf:
(1)修改DocumentRoot,的值,指定web 页面的存储位置DocumentRoot "/ web"
(2)确保文件中已经存在并且启用下面的行LoadModule php5_module modules/libphp5.so
(3)在文件中添加下面的行:AddType application/x-httpd-php .php目的是使以php 为扩展名的文件会使用PHP 程序来解析 。
(4)创建一个测试文件/web/vfast.php,其内容如下:<?phpphpinfo();?>
(5)启动apache 服务:/usr/local/apache2/bin/apachectl start
(6)在浏览器中访问刚才的页面,例如:http://localhost/test.php如果成功返回php 的相关信息,说明安装成功。