Fedora Linux에서 개발용 Discourse 설정하기

이 가이드는 Fedora 31과 33의 새 설치 환경에서 테스트되었지만, dnf를 패키지 관리 도구로 사용하는 이전 버전에서도 작동할 수 있습니다. 이는 공식 가이드는 아니지만 Fedora를 사용하는 다른 개발자분들에게 유용할 수 있습니다. 이 가이드는 주로 Ubuntu 개발 가이드를 기반으로 하며, dnf에 맞는 패키지 차이점을 반영하여 수정되었습니다. 이미 패키지가 설치되어 있지 않다고 가정하지만, 이미 설치된 패키지는 대부분 도구가 자동으로 건너뜁니다.

프로덕션 환경에 Discourse를 설치하려는 경우, GitHub의 docker 설치 지침을 우선적으로 따르는 것이 좋습니다.

필수 시스템 및 개발 패키지 설치

sudo dnf update
sudo dnf install -y "@development-tools" git rpm-build zlib-devel ruby-devel readline-devel libpq-devel ImageMagick sqlite sqlite-devel nodejs npm curl gcc g++ bzip2 openssl-devel libyaml-devel libffi-devel zlib-devel gdbm-devel ncurses-devel optipng pngquant jhead jpegoptim gifsicle oxipng

필수 npm 패키지 설치

sudo npm install -g svgo pnpm

Postgres 설치 및 설정

sudo dnf install postgresql-server postgresql-contrib
sudo postgresql-setup --initdb --unit postgresql
sudo systemctl enable postgresql
sudo systemctl start postgresql
sudo -u postgres -i createuser -s $USER

Redis 설치 및 설정

sudo dnf install redis
sudo systemctl enable redis
sudo systemctl start redis

rbenv, ruby-build 및 ruby 설치

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
~/.rbenv/bin/rbenv init
printf 'export PATH="$HOME/.rbenv/bin:$PATH"\n' >> ~/.bashrc
printf 'eval "$(rbenv init - --no-rehash)"\n' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
# 설치가 올바른지 확인
 curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
rbenv install 2.7.1
rbenv global 2.7.1
rbenv rehash

Ruby 의존성 설치

gem update --system
gem install bundler mailcatcher rails

Discourse 코드 클론

git clone https://github.com/discourse/discourse.git ~/discourse
cd ~/discourse

Discourse 의존성 설치

bundle install
pnpm install

필수 데이터베이스 생성 및 스키마 로드

bundle exec rake db:create db:migrate
RAILS_ENV=test bundle exec rake db:create db:migrate

테스트 실행으로 설치 확인

bundle exec rake autospec

애플리케이션 실행

bundle exec rails server

이제 http://localhost:3000에서 Discourse 설정 페이지를 볼 수 있어야 합니다.

추가 설정에 대해서는 기존 공식 설치 가이드를 참고하세요.


이 문서는 버전 관리됩니다. 변경 사항을 GitHub에서 제안할 수 있습니다.

27개의 좋아요

In Installing rbenv, ruby-build, and ruby, the url to the rbenv-doctor script is not working anymore (apparently the branch has been rename from master to main), the correct command is now:

curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
2개의 좋아요

Thanks for the info @nicolas-jaussaud, I’ve updated the OP.

FWIW I now prefer to use chruby and ruby-install over rbenv.

2개의 좋아요

I ran into an issue trying to run bundle install as Fedora now has by default disabled file transport.

The error happens when trying to install the sprockets gem and ends with the message:

transport 'file' not allowed

I don’t know what’s the proper way to do this, but you can temporarily allow the unsafe transport:

git config --global protocol.file.allow always
# run the discourse setup here
git config --global protocol.file.allow never

After that I ran into an error like this when running db:migrate:

At /home/hhyyrylainen/Projects/discourse/lib/site_setting_extension.rb:199:in `public_send`
Deprecation notice: `SiteSetting.enable_personal_messages` has been deprecated. Please use `SiteSetting.personal_message_enabled_groups` instead. (removal in Discourse 3.0) 
At /home/hhyyrylainen/Projects/discourse/lib/site_setting_extension.rb:199:in `public_send`
#<Thread:0x00007f94c3342600 /home/hhyyrylainen/Projects/discourse/lib/scheduler/defer.rb:83 run> terminated with exception (report_on_exception is true):
/home/hhyyrylainen/.gem/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_handling.rb:309:in `connection_pool': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
	from /home/hhyyrylainen/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rails_multisite-4.0.1/lib/rails_multisite/connection_management/rails_61_compat.rb:8:in `current'
	from /home/hhyyrylainen/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rails_multisite-4.0.1/lib/rails_multisite/connection_management.rb:115:in `current_db_hostnames'
	from /home/hhyyrylainen/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rails_multisite-4.0.1/lib/rails_multisite/connection_management.rb:111:in `current_hostname'
	from /home/hhyyrylainen/Projects/discourse/lib/discourse.rb:232:in `handle_job_exception'
	from /home/hhyyrylainen/Projects/discourse/lib/scheduler/defer.rb:114:in `rescue in do_work'
	from /home/hhyyrylainen/Projects/discourse/lib/scheduler/defer.rb:113:in `do_work'
	from /home/hhyyrylainen/Projects/discourse/lib/scheduler/defer.rb:85:in `block (2 levels) in start_thread'
/home/hhyyrylainen/.gem/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_handling.rb:309:in `connection_pool': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
	from /home/hhyyrylainen/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rails_multisite-4.0.1/lib/rails_multisite/connection_management.rb:79:in `with_connection'
	from /home/hhyyrylainen/Projects/discourse/lib/scheduler/defer.rb:96:in `do_work'
	from /home/hhyyrylainen/Projects/discourse/lib/scheduler/defer.rb:85:in `block (2 levels) in start_thread'

It seems it happened after the migration finished, so as I couldn’t figure out how to fix that I ignored it, but luckily my development site seems to be working.

For the test environment I didn’t get the same error but got an error about missing oxipng, which doesn’t seem to be available as a Fedora package.

After that I didn’t run into any more issues, everything still more or less worked fine on Fedora 38. Though, I had previously installed rbenv using some other setup instructions.

Running bundle exec rake autospec I got some test failures (135) but it seems I got a mostly working development setup.

2개의 좋아요

I got the Dev version going some time ago but the Production version was too difficult for me . .

Just followed this guide to install on Fedora 40 Workstation, had to add oxipng to the distro installs.
sudo dnf install oxipng

3개의 좋아요

Thanks for letting us know, I’ve updated the documentation in this commit: docs/fedora-setup: include oxipng package (#14) · discourse/discourse-developer-docs@eb51e54 · GitHub.

1개의 좋아요

I am stuck after installation today on Fedora 41 with the following issue when I connect to localhost:3000 and click on register :
“no administrator emails were defined during setup”; the message provides how to add an administrator email.

I’ve failed to successfuly add an admin acount following this procedure because of 2 errors when using ./launcher enter app :
1° First solved error was: no app.yml file is present → I copied the sampleapp.yml from the sample folder to the container folder, then modified to add email adresses, then did the rebuild with /var/discourse/launcher rebuild app
2° Second error is not solved :
Error response from daemon: No such container: app
If I use the rake commands to create an admin it tells me no rakefile found

Can anyone please help?

This install doesn’t use docker, so you can’t enter a container.

Try creating an admin from the Discourse folder with this command:

bin/rails admin:create
1개의 좋아요

Hi Coconut, you are quick to respond and efficient, thanks a lot !
The command returns gem bunder missing, which I installed with `gem install bundler -v 2.6.2’ and then I could successfuly apply your solution !

2개의 좋아요

로컬 설치를 시도해 보았지만 pgvector에서 문제가 발생했습니다. Fedora 42와 Postgres 16 환경입니다. 패키지로 설치된 pgvector 버전은 0.6.2인데, 더 최신 버전을 사용하려면 소스에서 컴파일해야 하는 것 같습니다.

그런데 pgvector를 빌드하는 과정에서 충돌이 발생했는데, postgresql-private-devel 패키지가 필요하며 이 패키지가 libpq-devel과 충돌하는 요청을 가지고 있었습니다.

다음 방법으로 해결했습니다:

  •  sudo dnf install postgresql-server-devel --allowerasing
    
  • pgvector 빌드
  • 설치된 버전 확인
    sudo -u postgres psql discourse_development -c "SELECT * FROM pg_available_extensions WHERE name = 'vector';"
    
  •  sudo systemctl restart postgresql
    
3개의 좋아요

image

음… 이거 공식적인 건가요? (그 문장은 아마 제거해야 하지 않을까요?)

실례지만, 이 버전은 구버전이 아닌가요? rbenv install -l에 나열된 Ruby의 최신 버전이 4.0.5였던 것 같습니다(ruby-lang.org의 최신 버전도 마찬가지입니다).

1개의 좋아요

bundle exec rails server를 실행하면 수많은 마이그레이션이 시작됩니다. 약 1시간 동안 실행 중인데 아직 끝나지 않았습니다. 제 노트북은 이를 처리할 충분한 RAM과 CPU 성능을 갖추고 있는데, 이는 단순히 실행해야 할 마이그레이션의 양이 많기 때문일까요?

수정: 3시간이 지났는데도 여전히 진행 중입니다.
수정 #2: 4시간째 접어들었습니다…

수정 #3: 제 실수였습니다. 4시간 동안 콘솔 출력을 잘못 읽었더니, 실제로는 마이그레이션이 실행 중이 아니었습니다 :facepalm: … Sidekiq 잡들이 실행 중이었고, 포트 3000에서는 인스턴스가 실제로 표시되고 있었습니다. 걱정할 일이 아니었습니다!