天天看点

Linux 下rpm包搭建LAMP环境

LAMP是Linux-Apache-MySQL-PHP的意思。

实验环境:

实验所使用的包都是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

<a href="http://blog.51cto.com/attachment/201308/100657994.png" target="_blank"></a>

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

<a href="http://blog.51cto.com/attachment/201308/100657494.png" target="_blank"></a>

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

我们看到discuz要求我们安装

<a href="http://blog.51cto.com/attachment/201308/100700672.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/100701209.png" target="_blank"></a>

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

<a href="http://blog.51cto.com/attachment/201308/100701735.png" target="_blank"></a>

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

<a href="http://blog.51cto.com/attachment/201308/100702585.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/100703615.png" target="_blank"></a>

<a href="http://blog.51cto.com/attachment/201308/100704603.png" target="_blank"></a>

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

<a href="http://blog.51cto.com/attachment/201308/100704216.png" target="_blank"></a>

实验结束 ! ! !

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