Article cover: photograph of design studio

Getting Started with CraftCMS

In today’s tutorial from PoweredByCoffee, we’re going to get CraftCMS up & running. If you’re new to Craft and want to know why it’s so good – take a read at our little introduction here!

Also, if you’re more comfortable installing with Composer, here’s a very cool and quick way of getting CraftCMS set up on your local system.

OK, some things you’ll need before we get started:

  • the latest version of Craft from buildwithcraft.com.
  • a web host/server that meets Craft’s minimum requirements.
  • SSH/FTP access to the server
  • MySQL access
  • an IDE/Text editor

 

Step 1:

Extract the latest version of Craft into a directory in your local environment. For our tutorial, let’s call our main root directory: craftcms.

If you can, we’d highly recommend keeping the craft directory above your web root so regular web users won’t be able to access these files directly.

Craft’s public directory contains files that will go inside your web root, so let’s extract them directly to the root.
By the end of this process, your directory structure should look something like this:

- htdocs
- craft
- craftcms
- index.php
- .htaccess
- web.config
- robots.txt

Now everything in its right place, let’s look at removing the index.php from your URLs. We can customise our URLs (permalinks to our WordPress readers) within the .htaccess file.

To do this, simply open the .htaccess file in your favourite code editor and add:

RewriteEngine On
# Send would-be 404 requests to Craft
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]

One final update, open craft/config/general.php & add 'omitScriptNameInUrls' => true, to the array. You’ll now be able to view the website without index.php appearing in any of your URLs.

Step 2: Permissions

In order to work as expected, Craft needs to be able to write to 3 folders: app, config & storage. We would recommend applying 744 to each directory. If Craft still isn’t working as expected, then change all three to have 774 permissions.

Step 3: Database

Like WordPress, ExpressionEngine and the majority of other CMS on the market, Craft uses a database to store all your website data.

Simply log into your GUI of choice, making sure the default charset to utf8 and the default collation to utf8_unicode_ci.

Within craft there is a config directory where you can edit db.php. This file holds all the database credentials such as username, password, server address, database name & table prefix.

Make sure these are fully completed before proceeding with the installation.

Step 4: Install!

Everything should now be in place. Let’s install Craft!

Select the ‘Begin’ button and create your account.
Choose a fairly complex username and password to help improve security.

Once this is completed click ‘Next’ & finish the installation by entering your Site Name and Site URL.

All going well, you’ll be greeted with an All done! message and now have Craft fully set up – good job!
In Part 2 of this series, we’re going to discuss the best way to deploy your new CraftCMS website to a staging server.

Thanks for reading!

Graeme

Signup to our mailing list