How to Install Craft CMS on Your Breeze
Craft CMS is a premium, developer-focused content management system known for its flexibility, clean architecture, and exceptional content authoring experience. It features a powerful custom field system, Matrix blocks for structured content, live preview, and first-class GraphQL support. Craft is popular among agencies and enterprises building custom-designed websites. This guide covers installing Craft CMS on your Breeze instance.
Prerequisites
- A Breeze instance with Ubuntu 22.04 or later
- PHP 8.2+ with required extensions
- Composer 2.x installed globally
- MySQL 8.0+ or PostgreSQL 13+
- Apache or Nginx web server
- At least 2 GB RAM
Step 1 — Install PHP Extensions
sudo apt update
sudo apt install -y php-mbstring php-curl php-gd php-intl php-zip php-xml \
php-mysql php-bcmath php-opcache php-imagick
Step 2 — Create the Database
sudo mysql -u root -p
CREATE DATABASE craft_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'craft_user'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON craft_db.* TO 'craft_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 3 — Create a Craft Project
Use Composer to create a new Craft CMS project:
cd /var/www
composer create-project craftcms/craft my-craft-site
cd my-craft-site
During setup, Craft will generate a .env file. Edit it with your database credentials:
CRAFT_APP_ID=your-unique-app-id
CRAFT_SECURITY_KEY=your-generated-security-key
CRAFT_DB_DRIVER=mysql
CRAFT_DB_SERVER=127.0.0.1
CRAFT_DB_PORT=3306
CRAFT_DB_DATABASE=craft_db
CRAFT_DB_USER=craft_user
CRAFT_DB_PASSWORD=secure_password
CRAFT_DB_SCHEMA=public
CRAFT_DB_TABLE_PREFIX=
PRIMARY_SITE_URL=http://yourdomain.com
Step 4 — Run the Craft Installer
Install Craft via the command line:
php craft setup/welcome
php craft install
The installer will prompt you for your site name, site URL, admin email, username, and password. This creates all necessary database tables and the initial admin account.
Step 5 — Configure Apache
Create a virtual host with the document root pointing to Craft's web/ directory:
sudo nano /etc/apache2/sites-available/craft.conf
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/my-craft-site/web
<Directory /var/www/my-craft-site/web>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/craft_error.log
CustomLog ${APACHE_LOG_DIR}/craft_access.log combined
</VirtualHost>
sudo a2ensite craft.conf
sudo a2enmod rewrite
sudo systemctl reload apache2
Step 6 — Set Permissions
sudo chown -R www-data:www-data /var/www/my-craft-site
sudo chmod -R 775 /var/www/my-craft-site/storage
sudo chmod -R 775 /var/www/my-craft-site/web/cpresources
Post-Installation Configuration
Access the Craft control panel at http://yourdomain.com/admin. From here you can:
- Define Sections (channels, structures, singles) for different content types
- Create Custom Fields and field layouts for each section
- Build Matrix blocks for flexible, structured content areas
- Set up Assets volumes for file uploads and media management
- Configure User Groups and permissions for multi-author workflows
Template Development
Craft uses Twig for templating. Templates live in the templates/ directory. A basic layout example:
{# templates/_layout.twig #}
<!DOCTYPE html>
<html>
<head>
<title>{{ siteName }} - {% block title %}{% endblock %}</title>
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>