LAMP 之四 Discuz 論壇搭建(執行個體)

來源:互聯網
上載者:User

標籤:discuz 安裝

建立一個存放Dizcuz 的根目錄

[[email protected] ~]# mkdir /data/www

[[email protected] ~]# cd /data/www/

[[email protected] www]# wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip

[[email protected] www]# unzip Discuz_X3.2_SC_GBK.zip

解壓完之後產生三個目錄

[[email protected] www]# ls

Discuz_X3.2_SC_GBK.zip  readme  upload  utility

但是程式目錄是在 upload 下,所以把upload 檔案全部移出來

[[email protected] www]# mv upload/* ./

[[email protected] www]# ls

admin.php  connect.php             favicon.ico  install     readme      template     utility

api        cp.php                  forum.php    member.php  robots.txt  uc_client

api.php    crossdomain.xml         group.php    misc.php    search.php  uc_server

archiver   data                    home.php     plugin.php  source      upload

config     Discuz_X3.2_SC_GBK.zip  index.php    portal.php  static      userapp.php

刪除目錄下所有的檔案

[[email protected] www]# rm -rf readme/ utility/ upload/ Discuz_X3.2_SC_GBK.zip


虛擬機器的設定檔在

[[email protected] www]# vim /usr/local/apache2/conf/httpd.conf


開啟虛擬機器主機的開關

#Include conf/extra/httpd-vhosts.conf(去掉前面的#號)

開啟虛可擬主機以後,進入到虛擬機器主機的設定檔

[[email protected] www]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

看到以下設定檔。刪除掉最下的一個範例。

# Use name-based virtual hosting.

#

NameVirtualHost *:80


#

# VirtualHost example:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for all requests that do not

# match a ServerName or ServerAlias in any <VirtualHost> block.

#

<VirtualHost *:80>

    ServerAdmin [email protected]  #管理員的郵箱

    DocumentRoot "/usr/local/apache2/docs/dummy-host.example.com #建立的/data/www目錄"

    ServerName dummy-host.example.com  #可以自已寫

    ServerAlias www.dummy-host.example.com  # 網站的別名

    ErrorLog "logs/dummy-host.example.com-error_log"# 錯誤記錄檔

    CustomLog "logs/dummy-host.example.com-access_log" common # 訪問日誌

</VirtualHost>


<VirtualHost *:80>

    ServerAdmin [email protected]

    DocumentRoot "/usr/local/apache2/docs/dummy-host2.example.com"

    ServerName dummy-host2.example.com

    ErrorLog "logs/dummy-host2.example.com-error_log"

    CustomLog "logs/dummy-host2.example.com-access_log" common

</VirtualHost>


配置虛擬機器主機。刪除最下面一個範例。配置如下

# Use name-based virtual hosting.

#

NameVirtualHost *:80


#

# VirtualHost example:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for all requests that do not

# match a ServerName or ServerAlias in any <VirtualHost> block.

#

<VirtualHost *:80>

    DocumentRoot "/data/www"

    ServerName www.test.com

    ServerAlias www.aaa.com

   # ErrorLog "logs/dummy-host.example.com-error_log"  #注釋掉

   # CustomLog "logs/dummy-host.example.com-access_log" common #注釋掉

</VirtualHost>


配置完成後,檢測配置有沒有錯誤

[[email protected] www]# /usr/local/apache2/bin/apachectl -t

httpd: apr_sockaddr_info_get() failed for OBird

httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName

Syntax OK

此處報錯了,是因為沒有定義 ServerName

[[email protected] www]# vim /usr/local/apache2/conf/httpd.conf  

編輯設定檔定義ServerName

#ServerName www.example.com:80   去掉前面的 # 。

[[email protected] www]# /usr/local/apache2/bin/apachectl -t

Syntax OK

再檢測就不會報錯了。


此時就可訪問Discuz 了,在訪問之前需要先配置一下 hosts

在本地主機 C:\Windows\System32\drivers\etc 目錄下寫入

192.168.31.xxx  www.test.com

此時通過網頁來訪問,是無法訪問該網頁的,因為80 連接埠還沒有啟動。啟動以後還是不能訪問

發現是設定檔的問題

[[email protected] www]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#192.168.1.1 www.qq.com

192.168.31.170 www.test.com  #在/etc/hosts 檔案中寫入

[[email protected] www]# vim /usr/local/apache2/conf/httpd.conf 

<Directory />

    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    Allow from all   # 加入這一行,允許所有訪問

   # Deny from all   #注釋或是刪除此行

此處遇到一些問題請在另一篇部落格裡尋找

###########################################################################################

在IE 內輸入 IP 位址訪問,會出現一個Discuz的安裝介面。

650) this.width=650;" src="http://s1.51cto.com/wyfs02/M00/88/12/wKiom1fo2Gbi3JG7AAIXpC6CJ_Q431.jpg-wh_500x0-wm_3-wmp_4-s_246299501.jpg" style="float:none;" title="dis1.jpg" alt="wKiom1fo2Gbi3JG7AAIXpC6CJ_Q431.jpg-wh_50" />

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M00/88/12/wKiom1fo2Gex9HggAADlE119c8M453.jpg-wh_500x0-wm_3-wmp_4-s_105606881.jpg" style="float:none;" title="dis2.jpg" alt="wKiom1fo2Gex9HggAADlE119c8M453.jpg-wh_50" />

650) this.width=650;" src="http://s1.51cto.com/wyfs02/M02/88/0F/wKioL1fo2GvjDeUyAAD7M-BYL8E984.jpg-wh_500x0-wm_3-wmp_4-s_2599038724.jpg" style="float:none;" title="dis3.jpg" alt="wKioL1fo2GvjDeUyAAD7M-BYL8E984.jpg-wh_50" />

解決掉那些目錄不可寫的報錯

首先我們要查看httpd 的進程是以哪個使用者身份來啟動並執行

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M01/88/0F/wKioL1fo2aKRfXlCAAHWzK3vQRE503.jpg-wh_500x0-wm_3-wmp_4-s_309015698.jpg" title="daemon.jpg" alt="wKioL1fo2aKRfXlCAAHWzK3vQRE503.jpg-wh_50" />

httpd 當前是以daemon 使用者的身份在運行

[email protected] www]# ls -l

total 116

-rw-r--r--  1 root root 2739 May 31 11:08 admin.php

drwxr-xr-x 11 root root 4096 May 31 11:08 api

-rw-r--r--  1 root root  727 May 31 11:08 api.php

drwxr-xr-x  2 root root 4096 May 31 11:08 archiver

drwxr-xr-x  2 root root 4096 May 31 11:08 config

-rw-r--r--  1 root root  922 May 31 11:08 connect.php

-rw-r--r--  1 root root  253 May 31 11:08 cp.php

-rw-r--r--  1 root root  106 May 31 11:08 crossdomain.xml

drwxr-xr-x 13 root root 4096 May 31 11:08 data

-rw-r--r--  1 root root 5558 May 31 11:08 favicon.ico

-rw-r--r--  1 root root 2242 May 31 11:08 forum.php

-rw-r--r--  1 root root  821 May 31 11:08 group.php

-rw-r--r--  1 root root 1290 May 31 11:08 home.php

-rw-r--r--  1 root root 5669 May 31 11:08 index.php

drwxr-xr-x  5 root root 4096 May 31 11:08 install

-rw-r--r--  1 root root 1025 May 31 11:08 member.php

-rw-r--r--  1 root root 2462 May 31 11:08 misc.php

-rw-r--r--  1 root root 1757 May 31 11:08 plugin.php

設定可寫目錄許可權,然後再重新整理安裝介面

[[email protected] www]# chown -R daemon config data uc_client/data uc_server/data


650) this.width=650;" src="http://s1.51cto.com/wyfs02/M01/88/12/wKiom1fo2s-DEy_1AADk0ltfWa8645.jpg-wh_500x0-wm_3-wmp_4-s_1750804865.jpg" title="dis4.jpg" alt="wKiom1fo2s-DEy_1AADk0ltfWa8645.jpg-wh_50" />


下一步,選擇全新安裝

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M00/88/0F/wKioL1fo21ziM8djAADIALmTmsY653.jpg-wh_500x0-wm_3-wmp_4-s_2097826504.jpg" title="dis5.jpg" alt="wKioL1fo21ziM8djAADIALmTmsY653.jpg-wh_50" />

下一步是與mysql 相關的資料

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M00/88/12/wKiom1fo2-_xFmBdAADkGtWOKzY658.jpg-wh_500x0-wm_3-wmp_4-s_2837253477.jpg" title="dis6.jpg" alt="wKiom1fo2-_xFmBdAADkGtWOKzY658.jpg-wh_50" />


接下來是設定 mysql,我們每次用自已安裝的myqls

需要輸入 /usr/local/mysql/bin/mysql,而不能直接輸入mysql ,

那麼我們就需更改 PATH

[[email protected] www]# which mysql (mysql不是/usr/local/mysql/bin/mysql,注意區分)

/usr/bin/mysql (系統內建的mysql)

用以下命令尋找到系統內建的mysql,然後卸載。因為樓主已經卸載過,所以沒有。

[[email protected] www]# rpm -qf /usr/local/mysql

file /usr/local/mysql is not owned by any package


編寫一個path.sh 的指令碼

[[email protected] www]# vim /etc/profile.d/path.sh

#!/bin/bash

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


[[email protected] www]# source /etc/profile.d/path.sh


然後就可以使用了。

首先建立一個庫

[[email protected] ~]# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 6

Server version: 5.1.73-log Source distribution


Copyright (c) 2000, 2013, 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> create database discuz;

Query OK, 1 row affected (0.00 sec)

mysql> grant all on discuz.* to ‘aming‘@‘localhost‘ identified by ‘aminglinux‘;

Query OK, 0 rows affected (0.00 sec


all  是所有的許可權。 discuz.*  表示discuz 裡所有的表。identified by ‘aminglinux‘;這是密碼。

資料庫資訊: localhost ,discuz ,aming, aminglinux ,剩下的黙認。

管理員資訊:admin / ps :123456

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/88/14/wKiom1fo7JCAKCfMAAESCj_jNMM128.jpg-wh_500x0-wm_3-wmp_4-s_2189049424.jpg" title="dis7.jpg" alt="wKiom1fo7JCAKCfMAAESCj_jNMM128.jpg-wh_50" />

650) this.width=650;" src="http://s1.51cto.com/wyfs02/M02/88/14/wKiom1fo7TiQ1gkWAAECsIdq5v0191.jpg-wh_500x0-wm_3-wmp_4-s_2597725702.jpg" title="dis8.jpg" alt="wKiom1fo7TiQ1gkWAAECsIdq5v0191.jpg-wh_50" />

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/88/14/wKiom1fo7aSAxV7HAAH_2OYXTl4915.jpg" title="dis9.jpg" alt="wKiom1fo7aSAxV7HAAH_2OYXTl4915.jpg" />


至此 Discuz 安裝完成。

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/88/10/wKioL1fo7iPyyTtvAAJ6gltUY-s949.jpg-wh_500x0-wm_3-wmp_4-s_1370591093.jpg" title="dis10.jpg" alt="wKioL1fo7iPyyTtvAAJ6gltUY-s949.jpg-wh_50" />



本文出自 “CBO#Boy_Linux之路” 部落格,請務必保留此出處http://20151213start.blog.51cto.com/9472657/1856791

LAMP 之四 Discuz 論壇搭建(執行個體)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.