2013-07-27 28 views

回答

3

如果你想要簡單的東西,你可以使用比目魚棧http://bitnami.com/stack/osqa

+0

謝謝。你爲這家公司工作嗎?你有任何鏈接分享這個程序在使用? – theyuv

+0

對不起,我不爲這家公司工作。但你可以問他們在網站上的鏈接,我確定 –

0

H我我已經使用指南:http://wiki.osqa.net/display/docs/Ubuntu+with+Apache+and+MySQL但修改它新的Apache 2.4.7並降級Django和降價的適當版本做到了這一點在新機器上

的Ubuntu 14.04 的Apache 2.4.7

清潔機AWS:

sudo易於得到更新

sudo易於得到安裝的Apache2中的libapache2-MOD-WSGI

命令和apt-get安裝顛覆

APACHE 2.4表現不同 - 最好insatll在/ var/WWW

須藤SVN共同http://svn.osqa.net/svnroot/osqa/trunk/ /無功/網絡/ osqa

須藤VI /var/www/osqa/osqa.wsgi

import os 
import sys 
sys.path.append('/var/www') 
sys.path.append('/var/www/osqa') 
# The first part of this module name should be identical to the directory name 
# of the OSQA source. For instance, if the full path to OSQA is 
# /home/osqa/osqa-server, then the DJANGO_SETTINGS_MODULE should have a value 
# of 'osqa-server.settings'. 
os.environ['DJANGO_SETTINGS_MODULE'] = 'osqa.settings' 
import django.core.handlers.wsgi 
application = django.core.handlers.wsgi.WSGIHandler() 

須藤RM /etc/apache2/sites-enabled/000-default.conf

須藤六/etc/apache2/sites-available/osqa.conf

# Must be readable and writable by apache 
WSGISocketPrefix ${APACHE_RUN_DIR} 

#NOTE: all urs below will need to be adjusted if 
#settings.FORUM_SCRIPT_ALIAS !='' (e.g. = 'forum/') 
#this allows "rooting" forum at [http://example.com/forum], if you like 
<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot /var/www/osqa 
    ServerName example.com 

    #run mod_wsgi process for django in daemon mode 
    #this allows avoiding confused timezone settings when 
    #another application runs in the same virtual host 
    WSGIDaemonProcess OSQA 
    WSGIProcessGroup OSQA 

    #force all content to be served as static files 
    #otherwise django will be crunching images through itself wasting time 
    Alias /m/ "/var/www/osqa/forum/skins/" 
     <Directory "/var/www/osqa/forum/skins"> 
      Require all granted 
     </Directory> 
    Alias /upfiles/ "/var/www/osqa/forum/upfiles/" 
    <Directory "/var/www/osqa/forum/upfiles"> 
     Require all granted 
    </Directory> 

    #this is your wsgi script described in the prev section 
    WSGIScriptAlias//var/www/osqa/osqa.wsgi 

    CustomLog ${APACHE_LOG_DIR}/osqa.access.log common 
    ErrorLog ${APACHE_LOG_DIR}/osqa.error.log 
</VirtualHost> 

須藤LN -s /etc/apache2/sites-available/osqa.conf /etc/apache2/sites-enabled/osqa.conf

sudo易於得到安裝mysql客戶端
須藤APT-得到安裝python-setuptools的
sudo易於得到安裝python-PIP

須藤的easy_install南Django的調試工具欄裏降價\ html5lib中的python-openid的

須藤PIP安裝Django == 1.3

須藤PIP安裝降價== 2.4.1

須藤CP /var/www/osqa/settings_local.py.dist /var/www/osqa/settings_local.py

sudo的VI的/ var/WWW/osqa/settings_local.py

做你的數據庫的東西 - 我已經有一個RDS,但你可以自己做。

DATABASES = { 
     'default': { 
      'ENGINE': 'django.db.backends.mysql', 
      'NAME': 'osqa', 
      'USER': '', 
      'PASSWORD': '', 
      'HOST': '', 
      'PORT': '3306', 
     } 
    } 

我沒有做到這一步,但你可能需要在構建新的DB sudo的蟒蛇manage.py執行syncdb --all

sudo的蟒蛇manage.py遷移論壇--fake

須藤useradd的osqa

須藤CHOWN -R osqa:WWW的數據/無功/網絡/ osqa

須藤搭配chmod -R G + W /無功/網絡/ osqa /論壇/ upfiles

須藤搭配chmod -R G + W /無功/網絡/ osqa /日誌

須藤服務的apache2重啓

+0

你如何配置「電子郵件設置」? – SparkAndShine

2

步驟1:安裝相關python模塊

sudo apt-get install python-setuptools #which contains easy_install 
sudo apt-get install python-pip 

sudo apt-get install python-django 
sudo apt-get install python-mysqldb 
sudo apt-get install libapache2-mod-wsgi #mod-wsgi, sudo a2enmod mod-wsgi 
sudo easy_install ElementTree html5lib python-openid 

sudo pip install Markdown==2.4.1 #NOTE: the higher version is incompatible with osqa 
sudo pip install south 

步驟2:爲OSQA創建數據庫

# (i).download the source code of OSQA 
git clone https://github.com/OSQA/osqa.git 

# (ii).create a database, named osqa 
mysql -u root -p #you are required to type password 
create database osqa DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; 


# (iii).create tables for OSQA 
/var/www/osqa$ python manage.py syncdb 
...... 
You just installed Django's auth system, which means you don't have any superusers defined. 
Would you like to create one now? (yes/no): no 
Installing custom SQL ... 
Installing indexes ... 
Installed 0 object(s) from 0 fixture(s) 

步驟3:配置OSQA

(i)中。創建osqa.wsgi

使用cp osqa.wsgi.dist osqa.wsgi進行復制並修改sys.path.append。的osqa.wsgi最終內容將是

import os 
import sys 
sys.path.append('/var/www') 
sys.path.append('/var/www/osqa') 
# The first part of this module name should be identical to the directory name 
# of the OSQA source. For instance, if the full path to OSQA is 
# /home/osqa/osqa-server, then the DJANGO_SETTINGS_MODULE should have a value 
# of 'osqa-server.settings'. 
os.environ['DJANGO_SETTINGS_MODULE'] = 'osqa.settings' 
import django.core.handlers.wsgi 
application = django.core.handlers.wsgi.WSGIHandler() 

(ii)中。創建settings_local.py

使用cp settings_local.py.dist settings_local.py進行復制並進行一些更改。以下代碼顯示應該更改哪些代碼。

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.mysql', 
     'NAME': 'osqa', 
     'USER': 'root', 
     'PASSWORD': '**********', 
     'HOST': '', 
     'PORT': '', 
     'CONN_MAX_AGE': 600, 
    } 
} 

APP_URL = 'http://www.example.com 

ALLOWED_HOSTS = ('example.com',) 

第4步:配置Apache

爲OSQA創建一個配置文件(比如osqa.conf)。以下是內容:

# Must be readable and writable by apache 
WSGISocketPrefix ${APACHE_RUN_DIR} 

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot /var/www/osqa 
    ServerName example.com 

    #run mod_wsgi process for django in daemon mode 
    #this allows avoiding confused timezone settings when 
    #another application runs in the same virtual host 
    WSGIDaemonProcess OSQA 
    WSGIProcessGroup OSQA 

    #force all content to be served as static files 
    #otherwise django will be crunching images through itself wasting time 
    Alias /m/ "/var/www/osqa/forum/skins/" 
    <Directory "/var/www/osqa/forum/skins"> 
     Require all granted 
    </Directory> 

    Alias /upfiles/ "/var/www/osqa/forum/upfiles/" 
    <Directory "/var/www/osqa/forum/upfiles"> 
     Require all granted 
    </Directory> 

    #this is your wsgi script described in the prev section 
    WSGIScriptAlias//var/www/osqa/osqa.wsgi 

    CustomLog ${APACHE_LOG_DIR}/osqa.access.log common 
    ErrorLog ${APACHE_LOG_DIR}/osqa.error.log 
</VirtualHost> 

使配置生效:

sudo a2ensite osqa.conf 
sudo service apache2 restart 

第5步:修改hosts

追加下面以/etc/hosts

xx.xx.xx.xx example.com 

個參考文獻:

http://sparkandshine.net/install-osqa-on-aws-ec2-ubuntu-apache-mysql/

PS:爲什麼不highligter語法的工作?