「Ghost」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(en:Ghostへの転送ページ)
 
(→‎AUR インストール: リンク切れ修正)
(4人の利用者による、間の7版が非表示)
1行目: 1行目:
  +
[[Category:ウェブアプリケーション]]
#redirect[[en:Ghost]]
 
  +
[[en:Ghost]]
  +
Ghost はフリーでオープンソースのブログプラットフォームです。JavaScript で書かれており MIT ライセンスで配布されています。個人のブロガーによるオンラインパブリッシングを簡単にするために作られました。
  +
  +
== AUR インストール ==
  +
  +
{{AUR|ghost-web}} を[[インストール]]して {{ic|/etc/webapps/ghost/config.js}} を編集してください。そして {{ic|ghost.service}} を[[起動]]します。気に入ったら、システムの起動時に自動的に実行されるように[[有効化]]してください。
  +
  +
最終的な設定は http://127.0.0.1:2368/ghost から行います。
  +
  +
== カスタムインストール ==
  +
  +
=== 要件 ===
  +
[[nginx]] をウェブサーバーとして Ghost をインストールする方法を説明します。
  +
  +
{{Pkg|nginx}}, {{Pkg|npm}}, {{Pkg|sqlite}}, {{Pkg|python2}}, {{Grp|base-devel}}, {{Pkg|unzip}}, {{Pkg|nodejs}} を[[インストール]]してください。
  +
  +
=== インストール ===
  +
ウェブサーバーがブログのプロキシとなるように設定します。nginx の設定ファイル ({{ic|/etc/nginx/nginx.conf}}) の server ブロックの、location を以下のように変更します:
  +
location / {
  +
proxy_set_header X-Real-IP $remote_addr;
  +
proxy_set_header Host $http_host;
  +
proxy_pass http://127.0.0.1:2368;
  +
}
  +
ghost 用に ghost ユーザーとディレクトリを作成してください:
  +
$ useradd -r -d / -s /bin/false ghost
  +
$ mkdir -p /srv/http/example.org
  +
  +
{{ic|nginx.service}} を[[起動]]します。
  +
  +
{{AUR|ghost}}{{Broken package link|パッケージが存在しません}} をインストールするか ghost.org から最新版の Ghost を取得して、手動でインストールしてディレクトリを移動してください:
  +
$ curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip
  +
$ unzip ghost.zip -d /srv/http/example.org
  +
$ cd /srv/http/example.org
  +
  +
一時的に python のパスを python 3 から python 2 に変更します:
  +
  +
ダミーフォルダを作成:
  +
$ mkdir ~/bin
  +
python から python2 へのシンボリックリンクと設定スクリプトを追加してください:
  +
$ ln -s /usr/bin/python2 ~/bin/python
  +
$ ln -s /usr/bin/python2-config ~/bin/python-config
  +
最後に PATH 変数の最初に新しいフォルダを記述します:
  +
$ export PATH=~/bin:$PATH
  +
{{Note|[[環境変数]]の変更は永続的ではなく、現在のターミナルセッションでのみ有効です。}}
  +
  +
Ghost をインストールします。[[Arch User Repository]] から Ghost をインストールした場合は必要ありません:
  +
$ npm install --production
  +
  +
Ghost を起動:
  +
$ npm start --production
  +
  +
完了です。ブラウザを起動して 127.0.0.1 または Ghost をインストールしたデバイスの IP を開いて下さい。
  +
  +
=== サービスの作成 ===
  +
  +
{{Note|[[Arch User Repository]] から Ghost をインストールした場合はこの手順は不要です。}}
  +
  +
Ghost をバックグラウンドで実行したい場合、サービスを作成する必要があります。ローカルシステム用に新しいサービスユニットを[[Systemd#ユニットファイル|作成]]してください:
  +
  +
{{hc|/etc/systemd/system/ghost-example-com.service|<nowiki>
  +
[Unit]
  +
Description=Ghost blog example.org
  +
After=network.target
  +
  +
[Service]
  +
Type=simple
  +
PIDFile=/run/ghost-example-org.pid
  +
WorkingDirectory=/srv/http/example.org
  +
User=ghost
  +
Group=ghost
  +
ExecStart=/usr/bin/npm start --production /srv/http/example.org
  +
ExecStop=/usr/bin/npm stop /srv/http/example.org
  +
StandardOutput=null
  +
StandardError=null
  +
  +
[Install]
  +
WantedBy=multi-user.target
  +
</nowiki>}}
  +
  +
ブログディレクトリの所有者を変更して Ghost を起動:
  +
  +
$ chown -R ghost:ghost /srv/http/example.org
  +
$ systemctl start ghost-example-com
  +
  +
全てが問題ないようでしたら、新しいユニット {{ic|ghost-example-com}} とウェブサーバー {{ic|nginx.service}} を[[有効化]]します。

2019年3月31日 (日) 14:58時点における版

Ghost はフリーでオープンソースのブログプラットフォームです。JavaScript で書かれており MIT ライセンスで配布されています。個人のブロガーによるオンラインパブリッシングを簡単にするために作られました。

AUR インストール

ghost-webAURインストールして /etc/webapps/ghost/config.js を編集してください。そして ghost.service起動します。気に入ったら、システムの起動時に自動的に実行されるように有効化してください。

最終的な設定は http://127.0.0.1:2368/ghost から行います。

カスタムインストール

要件

nginx をウェブサーバーとして Ghost をインストールする方法を説明します。

nginx, npm, sqlite, python2, base-devel, unzip, nodejsインストールしてください。

インストール

ウェブサーバーがブログのプロキシとなるように設定します。nginx の設定ファイル (/etc/nginx/nginx.conf) の server ブロックの、location を以下のように変更します:

location / {
       proxy_set_header   X-Real-IP $remote_addr;
       proxy_set_header   Host      $http_host;
       proxy_pass         http://127.0.0.1:2368;
   }

ghost 用に ghost ユーザーとディレクトリを作成してください:

$ useradd -r -d / -s /bin/false ghost
$ mkdir -p /srv/http/example.org

nginx.service起動します。

ghostAUR[リンク切れ: パッケージが存在しません] をインストールするか ghost.org から最新版の Ghost を取得して、手動でインストールしてディレクトリを移動してください:

$ curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip
$ unzip ghost.zip -d /srv/http/example.org
$ cd /srv/http/example.org

一時的に python のパスを python 3 から python 2 に変更します:

ダミーフォルダを作成:

$ mkdir ~/bin

python から python2 へのシンボリックリンクと設定スクリプトを追加してください:

$ ln -s /usr/bin/python2 ~/bin/python
$ ln -s /usr/bin/python2-config ~/bin/python-config

最後に PATH 変数の最初に新しいフォルダを記述します:

$ export PATH=~/bin:$PATH
ノート: 環境変数の変更は永続的ではなく、現在のターミナルセッションでのみ有効です。

Ghost をインストールします。Arch User Repository から Ghost をインストールした場合は必要ありません:

$ npm install --production

Ghost を起動:

$ npm start --production

完了です。ブラウザを起動して 127.0.0.1 または Ghost をインストールしたデバイスの IP を開いて下さい。

サービスの作成

ノート: Arch User Repository から Ghost をインストールした場合はこの手順は不要です。

Ghost をバックグラウンドで実行したい場合、サービスを作成する必要があります。ローカルシステム用に新しいサービスユニットを作成してください:

/etc/systemd/system/ghost-example-com.service
[Unit]
Description=Ghost blog example.org  
After=network.target

[Service]
Type=simple  
PIDFile=/run/ghost-example-org.pid  
WorkingDirectory=/srv/http/example.org  
User=ghost  
Group=ghost  
ExecStart=/usr/bin/npm start --production /srv/http/example.org  
ExecStop=/usr/bin/npm stop /srv/http/example.org  
StandardOutput=null  
StandardError=null

[Install]
WantedBy=multi-user.target

ブログディレクトリの所有者を変更して Ghost を起動:

$ chown -R ghost:ghost /srv/http/example.org
$ systemctl start ghost-example-com

全てが問題ないようでしたら、新しいユニット ghost-example-com とウェブサーバー nginx.service有効化します。