且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Linux 下rpm包搭建LAMP环境

更新时间:2022-10-01 13:59:06

 
LAMP是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

 

Linux 下rpm包搭建LAMP环境

 

 

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: /*这里需要旧的口令,没有,直接回车*/

 

Linux 下rpm包搭建LAMP环境

 

 

在电脑***问我们上面安装成功的目标

我们看到discuz要求我们安装

 

Linux 下rpm包搭建LAMP环境

 

 

 

Linux 下rpm包搭建LAMP环境

 

 

需要更改的因为安装的源码不同,要求不同,这里以本次实验为主,需要修改 config、data、uc_client、uc_server目录下的一些文件,我直接全部给与写的权限,这样是不安全的,因为是实验,所以大家在自己安装的时候不要这么做,不然站点就很不安全

 

Linux 下rpm包搭建LAMP环境

 

 

再次刷新安装的界面就看到安装正常了

 

Linux 下rpm包搭建LAMP环境

 

 

 

Linux 下rpm包搭建LAMP环境

 

然后安装完成,我们就可以访问http://192.168.1.145/upload  会自动跳转到首页

 

Linux 下rpm包搭建LAMP环境

 

 

 

查看数据库,我们也看到discuz自动创建的数据库成功写入到mysql

 

Linux 下rpm包搭建LAMP环境

 

 

 

实验结束 ! ! !

 





     本文转自Tar0 51CTO博客,原文链接:http://blog.51cto.com/tar0cissp/1282614,如需转载请自行联系原作者