LAMP环境及Discuz论坛系统如何安装

50次阅读
没有评论

共计 3975 个字符,预计需要花费 10 分钟才能阅读完成。

丸趣 TV 小编给大家分享一下 LAMP 环境及 Discuz 论坛系统如何安装,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

第一步:下载 Apache、MySQL、PHP

wget http://mirrors.sohu.com/apache/httpd-2.2.31.tar.gz

wget http://mirrors.sohu.com/php/php-5.3.27.tar.gz

wget http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gz

第二步:先安装 MySQL

解压缩 mysql 安装包

tar -zxvf mysql-5.1.73-linux-x86_64-glibc23.tar.gz

移动解压出来的数据包到 /usr/local/mysql

mv mysql-5.1.73-linux-x86_64-glibc23 /usr/local/mysql

创建 mysql 账号

useradd -s /sbin/nologin mysql

初始化数据库

cd /usr/local/mysql/;

mkdir -p /data/mysql ; chown -R mysql:mysql /data/mysql

./scripts/mysql_install_db –user=mysql –datadir=/data/mysql

拷贝配置文件

cp support-files/my-large.cnf /etc/my.cnf

拷贝启动脚本并且修改内容

cp support-files/mysql.server /etc/init.d/mysqld

修改内容 datadir=/usr/mysql     baseddir=/usr/local/mysql

修改启动脚本权限

chmod 755 /etc/init.d/mysqld

vim /etc/init.d/mysqld

把启动脚本加入系统服务项,并设定开机启动,启动 mysql

chkconfig –add mysqld

chkconfig mysqld on

service mysqld start

第三步:安装 Apache

解压缩安装包

tar -zxvf httpd-2.2.31.tar.gz

  安装所需插件

yum install -y zlib-devel pcre pcre-devel apr apr-devel

进入安装包并且编译环境

cd httpd-2.2.31

./configure –prefix=/usr/local/apache2 –with-included-apr –enable-so –enable-deflate=shared –enable-expires=shared –enable-rewrite=shared –with-pcre

编译 make

安装 make install

第四步:安装 PHP

解压缩安装包:

tar -zxvf php-5.3.27.tar.gz

安装扩展源

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

安装 php 编译环境

yum install -y libxml2-devel openssl openssl-devel bzip2 bzip2-devel libpng libpng-devel freetype freetype-devel libmcrypt-devel libjpeg-devel

切换到安装包目录并且编译环境

cd php-5.3.27

./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache2/bin/apxs –with-config-file-path=/usr/local/php/etc  –with-mysql=/usr/local/mysql –with-libxml-dir –with-gd –with-jpeg-dir –with-png-dir –with-freetype-dir –with-iconv-dir –with-zlib-dir –with-bz2 –with-openssl –with-mcrypt –enable-soap –enable-gd-native-ttf –enable-mbstring –enable-sockets –enable-exif –disable-ipv6

编译 make

  安装 make install

拷贝配置文件

cp php.ini-production /usr/local/php/etc/php.ini

第五步:Apache 结合 PHP

vim /usr/local/apache2/conf/httpd.conf

找到:

AddType application/x-gzip .gz .tgz

在该行下面添加:

AddType application/x-httpd-php .php

  找到:

IfModule dir_module

DirectoryIndex index.html

/IfModule

  将该行改为:

IfModule dir_module

DirectoryIndex index.html index.htm index.php

/IfModule

  找到:

#ServerName www.example.com:80

  修改为:

ServerName localhost:80

第六步:测试 LAMP 是否成功

检查 Apache 配置文件是否有错误

/usr/local/apache2/bin/apachectl -t

启动 Apache

/usr/local/apache2/bin/apachectl start

查看 Apache 端口

netstat -lnp |grep httpd

测试首页

curl localhost

新建 php 配置文件

vim /usr/local/apache2/htdocs/info.php

输入:

?php

  phpinfo();

  ?

编辑防火墙文件开放 80 端口(或者关闭防火墙)

vim /etc/sysconfig/iptables

service iptables restart

重启 Apache

/usr/local/apache2/bin/apachectl restart

然后浏览器访问查看是否正常~!

第七步:安装 Discuz

创建目录

mkdir /data/www

进入目录并且下载 discuz 安装包

cd /data/www/

wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip

解压缩安装包:

unzip Discuz_X3.2_SC_GBK.zip

移动目录文件到 /data/www 下

mv upload/* ./

删除不需要的文件

rm -rf Discuz_X3.2_SC_GBK.zip readme upload utility

配置 Apache 配置文件启动虚拟主机

vim /usr/local/apache2/conf/httpd.conf

找到

# Virtual hosts

# Include conf/extra/httpd-vhosts.conf

修改为

Virtual hosts

Include conf/extra/httpd-vhosts.conf

找到

Directory /

Options FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

/Directory

修改为

Directory /

Options FollowSymLinks

AllowOverride None

Order deny,allow

Allow from all

/Directory

  修改虚拟主机配置文件

vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

只留一个虚拟机配置,并且修改为:

VirtualHost *:80

   DocumentRoot /data/www

   ServerName www.yang.com

   ServerAlias www.li.com

#    ErrorLog logs/dummy-host.example.com-error_log

#    CustomLog logs/dummy-host.example.com-access_log common

/VirtualHost

修改 discuz 配置文件的权限:

chown -R daemon config data uc_client/data uc_server/data

卸载自带的 mysql 数据库

查询安装目录 which mysql

查看安装包名称 rpm -qf /usr/bin/mysql

卸载自带数据库 yum remove mysql

创建一个数据库的变量文件

vim /etc/profile.d/path.sh

添加内容:

     #!/bin/bash

     export PATH=$PATH:/usr/local/mysql/bin

应用 path.sh 文件 source /etc/profile.d/path.sh

然后进入数据库

mysql

mysql create database discuz; 创建数据库

  mysql grant all on discuz.* to yanghao @ localhost identified by www123com 创建数据库账号及密码

重启 Apache 即可安装 discuz

/usr/local/apache2/bin/apachectl restart

看完了这篇文章,相信你对“LAMP 环境及 Discuz 论坛系统如何安装”有了一定的了解,如果想了解更多相关知识,欢迎关注丸趣 TV 行业资讯频道,感谢各位的阅读!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-19发表,共计3975字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)