Install Craft CMS locally
Reviewedbyfl
Markdown ↓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
Before installing Craft CMS locally, you need a working development environment and the official installation guide as reference.
- Have a local development environment running. DDEV is recommended.
- Craft CMS 5 requires PHP 8.2 or newer, both locally and on fortrabbit.
- Use the official Craft CMS install guide as your guideline.
- Skip this step when you have a Craft project running locally and a GitHub repo connected see below.
Install with Composer
Craft CMS 5 is installed with Composer. Run this command on your local machine to create a new project — the interactive setup wizard then starts automatically:
composer create-project craftcms/craft my-project
Using DDEV? Prefix it: ddev composer create-project craftcms/craft my-project. See an error? Check your local development setup.
The deployment strategy is a separate choice made further down: Git for Composer-managed projects, or SFTP/rsync.
Run the setup wizard
composer create-project launches the setup wizard automatically, asking for database and account details. The defaults mostly work and everything can be changed later.
To re-run it manually — for example after cloning an existing project — use the Craft console command from the project folder:
cd my-project
php craft setup
Add your magic
A fresh Craft CMS installation is bare-bones; now customize it by adding templates, database structure, design, plugins, and content in your local development environment.
Choose a code deployment workflow
Craft CMS projects consist of three parts requiring different deployment strategies: code (application files), database (content tables), and assets (media volumes). Decide now which deployment method suits your workflow.
A - Git deployment (recommended)
To connect your app environment to a GitHub repo set up one now. Init git and add GitHub as remote repo - either as a public or private. Here is an example using the GitHub CLI.
# Initialize a new git repository
git init
# Add files and commit
git add .
git commit -m "Init"
# Create a new public repository on GitHub from the current directory
gh repo create --public --source=. --push
We recommend to exclude asset volumes from Git to sync them up and down. In most cases this is already the case.
Skip this step if your code is already at GitHub, see Git provider integration for other providers with CI/pipeline/actions flows. If this is fuzzy to you, see:
B - SFTP / rsync deployment
Later on you can upload Craft with SFTP.