Updated on Jan 23, 2025
Craft is just as easy to install as it is to cover its requirements. In this part of our tutorial, we will discuss the two ways you can install Craft: via DDEV or Composer. Both methods are straightforward to follow, but they are suitable for different environments and systems.
This post includes:
Firstly, this is the method the developers of Craft themselves recommend. The reason is that DDEV, a Docker-based PHP development environment, helps to streamline the creation and management of a Craft project's resources.
However, since DDEV relies on Docker to function, it might not be compatible with many Shared Hosting services, including ours. If you would like to use DDEV for Craft on our hosting services, you will need to use one of our VPS or Dedicated CPU solutions. With that said, you first have to install DDEV to utilize it. Fortunately, it is extremely easy to install a Docker provider and DDEV.
Once you have DDEV on your system, you can proceed with Craft. Firstly, create a directory for your project. While in this directory, it will in no way interact or interfere with any of your other applications or projects. It is isolated. You can use this command to create the directory, replacing "my-craft-project" with the name of your own project.
mkdir my-craft-project
Next, enter that directory and create the DDEV configuration files.
ddev config --project-type=craftcms --docroot=web --php-version=8.2
After that, scaffold the project from the official starter project.
ddev composer create -y --no-scripts "craftcms/craft"
Finally, run the Craft installer. During the setup, you will be prompted to enter certain values for your application (name, URL, admin name, admin password, etc.), and you can either accept the defaults that appear in square brackets or input your own.
ddev craft install
Finally, run this command to start Craft.
ddev launch
When you open the application in your browser you will see Craft CMS's welcome screen if everything was installed correctly.
And there you have it: Craft was successfully installed.
If you would like not to use Docker and DDEV, you can install Craft via Composer just as easily. Before you do that, we recommend you create a database and a user, as you will need them. You don't even need to create a directory for your project, as the command you have to run will do it for you!
composer create-project craftcms/craft my-craft-project
Once more, replace "my-craft-project" with the name of your project. The command will download the latest versions of all necessary files and then prompt you to begin the installation setup. You can either accept the default values or input your own.
Here, you can put the database, username, and password you created earlier. If everything is in order, the installation will conclude successfully, and it is time to open the project in your browser! To do so, go to your domain and append it with /web/index.php. For example, https://domain.com/web/index.php. You will see the welcome page again.
You have to use /web/index.php because that is the entry script for web requests. In other words, it is how your browser finds the correct way to open the application.
And there you have it! You have successfully installed Craft CMS! Easy, wasn't it?