Install SuluCMS on Ubuntu 16.04 | 18.04 Composer and PHP 7.2

SuluCMS, a simple and powerful open source content management system (CMS) based on Symfony for businesses and individuals to use to build beautiful and dynamic websites and apps…

If you are looking for a solution to build dynamic and beautify websites, then SuluCMS is a good place to start… It is built on an open source core with support for open standards, which might be very useful in helping you run your digital content…

This CMS platform is designed for ease of use to allow webmasters to collaborate and automate engaging experiences with users across multiple devices, including mobile…

For more about SuluCMS, please check their Homepage

This brief tutorial is going to show students and new users how to install SuluCMS on Ubuntu 16.04 / 18.10 and 18.04 LTS…

To get started with installing SuluCMS, follow the steps below:

Step 1: Install MariaDB Database Server

MariaDB database server is a great place to start when looking at open source database servers to use with SuluCMS… To install MariaDB run the commands below…

sudo apt-get install mariadb-server mariadb-client

After installing MariaDB, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots..

Run these on Ubuntu 16.04 LTS

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service

Run these on Ubuntu 18.04 and 18.10 LTS

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

After that, run the commands below to secure MariaDB server by creating a root password and disallowing remote root access.

sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]:  Y
  • Reload privilege tables now? [Y/n]:  Y

Restart MariaDB server

To test if MariaDB is installed, type the commands below to logon to MariaDB server

sudo mysql -u root -p

Then type the password you created above to sign on… if successful, you should see MariaDB welcome message

mariadb welcome

Step 2: Install PHP 7.2 and Related Modules

PHP 7.2 may not be available in Ubuntu default repositories… in order to install it, you will have to get it from third-party repositories.

Run the commands below to add the below third party repository to upgrade to PHP 7.2

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Then update and upgrade to PHP 7.2

sudo apt update

Next, run the commands below to install PHP 7.2 and related modules.

sudo apt install php7.2 php7.2-common php7.2-mbstring php7.2-mysql php7.2-gd php7.2-xml php7.2-curl php7.2-cli php7.2-zip

Step 3: Create SuluCMS Database

Now that you’ve installed all the packages that are required for SuluCMS to function, continue below to start configuring the servers. First run the commands below to create a blank SuluCMS database.

To logon to MariaDB database server, run the commands below.

sudo mysql -u root -p

Then create a database called suludb

CREATE DATABASE suludb;

Create a database user called suludbuser with new password

CREATE USER 'suludbuser'@'localhost' IDENTIFIED BY 'new_password_here';

Then grant the user full access to the database.

GRANT ALL ON suludb.* TO 'suludbuser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

Finally, save your changes and exit.

FLUSH PRIVILEGES;
EXIT;

Step 4: Download SuluCMS Latest Release

To get SuluCMS latest release you may want to use Github repository… Install Composer, Curl and other dependencies to get started…

sudo apt install curl git
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

After installing curl and Composer above, change into your home directory and download SuluCMS packages from Github via Composer…

cd ~/
composer create-project sulu/sulu-minimal sulucms -n
cd ~/sulucms
git init
git add .
git commit -m "Initial commit"

The content management part of Sulu is built upon webspaces. Each of these webspaces configure a content tree. Each content tree may contain translations for different locales.

The default webspace configuration is located in app/Resources/webspaces/example.com.xml. Rename this file so that it matches the name of your project.

Next, run the commands below to open the Sulu webspace example.com.xml file…

nano ~/sulucms/app/Resources/webspaces/example.com.xml

Then edit the highlighted lines below and save…

<?xml version="1.0" encoding="utf-8"?>
<webspace xmlns="http://schemas.sulu.io/webspace/webspace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.sulu.io/webspace/webspace http://s$

<name>sulucms</name>
<key>sulucms</key>

<localizations>
<localization language="en" default="true"/>
</localizations>

Save the file and exit…

After that, enter your database info into the database parameters file….

nano ~/sulucms/app/config/parameters.yml

then update the highlighted lines…

# This file is auto-generated during the composer install
parameters:
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: null
    database_name: suludb
    database_user: suludbuser
    database_password: suludbuser_password_here
    database_version: 5.5
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    secret: ThisTokenIsNotSoSecretChangeIt
    sulu_admin.name: Sulu
    sulu_admin.email: null
    websocket_port: 9876
    websocket_url: sulu.lo

Save the file and exit…

When you’re done with the configuration, populate the database with Sulu’s default data by running the commands below…

~/sulucms/bin/adminconsole sulu:build dev

Running the commands above will create a user account with admin and password admin

Now that the database is ready, we’ll fire up a server to try Sulu in the browser….

cd ~/sulucms
SYMFONY_ENV=dev bin/console server:start

When the server starts, open your browser and browse to the server IP address or hostname…

http://localhost:8000/admin

You should see SuluCMS logon page… type in the admin username and password:

Username: admin
Password: admin

SuluCMS Ubuntu Install

That’s it!

SuluCMS Ubuntu Install

Your Sulu website is ready now! Check out the administration, create pages and play around.

When you’re ready to learn more, continue with Creating a Page Template.

Enjoy~

You may also like the post below:

Setup wityCMS on Ubuntu 16.04 / 18.04 with Nginx, MariaDB and PHP 7.2-FPM

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.