Welcome 微信登录

首页 / 网页编程 / PHP / Linux 下rpm包搭建LAMP环境

Linux 下rpm包搭建LAMP环境2015-02-28LAMP是Linux-Apache-MySQL-PHP的意思。

LAMP网站架构具有Web资源丰富、低价格、等特点。是目前国际流行的Web框架。用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台。这四个软件都是遵循GPL的开放源码软件,它们安全、稳定、快速、功能强大,使用它们可以建立一个快速、稳定、免费的网站系统。

实验环境:

实验所使用的包都是RHEL自带的rpm安装包

Red Hat Enterprise Linux 5.4 32-bit

httpd-2.2.3-31.el5

php-mysql-5.1.6-23.2.el5_3

mysql-5.0.77-3.el5

mysql-server-5.0.77-3.el5

php-5.1.6-23.2.el5_3

php-gd-5.1.6-23.2.el5_3

Discuz_X2.5_SC_GBK.zip

下载一个Discuz论坛的网站模版

[root@localhost ~]# unzip Discuz_X2.5_SC_GBK.zip

把解压后的discuz包内的upload文件复制到linux默认的站点根目录下

[root@localhost ~]# mv upload/ /var/www/html/

[root@localhost ~]# cd /var/www/html/upload

#这里/var/www/html/upload站点的绝对路径,在访问的时候需要在地址后加上upload,否者访问出错

编辑apache服务的文件

vim /etc/http/conf/http.conf

php安装之后,我们安装LAMP环境所需要的安装包,这里我们使用yum安装,这样yum会自动给我们解决包的依赖关系

[root@localhost ~]# cd /mnt/cdrom/Server/

[root@localhost Server]# yum install httpd mysql-server masql php php-gd php-mysql  -y

启动apache和mysql服务,并设置为开机启动

[root@localhost Server]# service httpd restart

[root@localhost Server]# chkconfig httpd on

[root@localhost Server]# service mysqld start

[root@localhost Server]# chkconfig mysqld on

登录mysql.  看数据库是否安装成功

[root@localhost Server]# mysql -u root

Welcome to the MySQL monitor.  Commands end with ; or g.

Your MySQL connection id is 2

Server version: 5.0.77 Source distribution

Type "help;" or "h" for help. Type "c" to clear the buffer.

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| test               |

+--------------------+

3 rows in set (0.00 sec

安装的mysql默认是没有密码的,不安全,我们需要对它设置一个密码

线面的wuhen就是我设置的,很简单,大家自己做的时候一定要设置一个安全的口令。

[root@localhost Server]# mysqladmin -u root -p password "wuhen"

Enter password: /*这里需要旧的口令,没有,直接回车*/