LAMP架构安装Discuz论坛

1.系统初始化配置

1.1 同步系统时间和网络时间

[root@localhost ~]# ntpdate time.nuri.net
2. 安装MySQL数据库

2.1 到MySQL官方网站下载MySQL

[root@localhost ~]# wget http://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.32-linux-glibc2.5-x86_64.tar.gz

2.2 解压文件并且复制到安装目录/usr/local/mysql下

[root@localhost ~]# tar zxf mysql-5.6.32-linux-glibc2.5-x86_64.tar.gz 
[root@localhost ~]# mkdir /usr/local/mysql
[root@localhost ~]# mv mysql-5.6.32-linux-glibc2.5-x86_64/* /usr/local/mysql
[root@localhost ~]# cd /usr/local/mysql/
[root@localhost mysql]# ll
total 68
drwxr-xr-x  2 root root   4096 Nov 22 07:07 bin
-rw-r--r--  1 7161 wheel 17987 Jul 11 17:19 COPYING
drwxr-xr-x  3 root root   4096 Nov 22 07:06 data
drwxr-xr-x  2 root root   4096 Nov 22 07:07 docs
drwxr-xr-x  3 root root   4096 Nov 22 07:07 include
drwxr-xr-x  3 root root   4096 Nov 22 07:06 lib
drwxr-xr-x  4 root root   4096 Nov 22 07:07 man
drwxr-xr-x 10 root root   4096 Nov 22 07:07 mysql-test
-rw-r--r--  1 7161 wheel  2496 Jul 11 17:19 README
drwxr-xr-x  2 root root   4096 Nov 22 07:06 scripts
drwxr-xr-x 28 root root   4096 Nov 22 07:06 share
drwxr-xr-x  4 root root   4096 Nov 22 07:07 sql-bench
drwxr-xr-x  2 root root   4096 Nov 22 07:06 support-files

2.3 修改MySQL数据库配置文件

[root@localhost mysql]# vim support-files/my-default.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql  #安装目录
datadir = /usr/local/mysql/data   #数据库存放目录
port = 3306
server_id = 130
socket = /tmp/mysql.sock  #socket通信文件

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[root@localhost support-files]# cp my-default.cnf /etc/my.cnf

2.4 初始化安装MySQL数据库

[root@localhost mysql]# useradd mysql -s /sbin/nologin -M
[root@localhost mysql]# ./scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql

2.5 修改数据库目录权限为mysql用户

[root@localhost mysql]# chown -R mysql:mysql data/

2.6 启动MySQL数据库

[root@localhost mysql]# /usr/local/mysql/bin/mysqld_safe &
[1] 1514
[root@localhost mysql]# 161122 07:17:50 mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'.
161122 07:17:50 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

2.7 检查是否完全启动MySQL

[root@localhost ~]# ps -ef | grep mysql
root       1514      1  0 07:17 ?        00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe
mysql      1730   1514  2 07:17 ?        00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/localhost.localdomain.err --pid-file=/usr/local/mysql/data/localhost.localdomain.pid --socket=/tmp/mysql.sock --port=3306
root       1770   1754  0 07:18 pts/1    00:00:00 grep mysql
[root@localhost ~]# netstat -lntup | grep mysql
tcp        0      0 :::3306                     :::*                        LISTEN      1730/mysqld    

2.8 初始化登陆与设置管理员用户和密码

[root@localhost mysql]# cp bin/* /usr/bin/
[root@localhost mysql]# mysqladmin -uroot password
New password: 
Confirm new password: 
[root@localhost mysql]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.32 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.05 sec)
3. 安装Apache服务

3.1 在Apache官网下载httpd文件

[root@localhost mysql]# wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.2.31.tar.gz

3.2 解压并且编译安装

[root@localhost ~]# tar jxvf httpd-2.2.31.tar.bz2
[root@localhost ~]# cd httpd-2.2.31
[root@localhost httpd-2.2.31]# ./configure --prefix=/usr/local/httpd --enable-rewrite--with-included-apr
[root@localhost httpd-2.2.31]# make && make install
[root@localhost httpd-2.2.31]# cd /usr/local/httpd/

3.3 启动httpd服务

[root@localhost httpd]# /usr/local/httpd/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
[root@localhost httpd]# ps -ef | grep httpd
root      49902      1  0 07:30 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon    49903  49902  0 07:30 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon    49904  49902  0 07:30 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon    49905  49902  0 07:30 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon    49906  49902  0 07:30 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon    49907  49902  0 07:30 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
root      49909   1754  0 07:31 pts/1    00:00:00 grep httpd
[root@localhost httpd]# netstat -lntup | grep 80
tcp        0      0 :::80                       :::*                        LISTEN      49902/httpd   

3.4 浏览器测试

httpd service
4. 安装php服务

4.1 下载PHP安装程序

[root@localhost httpd]# wget http://cn2.php.net/distributions/php-5.6.28.tar.gz

4.2 解压并且编译安装

[root@localhost ~]# tar zxvf php-5.6.28.tar.gz
[root@localhost php-5.6.28]# yum install libxml* -y
[root@localhost php-5.6.28]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql/
[root@localhost php-5.6.28]# make && make install

4.3 修改httpd.conf文件以支持解析php文件,增加下面几行

[root@localhost httpd]# vim conf/httpd.conf 
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>
AddType application/x-httpd-php .php

4.4 复制php.ini配置文件

[root@localhost php-5.6.28]# cp php.ini-production /usr/local/php/etc/php.ini

4.5 测试

[root@localhost httpd]# vim htdocs/index.html 
<?php
phpinfo();
?>
[root@localhost htdocs]# cp index.html index.php
[root@localhost htdocs]# rm -rf index.html
[root@localhost httpd]# /usr/local/httpd/bin/apachectl graceful
phpinfo
5. 安装Discuz

5.1 下载Discuz安装包

wget http://101.44.1.3/files/112000000589504D/123.138.60.34/files/A120000000C21706/download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip

5.2 解压上传文件到htdoc目录下

[root@localhost upload]# cp -R * /usr/local/httpd/htdocs/discuz/

5.3 网页访问:http://192.168.42.130/discuz/install/

安装向导
目录权限
[root@localhost discuz]# ps -ef | grep httpd
root      49902      1  0 07:30 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon   119266  49902  0 07:55 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon   119267  49902  0 07:55 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon   119268  49902  0 07:55 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon   119269  49902  0 07:55 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon   119270  49902  0 07:55 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon   119271  49902  0 07:55 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon   119312  49902  0 08:01 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
daemon   119313  49902  0 08:01 ?        00:00:00 /usr/local/httpd/bin/httpd -k start
[root@localhost htdocs]# chown -R daemon:daemon discuz/
正确权限配置
安装数据库
初始化数据库
进入论坛首页
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 214,922评论 6 497
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,591评论 3 389
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 160,546评论 0 350
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,467评论 1 288
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,553评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,580评论 1 293
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,588评论 3 414
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,334评论 0 270
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,780评论 1 307
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,092评论 2 330
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,270评论 1 344
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,925评论 5 338
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,573评论 3 322
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,194评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,437评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,154评论 2 366
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,127评论 2 352

推荐阅读更多精彩内容