CentOS 6.9 yum方式搭建LNMP环境,并部署Discuz论坛

一、演示环境:


IP


安装的程序包


版本


192.168.1.144


nginx(epel源)


1.10.2


php


5.3.3


php-fpm(FastCGI进程管理器)


php-mysql(php连接mysql时需要用到的驱动)


192.168.1.145


MySQL-server-5.6.39-1.el6.x86_64.rpm

MySQL-client-5.6.39-1.el6.x86_64.rpm

MySQL-devel-5.6.39-1.el6.x86_64.rpm

MySQL-shared-5.6.39-1.el6.x86_64.rpm

MySQL-shared-compat-5.6.39-1.el6.x86_64.rpm


5.6.39

备注:CentOS 6.9中yum方式安装的mysql版本默认为5.1.73,此处使用版本为5.6.39的rpm包安装mysql

二、搭建LNMP

1、安装前准备:

(1)校对服务器时间

(2)配置epel源

2、安装nginx:# yum -y install nginx  # service nginx start  # ss -tunlp | grep :80

配置文件:

?  主配置文件:/etc/nginx/nginx.conf

?  辅助配置文件:/etc/nginx/*、/etc/nginx/conf.d

3、  安装php:# yum -y install php,配置文件:/etc/php.ini

4、  安装配置php-fpm:

# yum -y install php-fpm

# vim /etc/php-fpm.d/www.conf,修改以下参数的值:

listen = 192.168.1.144:9000           //php-fpm监听的地址端口

listen.allowed_clients = 192.168.1.144  //允许连接的FastCGI客户端地址

user = nginx

group = nginx

# service php-fpm start

# ss -tunlp | grep :9000

配置文件:

?  主配置文件:/etc/php-fpm.conf

?  辅助配置文件:/etc/php-fpm.d/www.conf

5、  安装配置mysql:

# rpm -qa | grep -i mysql             //检查旧版本mysql相关组件是否安装

# yum -y remove mysql-libs*

//切换至存放MySQL-client-5.6.39-1.el6.x86_64.rpm、MySQL-server-5.6.39-1.el6.x86_64.rpm、MySQL-shared-compat-5.6.39-1.el6.x86_64.rpm、MySQL-devel-5.6.39-1.el6.x86_64.rpm、MySQL-shared-5.6.39-1.el6.x86_64.rpm的目录

# yum -y install *.rpm

# find / -name my*.cnf

# cp /usr/share/mysql/my-default.cnf /etc/my.cnf        //mysql配置文件:/etc/my.cnf

# find / -name mysql.server

# cp /usr/share/mysql/mysql.server /etc/init.d/mysqld

# service mysqld start

# ss -tunlp | grep :3306

# cat /root/.mysql_secret                                          //查看mysql数据库root用户的随机密码

//修改mysql数据库root用户密码为123456、删除匿名用户、删除测试数据库、重载授权表

# mysql_secure_installation

# mysql -uroot -p

mysql> grant all on *.* to 'root'@'192.168.%.%' identified by '123456';    //授权root用户远程登录

mysql> flush privileges;

6、安装php-mysql:# yum -y install php-mysql

7、 配置nginx支持php:

# cd /etc/nginx/conf.d

# cp default.conf default.conf.bak

# vim default.conf

# service nginx reload

# service php-fpm restart

三、测试LNMP

# cd /usr/share/nginx/html

# vim index.php

浏览器中输入http://192.168.1.144/index.php:

停止192.168.1.145上的mysql:# service mysqld stop

mysql与php通信正常

访问http://192.168.1.144

四、安装配置Discuz

Discuz是腾讯旗下Comsenz公司推出的以社区为基础的专业建站平台,帮助网站实现一站式服务,让论坛(BBS)、个人空间(SNS)、门户(Portal)、群组(Group)、应用开放平台(Open Platform)充分融合于一体,帮助网站实现一站式服务。下载地址http://www.discuz.net/forum-10-1.html,此处以Discuz_X3.4_SC_UTF8.zip为例。

# yum -y install unzip

# unzip -q Discuz_X3.4_SC_UTF8.zip

# cp -r upload/ /usr/share/nginx/html

# cd /usr/share/nginx/html/upload

# chmod -R 777 config/ data/ uc_client/ uc_server/

# vim config/config_global_default.php

# vim config/config_ucenter_default.php

# mysql -uroot -p

      mysql> create database dcdb;

      mysql> grant all on dcdb.* to 'dcuser'@'%' identified by "123456";

      mysql> flush privileges;

# mysql -udcuser -p

      mysql> show databases;

修改nginx配置文件,在index参数后新增index.php:

# vim /etc/nginx/conf.d/default.conf

location / {

index index.php index.html index.htm;

}

# service nginx reload

浏览器中输入http://192.168.1.144/upload/install/

点击“我同意”:

检查安装环境,全部通过后,点击“下一步”:

选择“全新安装Discuz! X(含UCenter Server)”,点击“下一步”:

填写数据库信息和管理员信息,点击“下一步”:

点击“您的论坛已完成安装,点此访问”:

右上角可以使用admin账号登录:

点击右上角“管理中心”,根据提示删除安装页面:

# rm -rf /usr/share/nginx/html/upload/install/index.php

# cd /usr/share/nginx/html

# mv upload/ discuz

论坛前台登录地址http://192.168.1.144/discuz/

论坛后台管理地址http://192.168.1.144/discuz/admin.php

原文地址:http://blog.51cto.com/qiuyue/2104317

时间: 2024-08-28 10:56:04

CentOS 6.9 yum方式搭建LNMP环境,并部署Discuz论坛的相关文章

centos6.7、centos6.5下yum方式搭建lnmp环境,php5.4/mysql5.5

由于电脑重装系统,之前虚拟机中的所有系统都打不开了,不得已又得从0开始安装.我下载的是centos6.5的镜像,在虚拟机中安装完以后,执行了一下yum update,系统升成了6.7的,但是对于lnmp环境的安装时没有影响的,6.5和6.7的安装方法是一样的. 一.安装php5.4 1.配置yum源 6.7和6.5中默认是没有php5.4版本的,所以我们需要先配置一下yum源. 执行命令: rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rp

Centos 7搭建LNMP架构及部署Discuz论坛

一.LNMP架构及应用部署 众所周知,LAMP平台时目前应用最为广泛的网站服务器架构,其中的"A"对应着web服务软件的Apache HTTP Server ,随着Nginx在工作环境中的使用越来越多,LNMP(或LEMP)架构也受到越来越多的Linux运维工程师的青睐. 就像构建LAMP平台一样,构建LNMP平台也需要Linux服务器.MySQL数据库.PHP解析环境,区别主义在于Nginx与PHP的协作配置上. 准备工作 Centos 7操作系统一台:Windows 客户端一台:案

CentOS 7 下 yum 方式安装 Docker 环境

教你如何在 CentOS 7 下 yum 方式安装 Docker 环境. 记录在CentOS 7下使用yum方式安装Docker环境的步骤. 1.移除旧版本: yum remove docker                   docker-client                   docker-client-latest                   docker-common                   docker-latest                  

搭建lnmp环境,部署php动态网站

搭建LNMP 前言:"N"代表Nginx与apache的作用一样,都是为了搭建网站服务器,由俄罗斯人lgor sysoev开发,其特点是占有内存少,并发能力强,单台物理服务器可支持3万-5万个并发请求,中国使用nginx网站用户有:百度.京东.新浪.网易.腾讯.淘宝等. 通过下面的实验搭建LNMP环境,部署天空影城的php动态网站 本实验在虚拟机中运行,使用Redhat6.5系统部署! 一.安装及运行 1.搭建yum仓库,安装支持软件 nginx的配置及运行需要pcre,zlib等软件

ubuntu通过apt-get方式搭建lnmp环境以及php扩展安装

一直是在用的lnmp的集成安装包搭建lnmp环境,因为工作需要需要安装ldap扩展,在网上怎么都找不到源码安装包,只能卸载掉原来的lnmp环境,用ubuntu的php5-ldap扩展, 在安装中遇到一些问题,网上的文章坑爹的比较多,写篇文章记录下来. 1.安装mysql sudo apt-get install mysql-server mysql-clien 安装过程中要输入root用户的密码. 我在安装中出错,是原来的mysql-cilent mysql-workbench 未完全卸载,将m

Centos 6.2_X86_64 yum方式安装LNMP

yum方式安装LNMP详情请见附件

RHEL7搭建LAMP环境并安装Discuz论坛

一.安装httpd [[email protected] ~]# yum install httpd Loaded plugins: product-id, search-disabled-repos Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.4.6-40.el7 will be installed --> Processing Dependency: httpd-

CentOS 7.4 yum方式安装LAMP环境,并部署WordPress,使用XCache优化性能

一.安装LAMP环境: # yum -y install httpd mariadb-server php-mysql php 程序包版本: httpd:2.4.6 mariadb-server:5.5.56 php-mysql(PHP连接MySQL时需要用到的驱动):5.4.16 php:5.4.16 备注: CentOS 7.4已经不再提供mysql-server的程序包 httpd配置文件: 1.主配置文件:/etc/httpd/conf/httpd.conf 2.辅助配置文件:/etc/

centos6.5下使用yum完美搭建LNMP环境(php5.6)

准备工作 配置防火墙,开启80端口.3306端口删除原有的 iptables , 添加合适的配置 rm -rf /etc/sysconfig/iptables vi /etc/sysconfig/iptables 添加如下内容 : ################################ 添加好之后防火墙规则如下所示################################ # Firewall configuration written by system-config-fire