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
- Install Craft CMS locally ← you are here
- Setup an app at fortrabbit
- Deploy code via Git
- Database syncing
- Assets syncing
Get ready
- Have a local development environment running. DDEV is recommended.
- Craft CMS 5 requires PHP 8.2 or newer, locally and on fortrabbit.
- Keep the official Craft CMS install guide at hand.
- Skip to choose a deployment workflow when a Craft project already runs locally.
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
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
A - Git deployment (recommended)
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
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.