在 Debian Wheezy 上用 Discourse 搭建论坛


以新建的 VM 为例, 下面是安装直到运行  的一些必要步骤

1, 首先是系统必须的软件包, 这里我用nginx作为HTTP服务器, 其他的也可以的:

sudo apt-get install build-essential nginx imagemagick

2, Discourse 需要的数据库和缓存. Wheezy 缺省的 postgresql 是 9.1 的, 可以参考这个来装 9.3:

sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3
sudo apt-get install redis-server

3, 添加 discourse 系统/数据库用户, 建DB, Discourse 将以此用户的身份运行(git clone 部分就省略了).

sudo adduser discourse –home /var/www/discourse
sudo su – postgres -c “createuser -s discourse”
sudo su – discourse -c “createdb discourse”

4, 下面以 discourse 用户的身份执行, 安装RVM以及各种 gems

curl -sSL https://get.rvm.io | bash -s stable
rvm install ruby 2.0

5, 编辑 discourse/config/discourse_quickstart.conf, 主要是填写 developer_emails, 以及 SMTP 配置

6, 复制 discourse/config/nginx.sample.conf, 修改例如 server_name 等需要定制的参数, 并链接到 /etc/nginx/site-enabled

7, 初始化DB, 编译素材:

cd /var/www/discourse
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake assets:precompile

8, 用 bluepill 启动 discourse:

gem install bluepill
echo ‘alias bluepill=”NOEXEC_DISABLE=1 bluepill –no-privileged -c ~/.bluepill”‘ >> ~/.bash_aliases
rvm wrapper $(rvm current) bootup bluepill
rvm wrapper $(rvm current) bootup bundle
RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ROOT=/var/www/discourse RAILS_ENV=production NUM_WEBS=2 bluepill –no-privileged -c ~/.bluepill load /var/www/discourse/config/discourse.pill

然后如果有问题就看 logs 排错吧, 哈哈.

参考教程:  https://github.com/discourse/discourse/blob/master/docs/INSTALL-ubuntu.md

,

One response to “在 Debian Wheezy 上用 Discourse 搭建论坛”

  1. When your rival is your enemy, you should first of all get to understand him. As Chinese strategist Sun Tzu said, “Know yourself and know your enemy, you will win every war”