△インストール

Grav のインストールは超簡単な作業です。実際、本来の意味でのインストール作業は不要です。Grav のインストールにはいくつかの方法があります。まず、最も簡単な方法は、zip ファイルをダウンロードし、それを展開するだけの方法です。2 番目の方法は、Composer でインストールする方法です。3つ目の方法は、GitHub から直接ソースプロジェクトをクローンし、必要な依存関係をインストールするために含まれるスクリプトコマンドを実行する方法です。この他にも、バンドルされているスクリプトを実行する方法があります。

PHP のバージョン確認

Grav は驚くほど簡単にセットアップと実行ができますが、コマンドラインから php -v と入力し、少なくとも PHP のバージョンが 7.3.6+ 以上であることを確認してください。

php -v
PHP 7.3.18 (cli) (built: Jun  5 2020 11:06:30) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.18, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.18, Copyright (c) 1999-2018, by Zend Technologies

Option 1: zip ファイルからのインストール

Grav をインストールする最も簡単な方法は、ZIPパッケージをダウンロードし、それを展開することです。

  1. 最新の Grav または Grav + Admin をダウンロードしてください。
  2. ダウンロードした zip ファイルを、 Web サーバーの Document Root に展開してください。

Skeleton-package には、Grav のコアシステム、サンプルページ、プラグイン、設定などが含まれています。これらのパッケージは、使い始めるのに最適な方法です。あなたがすべきことは、好みの Skeleton-package をダウンロードし、上記のステップに従うことだけです。

You can also download any pre-packaged installation of a tagged release from getgrav.org. Use the format https://getgrav.org/download/TYPE/PACKAGE/VERSION.

If you downloaded the ZIP file and then plan to move it to your webroot, please move the ENTIRE FOLDER because it contains several hidden files (such as .htaccess) that will not be selected by default. The omission of these hidden files can cause problems when running Grav.

Option 2: composer でインストールする

composer で、Grav をインストールする方法もあります。

composer create-project getgrav/grav ~/webroot/grav

Grav の最新バージョンをインストールしたい場合は、追加パラメータとして 1.x-dev を追加してください。

composer create-project getgrav/grav ~/webroot/grav 1.x-dev

Option 3: GitHub からインストールする

GitHub のリポジトリから Grav をクローンを取得して、簡単な依存関係を解決するインストールスクリプトを実行する方法もあります。

  1. Clone the Grav repository from GitHub to a folder in the webroot of your server, e.g. ~/webroot/grav. Launch a terminal or console and navigate to the webroot folder:

    cd ~/webroot
    git clone -b master https://github.com/getgrav/grav.git
  2. Install vendor dependencies via composer:

    cd ~/webroot/grav
    composer install --no-dev -o
  3. Install the plugin and theme dependencies by using the Grav CLI application bin/grav:

    cd ~/webroot/grav
    bin/grav install

    This will automatically clone the required dependencies from GitHub directly into this Grav installation.

その他のオプション

Docker でインストールする

Docker is an extremely efficient way to bootstrap platforms and services on both servers and local environments. If you are setting up several environments that need to be the same, or working collaboratively, it offers a simple way to ensure consistency between installations. If you are developing several Grav sites, you can streamline setting them up using Docker.

Stable Docker images are available that use Apache (the official image), Nginx, and Caddy webservers. If you search, you will find more that you can try. With any image, make sure you create volumes to persist Grav's user, backups, and logs folders. (Backups and logs are optional if you don't need to keep that data.)

Cloudron にインストールする

Cloudron is a complete solution for running apps on your server and keeping them up-to-date and secure. On your Cloudron you can install Grav with a few clicks. If you host multiple sites, you can install them completely isolated from one another on the same server.

button: Cloudron install

The source code for the package can be found here.

Linode マーケットプレイスからインストールする

If you use Linode servers, there is an easy, documented method using Linode Marketplace. This will set up a new Grav site on a new dedicated Linode virtual server. The virtual server will incur a periodic charge.

Webservers

Apache/IIS/Nginx

Using Grav with a web server such as Apache, IIS, or Nginx is as simple as extracting Grav into a folder under the webroot. All it requires to function is [version=15]PHP 5.6.3[/version][version=16]PHP 7.1.3[/version][version=17]PHP 7.3.6[/version] or higher, so you should make sure that your server instance meets that requirement. More information about Grav requirements can be found in the requirements chapter of this guide.

If your web root is, for example, ~/public_html then you could extract it into this folder and reach it via http://localhost. If you extracted it into ~/public_html/grav you would reach it via http://localhost/grav.

Every web server must be configured. Grav ships with .htaccess by default, for Apache, and comes with some default server configuration files, for nginx, caddy server, iis, and lighttpd. Use them accordingly when needed.

Running Grav with the Built-in PHP Webserver

You can run Grav using a simple command from Terminal / Command Prompt using the built-in PHP server available as long as you have PHP installed.

All you need to do is navigate to the root of your Grav install using the Terminal or Command Prompt and enter bin/grav server.

While technically all you need is PHP installed, if you install the Symfony CLI application the server will provide an SSL certificate so you can use https:// and make use of PHP-FPM for better performance.

Entering this command will present you with output similar to the following:

➜ bin/grav server

Grav Web Server
===============

Tailing Web Server log file (/Users/joeblow/.symfony/log/96e710135f52930318e745e901e4010d0907cec3.log)
Tailing PHP-FPM log file (/Users/joeblow/.symfony/log/96e710135f52930318e745e901e4010d0907cec3/53fb8ec204547646acb3461995e4da5a54cc7575.log)
Tailing PHP-FPM log file (/Users/joeblow/.symfony/log/96e710135f52930318e745e901e4010d0907cec3/53fb8ec204547646acb3461995e4da5a54cc7575.log)

[OK] Web server listening
The Web server is using PHP FPM 8.0.8
https://127.0.0.1:8000

[Web Server ] Jul 30 14:54:53 |DEBUG  | PHP    Reloading PHP versions
[Web Server ] Jul 30 14:54:54 |DEBUG  | PHP    Using PHP version 8.0.8 (from default version in $PATH)
[PHP-FPM    ] Jul  6 14:40:17 |NOTICE | FPM    fpm is running, pid 64992
[PHP-FPM    ] Jul  6 14:40:17 |NOTICE | FPM    ready to handle connections
[PHP-FPM    ] Jul  6 14:40:17 |NOTICE | FPM    fpm is running, pid 64992
[PHP-FPM    ] Jul  6 14:40:17 |NOTICE | FPM    ready to handle connections
[Web Server ] Jul 30 14:54:54 |INFO   | PHP    listening path="/usr/local/Cellar/php/8.0.8_2/sbin/php-fpm" php="8.0.8" port=65140
[PHP-FPM    ] Jul 30 14:54:54 |NOTICE | FPM    fpm is running, pid 73709
[PHP-FPM    ] Jul 30 14:54:54 |NOTICE | FPM    ready to handle connections
[PHP-FPM    ] Jul 30 14:54:54 |NOTICE | FPM    fpm is running, pid 73709
[PHP-FPM    ] Jul 30 14:54:54 |NOTICE | FPM    ready to handle connections

Your terminal will also give you real-time updates of any activity on this ad hoc-style server. You can copy the URL provided in the [OK] Web server listening line and paste that into your browser of choice to access your site, including the administrator.

https://127.0.0.1:8000

This is a useful tool for quick development, and should not be used in place of a dedicated web server such as Apache or Nginx.

インストールの成功

最初のロード時、Grav はいくつかのファイルをプリコンパイルしてキャッシュを作成します。以後、ブラウザを更新すると、より高速でキャッシュされたバージョンを取得することができます。

Grav Installed

In the previous examples, $ represents the command prompt. This may look different on various platforms.

By default, Grav comes with some sample pages to give you something to get started with. Your site is already fully functional and you can configure it, add content, extend it, or customize it as much as you like.

Installation & Setup Problems

If any issues are discovered during the initial page load (or after a cache-flush event) you may see an error page:

Grav with Problems

Please consult the Troubleshooting section for help regarding specific issues.

If you have issues with file permissions, please check the Permissions Troubleshooting documentation. Also, you could look at the Hosting Guides documentation that has specific instructions for various hosting environments

Grav のアップデート

To keep your site up to date, please read Updating Grav & Plugins.


オリジナル : https://learn.getgrav.org/17/basics/installation