Unlimited Wordpress themes, plugins, graphics & courses! Unlimited asset downloads! From $16.50/m
by
Lessons:13Length:1.5 hours

Next lesson playing in 5 seconds

Cancel
  • Overview
  • Transcript

2.1 Setting Up Grav CMS

As Grav is a flat file CMS, you don’t have to deal with databases, meaning setting up a new site is a very smooth process. In this lesson we’ll go through what’s involved, and we’ll touch briefly on setting up offline dev environments.

Related Links

2.1 Setting Up Grav CMS

Hey, I'm Kezz for Touch Plus, and welcome to the first lesson in Up and Running with Grav CMS. In this lesson we're just gonna touch on the basics that you'll need to know about in order to get your first Grav CMS site up and running. We're actually gonna be working offline for this course, sorry, as I mentioned in the introduction. You will need to have some degree of comfort in creating a local host, so a server that's gonna run on your computer rather than having to work offline and then upload all of your edits up to your host every time you make a change. And the beauty of Grav is that it's a flat file CMS. So what that means is it doesn't need a database. And one of the most time consuming parts and sometimes technically challenging parts of setting up the CMS is often working with the database. Creating the database, setting up users for the database, making sure that you're connecting correctly to the database and so on and so forth. With Grav, you don't need to worry about any of that. All you have to do is download the zip that contains the CMS, you unzip it and that's it. It's ready to go, it works automatically. The only setup stage is creating a first user, so that you have some login details to access the admin panel, if you choose to use the admin plugin. Now you can actually get Grav in two flavors. You can get it with or without the admin plugin. Everything in Grav has been created so that if you don't want to use an admin panel, all you have to do is directly edit the files that make up Grav. But if you'd rather work with a visual interface, then you can use the admin plugin. And the admin plugin is gonna do the job of rewriting those same files that you would be manually editing if you weren't using the admin plugin. Through this course, we're gonna be using that admin plugin, but we're also gonna cover which files are being edited via the admin plugin, so that if you wanna do things manually later, you'll know which files to work with. So to get the ball rolling, head to getgrav.org/downloads, then you wanna click this button here that says Grav core + admin plugin. Now the system requirements for grav are not particularly extensive. All you really need is PHP. And on top of not needing any complicated installation processes, Grav also comes with its own in-built PHP server. So that means if you have PHP installed on your computer you can just run one command inside the folder of your Grav site, and it will spin up a server for you on your computer. By getting PHP installed on your computer can be a little bit advanced if you haven't worked with anything like this before, so it's not essential that you work this way. But it is definitely an option to consider, because if you do get PHP set up successfully in your computer it does make it quite straightforward and efficient to run offline Grav sites. Now doing this set up is beyond the scope of this course, but what I will do is provide information in the links below this video where you can read about the instructions for installing PHP on your operating system and you can give that a try if you'd like to use that approach. Windows is potentially the more difficult platform to get PHP installed on, but here are the instructions if you would like to have a shot at that. Mac is the easiest because PHP is already pre-installed, so you don't even have to do anything, but I'll give you a link to this information so you can just have a read-up on that pre-installed PHP anyway. And Linux is also usually fairly straightforward to get PHP going. All you really need to do is use your systems package manager to install PHP, and then you're good to go. However, it's still probably advisable to look up a guide for your specific distro on how to get PHP set up, and there are some links to guide you through that on this page here. But if you don't wanna do any of those things, you don't wanna install PHP on your computer that's also totally fine. In that case the best option for you is to use something like MAMP or XAMPP, and this will set up a little contain server on your computer without any need to install PHP directly. So basically you just wanna download the program through the MAMP or XAMPP and just follow the instructions that they provide you on how to set it up. So in this case there's MAMP which runs on Mac and Windows, or there is XAMPP which which runs on Mac, Windows and Linux. Okay, so once you have either PHP installed or MAMP or XAMPP, then you're ready to go. Now as I said, all you have to do is just unzip the zip that you downloaded from the Grav CMS website. If you're working with MAMP or XAMPP, you're gonna want to copy your Grav zip into the HT docs folder, and then unzip it there. If you're working with PHP installed on your system, then you can unzip your Grav folder anywhere and it will just work. So at this point if you're using MAMP or XAMPP you can go straight to a web browser, put in the address of your local host, followed by a slash and then grav-admin. On XAMPP that will typically just be localhost/grav-admin. And on MAMP that will typically be localhost:3000 or 8000 and then /grav-admin. That just depends on the setup of the program that you've decided to go with, and you should be able to get from that program information on what the local host URL is that's running for you. On the other hand, if you're using PHP installed directly on your system, you'll want to go into grav-admin folder that you just unzipped, and you're gonna need to open a terminal or command prompt pointed at that folder. If you're in Windows, I believe that you can hold them, it's either Shift or Control, and then right-click, and you should see open command prompt here and that will have your command prompt pointed at the correct folder. And then on Mac and on mostly distros you should be able to just right-click and find in the context some type of open terminal here command. And then to use Grav's in-built system to launch a local host, you just need to type the command php-S localhost:8000. You can change that 8000 number to anything that you like. So for example, if you're already running a Grav site on this 8000 port number, then you wanna have another Grav site running locally as well. You can change that port number to 9000 or anything that you like. And then after that, type system/router.php and hit Enter. Now you can see that we've got a message here telling us that that has been successful. It says listening on http://localhost:8000, so that is now the URL that we can go to to see our Grav site. So now, whichever way you're taking to run your local GRAV CMS site, go ahead and punch in the URL into your browser, and as you can see, without needing to do any setup steps everything is automatically running. The only thing that you have to do here is set yourself up a user. So just fill in the fields with anything that you please and this will create the default admin user. And with that done that's gonna take us straight into the admin panel. So this is the dashboard of the Grav admin panel. We've got some useful widgets on here, and if we go up and click this little button at the top that's gonna take us into the preview of our live site. We've already got a little bit of demo content in here so we can see how things are working, and that's it. So that's your Grav site completely up and running. Now if you wanted to do the same thing on a live web host, all you would need to do is get those same files from that zip and just upload them into your public HTML folder, or into a subfolder in which you want to house your website. The same process, all you need to do is get those files into a folder, go to the URL that represents that folder, and just set up your first user. And that's it. So now that we've got everything installed and we've got the admin panel up and running, in the next lesson we're just gonna quickly have an overview of everything that's included in the admin panel, and we're gonna touch on some of the key points of how the admin panel interacts with the files that are contained inside uGrav CMS installation. So we'll go through all that in the next lesson. I'll see you there.

Back to the top