Installation of Grav is a trivial process. In fact, there is no real installation. You have several options for installing Grav. The first – and simplest – way is to download the zip archive, and extract it. The second way is to install with Composer. The third way is to clone the source project directly from GitHub, and then run an included script command to install needed dependencies. There are more ways that involve running bundled scripts.
Grav is incredibly easy to set up and get running. Be sure you have at least PHP version 7.1.3+ by going to the terminal and typing php -v
:
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
The easiest way to install Grav is to download the ZIP package and extract it:
~/webroot/grav
There are Skeleton-packages available, which include the core Grav system, sample pages, plugins, and configuration. They are a great way to get started; all you have to do is download the Skeleton-package you prefer, and follow the steps above.
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.
The alternative method is to install Grav with composer:
composer create-project getgrav/grav ~/webroot/grav
If you want to check out the bleeding edge version of Grav, add 1.x-dev
as an additional parameter:
composer create-project getgrav/grav ~/webroot/grav 1.x-dev
Another method is to clone Grav from the GitHub repository, and then run a simple dependency installation script:
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
Install vendor dependencies via composer:
cd ~/webroot/grav
composer install --no-dev -o
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 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 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.
The source code for the package can be found here.
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.
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 PHP 7.1.3 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.
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.
The first time it loads, Grav pre-compiles some files. If you now refresh your browser, you will get a faster, cached version.
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.
If any issues are discovered during the initial page load (or after a cache-flush event) you may see an error page:
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
To keep your site up to date, please read Updating Grav & Plugins.
Found errors? Think you can improve this documentation? Simply click the Edit link at the top of the page, and then the icon on Github to make your changes.
Powered by Grav + with by Trilby Media.