تثبيت Discourse على Windows للتطوير

: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
Install Discourse on Ubuntu or Debian for Development
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
Trying to set up Discourse on my website
Help with setting up discourse An error occurred while installing xorcist (1.1.2), and Bundler cannot continue
Restoring backup fails in Win10/Ubuntu development environment
How to install on localhost
WSL environment deadlocks
Problem with development on Windows with Docker and mounted volume
Please help, how do I install Discourse on macOS?
Install Discourse on Ubuntu or Debian for Development
Discourse standalone
Set up a local Discourse Development Environment?
Migrate a NodeBB forum with Redis to Discourse
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
No such file or directory - convert (Errno::ENOENT)
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
Install Discourse on Ubuntu or Debian for Development
Subscribe to post an ad
Restoring backup fails in Win10/Ubuntu development environment
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
Dev Category sidebar
Install Discourse on Ubuntu or Debian for Development
Discourse installation end to end on Windows Server 2016
Install Discourse on Ubuntu or Debian for Development
Install Discourse on Ubuntu or Debian for Development
No connection to db issue
How to Install Discourse on LocalHost in Windows?
Install Discourse for development using Docker
Install Discourse on Ubuntu or Debian for Development

حسنًا، وجدت حلاً.

لاحظت أن استبدال 127.0.0.1 بـ localhost سيصلح الصور.

بعد البحث قليلاً، هذا هو الأمر الذي يمكنك استخدامه لبدء Discourse:

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


سأحاول تحديث الدليل لاحقًا.

4 إعجابات

هل هناك فرصة لمراجعة طلب السحب هذا؟

هذا من شأنه أن يجعل هذا الدليل أكثر سهولة.

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 Release Preview (أفترض أنه سيعمل أيضًا على أحدث إصدار من Windows 10).

إذا كان ذلك مفيدًا لأي شخص، فقد نشرت الدليل للتو هنا: -

آمل أن يساعد هذا الأشخاص مثلي الذين يحاولون تشغيل Discourse تحت نظام Windows :smiley:

إعجابَين (2)

لقد مررت بهذا الدليل الرسمي بأكمله مرة أخرى للتأكد من عدم تعطل أي شيء منذ محاولتي الأخيرة.
لقد قمت بتثبيت Ubuntu (إصدار غير محدد) عبر WSL على نظام Windows 11، والذي قام بتثبيت أحدث إصدار LTS، وهو 22.04 في هذه الحالة.

لم أواجه أي مشاكل؛ كل شيء كان مباشرًا، بدون أخطاء، وتثبيت التطوير يعمل.

إذا واجهت صعوبة في تثبيت شيء ما باستخدام أحد أدلتنا الرسمية في المستقبل، فيرجى تدوين الأخطاء والإبلاغ عنها لنا، فهذا مفيد دائمًا :smile:


تحذيران مع ذلك:

عند تثبيت Node.js:

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

                           تحذير إيقاف البرنامج النصي
  هذا البرنامج النصي، الموجود على https://deb.nodesource.com/setup_X، والذي كان
  يُستخدم لتثبيت Node.js، تم إيقافه الآن وسيتم جعله غير نشط في النهاية.

  يرجى زيارة مستودع توزيعات NodeSource على Github واتباع
  التعليمات لترحيل المستودع الخاص بك.
  https://github.com/nodesource/distributions

  يحتوي مستودع GitHub لتوزيعات Node.js Linux على
  معلومات حول إصدارات Node.js وتوزيعات Linux
  المدعومة وكيفية تثبيتها.
  https://github.com/nodesource/distributions


                          تحذير إيقاف البرنامج النصي

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

لتجنب هذا الانتظار، قم بترحيل البرنامج النصي
سيستمر في 60 ثانية (اضغط Ctrl-C للإلغاء) ...

عند تشغيل redis-server --daemonize yes:

# تحذير يجب تمكين تجاوز تخصيص الذاكرة! بدون ذلك، قد يفشل الحفظ في الخلفية أو النسخ المتماثل في ظروف الذاكرة المنخفضة. عند تعطيله، يمكن أن يتسبب أيضًا في فشل دون وجود ذاكرة منخفضة، انظر https://github.com/jemalloc/jemalloc/issues/1328. لإصلاح هذه المشكلة، أضف 'vm.overcommit_memory = 1' إلى /etc/sysctl.conf ثم أعد التشغيل أو قم بتشغيل الأمر 'sysctl vm.overcommit_memory=1' ليصبح هذا ساري المفعول.

لست متأكدًا من سبب وجود العديد من المشكلات لدي حينها! ربما كان هناك شيء غريب في تثبيت ويندوز الخاص بي تمكنت من إصلاحه أثناء استكشاف الأخطاء وإصلاحها دون أن أدرك ذلك! :stuck_out_tongue:

ومع ذلك، ما زلت سعيدًا بما تعلمته حتى الآن وأتطلع إلى مواصلة العمل على ترحيل منتدياتي إلى Discourse.

إعجابَين (2)

لقد اضطررت إلى إعادة تثبيت ويندوز، ولدي الآن ويندوز 11 جديد مثبت.
سأتبع الدليل وأبلغ لاحقًا! سأضع دليل @AliBenBongo في الاعتبار أيضًا.

إعجاب واحد (1)

هذا متابعة.
بالتأكيد يمكن الاستعانة بدليل محدّث، لكنه لا يزال يعمل بشكل رائع على نظام Windows 11 22H2 جديد. :+1:
المشكلة الوحيدة التي واجهتني، كانت أنه حتى مع عمل أمر wsl في الطرفية، فإن ميزة WSL لم تكن ممكّنة افتراضيًا:

3 إعجابات

أعتقد أن هذا الدليل قديم. الخطوات المذكورة في دليل Ubuntu/Debian لم تعد موجودة.

هل هناك طريقة للتراجع عن كل هذه الخطوات، على سبيل المثال، عكس البرنامج النصي للتثبيت للحزم والجواهر والاستنساخ؟

هل لا يزال تثبيت 18.04 فوق 20.04 مطلوبًا؟

تلقي خطأ عند تثبيت nodejs:

# apt install nodejs

قراءة قوائم الحزم... تم
بناء شجرة الاعتماديات
قراءة معلومات الحالة... تم
تعذر تثبيت بعض الحزم. قد يعني هذا أنك طلبت
وضعًا مستحيلًا أو إذا كنت تستخدم التوزيعة غير المستقرة
فإن بعض الحزم المطلوبة لم يتم إنشاؤها بعد
أو تم نقلها خارج Incoming.
قد تساعد المعلومات التالية في حل الموقف:

الحزم التالية لديها اعتماديات غير ملباة:
 nodejs : يعتمد على: libc6 (>= 2.28) ولكن سيتم تثبيت 2.27-3ubuntu1.6
E: تعذر تصحيح المشاكل، لديك حزم معطلة.```