Install Craft CMS locally

Published

Updated

Set up Craft CMS on your local machine, using Composer or a download, before deploying to fortrabbit.

Install and deploy run down

  1. Install Craft CMS locally ← you are here
  2. Setup an app at fortrabbit
  3. Deploy code via Git
  4. Database syncing
  5. Assets syncing

Get ready

Install with Composer

Run this command on the local machine to create a new project. The setup wizard starts right after and asks for the database and the admin account:

composer create-project craftcms/craft my-project
shell

With DDEV, prefix it: ddev composer create-project craftcms/craft my-project. To run the wizard again, for example after cloning an existing project, run php craft setup in the project folder.

Then build the site locally with templates, sections, fields, plugins and content.

Choose a code deployment workflow

A Craft CMS project has three parts, and each one is deployed its own way:

  • Code: Craft, plugins, templates and config, decide now
  • Database: content tables
  • Assets: volumes with uploads

Put the project in a git repository on GitHub, here with the GitHub CLI:

git init
git add .
git commit -m "Init"
gh repo create --private --source=. --push
bash

Keep asset volumes out of git and sync them separately. Code already on GitHub? Skip this step. For other providers and CI pipelines see Git provider integration, for the basics the deployment intro and the Git intro.

B - SFTP or rsync upload

Without git, upload the whole project folder, vendor included, with SFTP or rsync. No build or post-deploy commands run then: run composer install locally before each upload and php craft up over SSH after it.

Written by humans and AI in collaboration.

AI use & editorial processEdit on GitHub ↗