개발용 Windows에 Discourse 설치하기

:information_source: This tutorial has been tested on Windows 10 and 11.

To set up a development environment for Discourse on Windows, you can do it using Windows Subsystem for Linux feature.

This setup requires the WSL 2 installation. It is only available in Windows 10 builds 18917 or higher. We’ll assume that you already installed Windows Subsystem for Linux 2 (Ubuntu) on your Windows 10 system. WARNING: Install Ubuntu 18.04, and not 20.04 since some installations will fail on 20.04. For more information see June 30th, 2020 notes at the bottom of this post.

Let’s begin!

Installing Discourse

  1. Initially follow the steps from the topic Beginners Guide to Install Discourse on Ubuntu for Development until the step Clone Discourse.
  1. Before setting up the database you have to start PostgreSQL service & Redis server manually using following commands

    sudo service postgresql start
    redis-server --daemonize yes
    
  2. Then go through all the remaining steps of the Ubuntu guide.

Creating a Command to Start Discourse

Now your development environment is almost ready. The only problem is every time when you open Ubuntu on Windows you have to start the PostgreSQL service & Redis server manually. Don’t worry we can have a workaround for this by creating a custom command :wink:

cd ~

Create a new file using the command nano start-discourse and paste the content below then save and exit.

#!/bin/bash

# to start PostgreSQL
sudo service postgresql start

# to start Redis server
redis-server --daemonize yes

Now modify the CHMOD using below command

chmod +x start-discourse

And copy the file to your bin folder

sudo cp start-discourse /usr/bin/

It’s done. Now, whenever you open the Ubuntu bash just run the command below and start developing :+1:

start-discourse

Alternatively, if you are using Windows 10 enterprise, pro, or education edition then you can create a Linux virtual machine in hyper-v to set up the Discourse dev environment.

Notes About Windows Environment

As of June 30, 2020:
As of July 1, 2020

Last Reviewed by @SaraDev on 2022-06-16T02:00:00Z


This document is version controlled - suggest changes on github.

52개의 좋아요
How to install Discourse on windows
Help installing Discourse for Developer
Database connection error when setting up Discourse development environment using Linux Bash Shell on Windows 10
Restoring backup fails in Win10/Ubuntu development environment
How to Install Discourse on LocalHost in Windows?
Error installing `bullseye-backports` when trying to install for Development
How can i install Discourse forum on my win 10 dedicated server OVH
How to install on localhost
Trying to set up Discourse on my website
Restoring backup fails in Win10/Ubuntu development environment
Help with setting up discourse An error occurred while installing xorcist (1.1.2), and Bundler cannot continue
Migrate a MyBB forum to Discourse
Migrate a NodeBB forum with MongoDB to Discourse
Migrate a Phorum forum to Discourse
Migrate a PunBB forum to Discourse
Migrate from another forum to Discourse
Unable to setup discourse in my windows 10
Self hosting discourse with WSL shows an error, the command shown also doesnt work
Restoring backup fails in Win10/Ubuntu development environment
PG::UndefinedTable: ERROR: relation "pg_range" does not exist
I'm having trouble installing a local Discourse instance on Windows 11
Issues while installing Discourse on WSL
Guide to Setting Up Discourse Development Environment - Windows 11
Need help integrating code wrote on Edittext to the Discourse
Problem in development Installation
Contributing to Discourse development
Subscribe to post an ad
Use the Discourse API ruby gem
Migrate a Ning forum to Discourse
Windows server publish method
什么时候支持使用 wsl 容器部署 Discourse 开发环境?
No such file or directory - convert (Errno::ENOENT)
Topics which users cannot directly reply to, but can create a linked topic?
How to add a new language
How to Start Sidekiq When Using Puma
Discourse-webpack: A boilerplate for developing JS-heavy Discourse components
How can I directly edit Discourse database from a GUI?
Can't set up dev environment due to cppjieba_rb failing to install
Cloning and making our own Discourse community
How to Add Ngrok to Allowed Hosts
»vagrant up« hangs
Discourse installation end to end on Windows Server 2016
No connection to db issue
How to Install Discourse on LocalHost in Windows?
WSL environment deadlocks
Problem with development on Windows with Docker and mounted volume
Please help, how do I install Discourse on macOS?
Discourse standalone
Set up a local Discourse Development Environment?
Migrate a NodeBB forum with Redis to Discourse

해결책을 찾았습니다.

127.0.0.1을 localhost로 대체하면 이미지가 정상적으로 표시되는 것을 확인했습니다.

조금 검색해 본 결과, Discourse를 시작할 때 사용할 수 있는 명령어는 다음과 같습니다:

DISCOURSE_HOSTNAME=localhost UNICORN_LISTENER=localhost:3000 bin/ember-cli -u


나중에 가이드를 업데이트하겠습니다.

4개의 좋아요

이 PR을 검토해 주실 수 있을까요?

그렇게 하면 이 가이드가 조금 더 친근해질 것 같습니다.

3개의 좋아요

"불행히도 예상치 못한 오류가 발생하여 Bundler를 계속할 수 없습니다."라는 오류가 나는 이유를 아시는 분 계신가요? bundle install 실행 후 발생하는 문제입니다.

1개의 좋아요

같은 문제입니다

오류에 대한 스크린샷을 제공해 주실 수 있나요? 어떤 버전의 Ruby가 설치되어 있나요?

의존성 문제 때문에 어려움을 겪고 있습니다:

ux430uq@Asus-UX430UQ:~/discourse$ bundle install
You must use Bundler 2 or greater with this lockfile.
ux430uq@Asus-UX430UQ:~/discourse$ bundler -v
Bundler version 1.16.1

ux430uq@Asus-UX430UQ:~/discourse$ gem install bundler

Fetching: bundler-2.4.20.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /var/lib/gems/2.5.0 directory.
ux430uq@Asus-UX430UQ:~/discourse$
ux430uq@Asus-UX430UQ:~/discourse$ sudo gem install bundler
[sudo] password for ux430uq:
Fetching: bundler-2.4.20.gem (100%)
ERROR:  Error installing bundler:
        The last version of bundler (>= 0) to support your Ruby & RubyGems was 2.3.26. Try installing it with `gem install bundler -v 2.3.26`
        bundler requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.
ux430uq@Asus-UX430UQ:~/discourse$ bundler -v
Bundler version 1.16.1
ux430uq@Asus-UX430UQ:~/discourse$

쉽게 해결하는 방법이 있을까요? 2.6.0, 그리고 2.7.0 설치를 시도해 봤지만, 이 경우에도 항상 다른 문제들이 발생했습니다.

앞선 몇 가지 댓글과 마찬가지로, 이 가이드를 따르려 할 때 저도 몇 가지 어려움과 오류에 부딪혔습니다. Windows 10과 Windows 11 데스크톱 양쪽에서 시도해 보았습니다.

여러 번 시행착오를 거친 끝에 마침내 Windows 11에서 완전히 작동하는 개발 환경을 설정하는 단계를 찾았습니다. 최신 22H2 빌드와 다가오는 23H2 릴리스 프리뷰에서 테스트했으며, Windows 10의 최신 빌드에서도 작동할 것으로 생각합니다.

누군가에게 도움이 될 수 있다면, 가이드를 여기에 게시했습니다:

저처럼 Windows에서 Discourse를 실행하려는 분들에게 도움이 되기를 바랍니다. :smiley:

2개의 좋아요

지난번 시도 이후로 아무 문제가 없는지 확인하기 위해 이 공식 가이드를 처음부터 다시 확인해 보았습니다.
Windows 11에서 WSL을 통해 Ubuntu(버전 미지정)를 설치했는데, 이 경우 마지막 LTS 버전인 22.04가 설치되었습니다.

어떤 문제도 발생하지 않았습니다. 모든 과정이 순조로웠고, 오류도 없었으며 개발용 설치도 정상적으로 작동합니다.

앞으로 저희 공식 가이드를 사용하여 무언가를 설치하다가 문제가 발생하면, 오류 내용을 기록해 두셔서 저희에게 보고해 주십시오. 항상 유용합니다 :smile:


다만 두 가지 경고가 있습니다:

Node.js를 설치할 때:

================================================================================
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
================================================================================

                           SCRIPT DEPRECATION WARNING


  This script, located at https://deb.nodesource.com/setup_X, used to
  install Node.js is deprecated now and will eventually be made inactive.

  Please visit the NodeSource distributions Github and follow the
  instructions to migrate your repo.
  https://github.com/nodesource/distributions

  The NodeSource Node.js Linux distributions GitHub repository contains
  information about which versions of Node.js and which Linux distributions
  are supported and how to install it.
  https://github.com/nodesource/distributions


                          SCRIPT DEPRECATION WARNING

================================================================================
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
================================================================================

TO AVOID THIS WAIT MIGRATE THE SCRIPT
Continuing in 60 seconds (press Ctrl-C to abort) ...

redis-server --daemonize yes를 실행할 때:

# WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

그때 왜 그렇게 많은 문제가 발생했는지 모르겠네요! 아마도 제 Windows 설치에 뭔가 이상한 점이 있었는데, 문제 해결을 하던 중에 모르게 고쳐버린 것 같습니다! :stuck_out_tongue:

그래도 지금까지 배운 것에 대해 만족하고, 포럼을 Discourse로 이식하는 작업을 계속 진행하는 것을 기대하고 있습니다.

2개의 좋아요

Windows를 다시 설치해야 했으며, 이제 새 Windows 11이 설치된 상태입니다.
가이드를 따라 진행한 후 나중에 결과를 보고하겠습니다! @AliBenBongo님의 가이드도 염두에 두겠습니다.

1개의 좋아요

추가 후속 답변입니다.

가이드는 확실히 업데이트가 필요하지만, 새로 설치한 Windows 11 22H2에서는 여전히 훌륭하게 작동합니다. :+1:

제가 겪은 유일한 문제는 터미널에서 wsl 명령이 정상적으로 작동했음에도 불구하고, WSL 기능이 기본적으로 활성화되어 있지 않았다는 점이었습니다:

3개의 좋아요

이 가이드가 오래된 것 같습니다. Ubuntu/Debian 가이드에 언급된 단계들은 더 이상 존재하지도 않습니다.

이 모든 단계를 되돌리는 방법이 있을까요? 예를 들어 패키지, gem, 클론 설치 스크립트를 역순으로 실행하는 방식 같은 것 말입니다.

여전히 20.04 대신 18.04를 설치해야 하나요?

nodejs 설치 시 다음 오류가 발생합니다:

# apt install nodejs

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 nodejs : Depends: libc6 (>= 2.28) but 2.27-3ubuntu1.6 is to be installed
E: Unable to correct problems, you have held broken packages.```

24.04 설치 실패, 호스트 머신에서 3000 포트에 연결할 수 없음

저는 24.04에서 실행하고 있습니다. 서버를 시작했을 때 어떤 화면이 표시되는지에 대한 정보를 더 많이 공유하는 것을 권장합니다.

FORCE_HOSTNAME=localhost bin/ember-cli -u를 시도해 보세요. 이 명령은 백엔드와 프론트엔드 서버를 동시에 실행합니다.

(도로 위에서: 기억에 의존하여 작성)