如何在 Ubuntu 上安装 Discourse?

Set*_*eth 8 software-installation

我有一台备用的 Ubuntu 机器,我想在它上面安装Discourse

我该怎么做呢?我正在运行 Ubuntu 13.04。

roa*_*dmr 7

这些说明假设您需要 vagrant 来安装 Ubuntu,并且显然适用于主要使用 Windows 或 Mac 的人,他们将受益于单独的 VM 来安装和使用 discourse。如果 Seth 有一台已经安装了 13.04 的“Ubuntu 机器”,他可以克隆 git repo 并在本地进行设置。

在 GitHub 上记录了本地和手动设置。然而它看起来确实有点复杂,vagrant VM 已经预先配置了所有需要的服务(pgsql、redis),所以可能更容易上手。

也就是说,如果您感到勇敢,可以按照以下步骤在本地 Ubuntu 机器上安装和配置东西。

免责声明,这一个涉及许多活动部件的复杂过程,我在新安装的 13.04 系统上测试了这个过程,但如果出现问题,您应该准备解密错误消息并修复问题。您应该对以下内容感到满意:

  • Ubuntu 包安装。
  • 文本文件编辑。
  • 对 Postgres 命令行使用有一定的了解。
  • 至少熟悉 Ruby、Rails 和 ruby​​gems。
  • 一些 git 没有坏处,但它仅用于初始克隆阶段

好的,这就去

安装需要的包:

sudo apt-get install git ruby ruby-bundler build-essential libxml2-dev libxslt1-dev redis-server postgresql libpq-dev postgresql-contrib-9.1
Run Code Online (Sandbox Code Playgroud)

创建一个 postgresql 数据库并向将要运行 discourse 的用户授予权限(我假设它名为“john”,它可以/应该是您的用户名):

sudo -u postgres createdb discourse_development
sudo -u postgres psql -c "create user john with password 'whatever' "
sudo -u postgres psql -c "grant all privileges on database discourse_development to john"
#This is a bit of postgresql magic to add the required hstore and pg_trgm extensions
sudo -u postgres psql discourse_development -c "create extension hstore; create extension pg_trgm"
Run Code Online (Sandbox Code Playgroud)

克隆存储库:

git clone https://github.com/discourse/discourse
cd discourse
Run Code Online (Sandbox Code Playgroud)

使用 Bundler 安装 ruby​​ gems 和依赖项,包括 rails:

bundle install
Run Code Online (Sandbox Code Playgroud)

您可能会在这里遇到依赖性问题,因为构建本机扩展可能需要其他包。如果您在此步骤中收到带有错误的黄色文本,请查看错误消息以确定要安装哪些软件包(使用 apt-get)。

配置数据库数据(postgres 和 redis):

cp config/redis.yml.sample config/redis.yml
cp config/database.yml.sample config/database.yml
# Now edit config/database.yml and in the discourse_development section add
# username: john
# password: whatever
# Follow the format for the other entries (adapter:, database:)
Run Code Online (Sandbox Code Playgroud)

运行迁移以初始化数据库,然后为其播种:

bundle exec rake db:migrate
bundle exec rake db:seed_fu
sudo -u postgres psql discourse_development < pg_dumps/production-image.sql
Run Code Online (Sandbox Code Playgroud)

然后启动开发网络服务器:

bundle exec rails s
Run Code Online (Sandbox Code Playgroud)

最后,打开浏览器并连接到本地开发服务器

http://localhost:3000
Run Code Online (Sandbox Code Playgroud)


Mar*_*ppi 6

云部署(使用 Juju)

如果你有一个云提供商,想跳过很多手动跳转,你可以使用Juju 魅力

你之后成功的自举的环境中,运行以下命令:

juju deploy cs:~marcoceppi/discourse
juju deploy postgresql
Run Code Online (Sandbox Code Playgroud)

然后建立关系

juju add-relation discourse postgresql:db-admin
Run Code Online (Sandbox Code Playgroud)

Discourse 需要db-admin级别访问才能启用 hstore 插件。最后,揭露话语:

juju expose discourse
Run Code Online (Sandbox Code Playgroud)

配置和其他注意事项可以在Charm 的 README 中找到。这些选项包括配置管理员、从何处获取 Discourse 源、版本固定和其他调整选项。

免责声明,我是这个魅力的作者。


Nat*_*man 5

裸机

我刚刚完成了一篇描述这个确切过程的文章

总之,您需要:

  • 安装和配置 PostgreSQL
  • 安装 Redis 和 Ruby 1.9.3+
  • 克隆 Discourse Git 存储库
  • 进行适当的配置。变化
  • bundle exec rails server