Sulu is a CMS based on Symfony. It's very flexible, can host multiple webspaces in one installation and can even run as a headless CMS. It is very extensible and has a simple user-interface. I'm going to use it for a new website, which is hosted on Uberspace. Uberspace is a great universal host with a command line first approach.

I wrote this installation guide for the Uberspace lab, but am going to publish it here, too.

Requirements

For this guide you should be familiar with the basic concepts of PHP, Mysql and Domains running on uberspace. Please refer to the Uberspace manual for further information.

We’re using PHP in the stable version 7.4:

[example@uberspace ~]$ uberspace tools version show php
Using 'PHP' version: '7.4'
[example@uberspace ~]$

You’ll need your MySQL credentials. Get them with my_print_defaults:

[example@uberspace ~]$ my_print_defaults client
--default-character-set=utf8mb4
--user=example
--password=MySuperSecretPassword
[example@uberspace ~]$

Your domain needs to be set up:

[example@uberspace ~]$ uberspace web domain list
example.uber.space
[example@uberspace ~]$

Installation

Since Sulu CMS uses the subdirectory public/ as document root of your website you should not install Sulu in your default Uberspace DocumentRoot. Instead, we install it next to that and then use a symlink to make it accessible to the web.

cd to one level above your DocumentRoot, then use the PHP Dependency Manager Composer to create a new project based on the Sulu Skeleton.

Note: Replace sulucms in the examples with your desired name for the directory/database.

[example@uberspace ~]$ cd /var/www/virtual/$USER/
[example@uberspace example]$ composer create-project sulu/skeleton sulucms
Creating a "sulu/skeleton" project at "./sulucms"
Installing sulu/skeleton (2.0.7)
  - Installing sulu/skeleton (2.0.7): Loading from cache
Created project in /var/www/virtual/ckrack/sulucms
[…]
[example@uberspace example]$

Remove your empty DocumentRoot and create a new symbolic link to the sulucms/public directory.

Warning: Make sure html is empty before deleting it. If there are any files you want to keep in html, you can also rename the folder instead of deleting it.

[example@uberspace example]$ rmdir html
[example@uberspace example]$ ln -s /var/www/virtual/$USER/sulucms/public html
[example@uberspace example]$ cd ~
[example@uberspace ~]$

Configuration

During the setup process you need to configure an .env.local file with database credentials. We suggest you use an additional database for Sulu CMS to save your data. You have to create this database first using the following command.

[example@uberspace ~]$ mysql -e "CREATE DATABASE ${USER}_sulucms"
[example@uberspace ~]$

Note: As uberspace uses MariaDb, you need to find the version and prefix the serverVersion with mariadb.

[example@uberspace ~]$ mysql -e "SELECT VERSION()"
 +-----------------+
 | VERSION()       |
 +-----------------+
 | 10.3.22-MariaDB |
 +-----------------+
[example@uberspace ~]$

Review the sample configuration file .../sulucms/.env. Then edit the .env.local file and change the values of APP_ENV and DATABASE_URL, to reflect your MySQL credentials and save the file.

APP_ENV=prod
DATABASE_URL=mysql://example:MySuperSecretPassword@localhost/example_sulucms?serverVersion=mariadb-10.3.22

When you’re done with the configuration, populate the database with Sulu’s default data by following the build walkthrough.

[example@uberspace ~]$ cd /var/www/virtual/$USER/sulucms
[example@uberspace sulucms]$ ./bin/adminconsole sulu:build prod
Build Targets
=============

+---+--------------------+-----------------------------------------------------------------+
| # | Builder            | Deps                                                            |
+---+--------------------+-----------------------------------------------------------------+
| 0 | database           |                                                                 |
| 1 | phpcr              | database                                                        |
| 2 | fixtures           | database, phpcr                                                 |
| 3 | phpcr_migrations   | phpcr                                                           |
| 4 | system_collections | database, fixtures                                              |
| 5 | prod               | database, phpcr, fixtures, phpcr_migrations, system_collections |
+---+--------------------+-----------------------------------------------------------------+

Options:

- nodeps: false
- destroy: false
- help: false
- quiet: false
- verbose: false
- version: false
- ansi: false
- no-ansi: false
- no-interaction: false
- env: 'prod'
- no-debug: false

Look good? (y)y
[…]
[example@uberspace ~]$

Sulu will create the database schema and populate it with sample data for the skeleton.

Finishing installation

Before we can login, we must create a security role and a first user.

[example@uberspace ~]$ cd /var/www/virtual/$USER/sulucms
[example@uberspace sulucms]$ ./bin/adminconsole sulu:security:role:create
Please choose a rolename: admin
Please choose a system:
[0] Sulu
> 0
Created role "admin" in system "Sulu".
[example@uberspace sulucms]$ ./bin/adminconsole sulu:security:user:create
Please choose a username: example
Please choose a FirstName: example
Please choose a LastName: example
Please choose a Email: example@uberspace.uberspace.de
Please choose a locale
  [0] de
  [1] en
 > 1
Please choose a role:
  [0] admin
 > 0
Please choose a Password:
Created user "example" in role "admin"
[example@uberspace sulucms]$

To finish the installation you need to point your browser to the sulu administration on your domain (e.g. https://example.uber.space/admin/) and login.

Best practices

To develop your website, you need to setup a webspace and templates for the pages - Sulu CMS comes as a bare system without any theming. Find out more about the concepts in the Sulu documentation.

You probably want to develop your templates locally on your machine. It’s recommended to initialize a git repository, add a remote and clone from the remote to your machine.