Installation of Grav is a trivial process. In fact, there is no real installation. You have three 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:
Grav is incredibly easy to set up and get running. Be sure you have at least PHP version 5.6.3 by going to the terminal and typing:
$ php -v
This should report the version and build information. For example:
PHP 7.2.15 (cli) (built: Feb 7 2019 20:10:03) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.15, Copyright (c) 1999-2018, by Zend Technologies
The easiest way to install Grav is to download the ZIP package and extract it:
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.
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
$ cd ~/webroot/grav $ bin/grav install
This will automatically clone the required dependencies from GitHub directly into this Grav installation.
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 5.6.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
Every web server must be configured. Grav ships with .htaccess by default, for Apache, and comes with some default server configuration files, for
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 to any system with PHP 5.6.3+ installed. All you need to do is navigate to the root of your Grav install using the Terminal or Command Prompt and enter
php -S localhost:8000 system/router.php. You can replace the port number (in our example it's
8000) with any port you prefer.
Entering this command will present you with output similar to the following:
$ php -S localhost:8000 system/router.php PHP 7.2.15 Development Server started at Sun Feb 17 21:02:14 2019 Listening on http://localhost:8000 Document root is /Users/rhuk/Projects/grav/grav Press Ctrl-C to quit.
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
Listening on line and paste that into your browser of choice to access your site, including the administrator.
This is a useful tool for quick development, and should not be used in place of a dedicated web server such as Apache.
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
The preferred method for updating Grav is to use the Grav Package Manager (GPM). All you need to do is to navigate to the root of your Grav site and type:
bin/gpm selfupgrade -f