Note: You are currently reading the documentation for Bolt 4.0. Looking for the documentation for Bolt 3.7 instead?
With the release of Bolt 4 stable, there will be a number of ways to install the application. For now, we recommend the composer create-project as the fastest way to get an installation of Bolt up and running. If you don't have composer yet, see [here][install-composer].
Note: This documentation makes the assumption that you're setting up Bolt on a local development machine. Not on the server where you intend to run a production website. If you do not have a local development environment, we recommend taking the time to set this up.
Set up a new Bolt 4 project, using the following command, replacing
myprojectname with your desired project's name.
composer create-project bolt/project myprojectname
Navigate into the newly created folder, and configure the database in
your environment variables, replacing
# SQLite (note: _three_ slashes) DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/bolt.sqlite # MYSQL / MariaDB #DATABASE_URL=mysql://db_user:"db_password"@localhost:3306/db_name # Postgres #DATABASE_URL=postgresql://db_user:"db_password"@localhost:5432/db_name?serverVersion=11"
You can read more information about configuring the database here.
After configuring the Database, run
bin/console bolt:setup. This will create
and initialise the Database for you, then lets you create the first (admin)
user, and add some dummy content ("fixtures") to the database.
Alternatively, run the following commands in sequence to do it step by step:
# In one go bin/console bolt:setup # As separate steps bin/console doctrine:database:create bin/console doctrine:schema:create bin/console bolt:add-user --admin bin/console doctrine:fixtures:load
Tip: Depending on your configuration and what webserver you're going to use, you might need to set some permissions on a number of files and folders. Read more about it on the File system permissions page.
Note: Make sure to create at least one
admin user, using either
bolt:setup or by adding
--admin flag to
bolt:add-user. Otherwise, you'll
only create a "regular" user that doesn't have administrative permissions, and
they won't be able to log into the backend.
Starting a webserver¶
You can run Bolt locally using the built-in webserver, Symfony CLI, Docker or your own preferred webserver. If you choose to set up a web server yourself, you can either set up something like Mamp, Xampp, Laragon or otherwise there's docs for Apache and Nginx.
Note: The folder you've just created has a
public/ folder. This is the actual web root of the site. If you're
not using one of the options below, but are configuring a webserver yourself,
make sure you use
public/ as the web root. Bolt does not
support putting all of its files inside the webroot itself, as that is
considered to be a bad practice.
Start PHP's built-in webserver…
or use the Symfony CLI (download here) …
symfony serve -d symfony open:local
or use Docker…
Finally, open the new installation in a browser. If you've used one of the commands above, you'll find the frontpage at http://127.0.0.1:8000/
The Bolt admin panel can be found at http://127.0.0.1:8000/bolt
Log in using the credentials you created when setting up the first user.