Discourseは、JavaScriptとRubyonRailsで記述されたオープンソースの次世代ディスカッションソフトウェアです。 Discourseは、StackExchangeおよびStackOverflowネットワークの背後にあるチームによって構築されています。
本日は、Ubuntu12.04LTSにDiscourseをインストールしてセットアップするプロセスについて説明します。
SSHを使用してサーバーにログインします
ssh username@hostname
システムを更新し、必要なすべてのパッケージをインストールします。
~ # ❯❯❯ sudo apt-get -y update && apt-get -y upgrade ~ # ❯❯❯ sudo apt-get -y install build-essential libssl-dev libyaml-dev git libtool \ libxslt-dev libxml2-dev libpq-dev gawk curl pngcrush \ imagemagick python-software-properties sed
新しいDiscourseユーザーを作成します:
~ # ❯❯❯ sudo adduser --shell /bin/bash --gecos 'Discourse application' discourse ~ # ❯❯❯ sudo install -d -m 755 -o discourse -g discourse /var/www/discourse ~ # ❯❯❯ sudo usermod -a -G sudo discourse
最新バージョンのPostgreSQLをインストールし、談話DBユーザーを作成します
~ # ❯❯❯ sudo apt-get -y install postgresql postgresql-contrib ~ # ❯❯❯ sudo -u postgres createuser -s discourse ~ # ❯❯❯ sudo -u postgres psql -c "alter user discourse password 'DiscoursePazzW0rt';"
最新バージョンのRedisをインストールする
~ # ❯❯❯ sudo add-apt-repository -y ppa:rwky/redis ~ # ❯❯❯ sudo apt-get update ~ # ❯❯❯ sudo apt-get install -y redis-server
最新バージョンのNginxをインストールします
~ # ❯❯❯ sudo add-apt-repository -y ppa:nginx/stable ~ # ❯❯❯ sudo apt-get update ~ # ❯❯❯ sudo apt-get install -y nginx
worker_processesをシステム内のプロセッサの数に設定します。システム内のプロセッサの数を確認し、worker_processesを設定するには、次のコマンドを実行します。
~ # ❯❯❯ sudo sed -i "0,/^worker_processes/ s/^worker_processes .*$/worker_processes `grep -c processor /proc/cpuinfo`;/" /etc/nginx/nginx.conf
メールサーバーをインストールする
~ # ❯❯❯ sudo apt-get install -y postfix
メールサーバーの設定方法の詳細については、ここをクリックしてください
談話ユーザーに切り替えます
~ # ❯❯❯ sudo su - discourse
RVMを使用してRubyをインストールする
discourse@rh:~$ \curl -s -S -L https://get.rvm.io | bash discourse@rh:~$ source ~/.rvm/scripts/rvm discourse@rh:~$ rvm install ruby
すべてが正しく行われたことを確認するには、コマンド「ruby-v」を使用します。
出力は次のようになります。
discourse@rh:~$ ruby --version ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
バンドラーのインストール
discourse@rh:~$ gem install bundler
Bluepillのセットアップ
gem install bluepill discourse@rh:~$ echo 'alias bluepill="NOEXEC_DISABLE=1 bluepill --no-privileged -c ~/.bluepill"' >> ~/.bashrc discourse@rh:~$ source ~/.bashrc discourse@rh:~$ rvm wrapper $(rvm current) bootup bluepill discourse@rh:~$ rvm wrapper $(rvm current) bootup bundle
Bluepillをcrontabに追加します
crontab -e @reboot RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ROOT=/var/www/discourse RAILS_ENV=production NUM_WEBS=2 /home/discourse/.rvm/bin/bootup_bluepill --no-privileged -c ~/.bluepill load /var/www/discourse/config/discourse.pill
最新の談話コードをプルダウンします
discourse@rh:~$ cd /var/www/discourse discourse@rh:~$ git clone git://github.com/discourse/discourse.git . # do not forget the dot at the end discourse@rh:~$ bundle install --deployment --without testのドットを忘れないでください
談話を設定する
サンプル構成ファイルをコピーします
discourse@rh:~$ cp config/discourse_quickstart.conf config/discourse.conf discourse@rh:~$ cp config/discourse.pill.sample config/discourse.pill
discourse.confファイルを編集します
vim config/discourse.conf
- ホスト名を変更します(例:yourSub.domain.org)
- 談話DBユーザーのパスワードを設定します– db_password(例:DiscoursePazzW0rt)
- メール設定オプションを設定します
談話データベースの初期化
cd /var/www/discourse discourse@rh:~$ createdb discourse_prod discourse@rh:~$ RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ENV=production bundle exec rake db:migrate discourse@rh:~$ RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ENV=production bundle exec rake assets:precompile
談話を開始
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
Nginxを構成する
discourse@rh:~$ sudo cp /var/www/discourse/config/nginx.global.conf /etc/nginx/conf.d/local-server.conf discourse@rh:~$ sudo cp /var/www/discourse/config/nginx.sample.conf /etc/nginx/sites-available/discourse.conf discourse@rh:~$ sudo ln -s /etc/nginx/sites-available/discourse.conf /etc/nginx/sites-enabled/discourse.conf discourse@rh:~$ sudo vim /etc/nginx/sites-enabled/discourse.conf # change the server_name (ex: yourSub.domain.org) discourse@rh:~$ sudo /etc/init.d/nginx restart
管理者アカウントを作成する
選択したブラウザを開き、ドメイン(例:yourSub.domain.org)に移動し、[ログイン]をクリックして新しいアカウントを作成します。
シェルプロンプトに戻る
cd /var/www/discourse discourse@rh:~$ RAILS_ENV=production bundle exec rails c 2.1.0 :001 > me = User.find_by_username_or_email('[email protected]') 2.1.0 :002 > me.activate 2.1.0 :003 > me.admin = true 2.1.0 :004 > me.save 2.1.0 :004 > SiteSetting.site_contact_username = me.username
それでおしまい。管理者アカウントが作成され、新しいフォーラムの使用を開始できるようになります。
もちろん、Linux VPSホスティングサービスのいずれかを使用している場合は、これを行う必要はありません。その場合は、専門のLinux管理者にサーバーへのインストールを依頼するだけです。 24時間年中無休でご利用いただけます。リクエストはすぐに処理されます。
PS。 この投稿が気に入った場合は、左側のボタンを使用してソーシャルネットワーク上の友達と共有するか、下に返信を残してください。ありがとう。