How to Install SilverStripe CMS on Ubuntu 18.04 LTS
SilverStripe is a free, open source, secure and flexible CMS written in PHP language that can help you to create and manage the content of your websites and web applications. SilverStripe provides web-based administration panel that allows us to modify the part of the website. It comes with lots of features, some of them are listed below:
- Provides an extensible web-based interface.
- Optimizations for heavy loads.
- Supports Linux, Windows and Mac.
- Automated cache management system.
- Works on smartphones, tablets, and desktop computers.
- Supports multiple languages.
In this tutorial, we will learn how to install SilverStripe CMS on Ubuntu 18.04 (Bionic Beaver).
Requirements
- A server running Ubuntu 18.04.
- A non-root user with sudo privilegs.
Install LAMP Server
Before starting, you will need to install Apache web server, PHP and MariaDB to your system. You can install all of them by just running the following command:
sudo apt-get install apache2 libapache2-mod-php7.2 mariadb-server mariadb-client php7.2-curl php7.2-xml php7.2-soap php7.2-xmlrpc php7.2-gd php7.2-mbstring php7.2-intl php7.2-mysql php7.2-zip php7.2-tidy -y
Once all the packages are installed, start Apache and MariaDB service and enable them to start on boot with the following command:
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mariadb
sudo systemctl enable mariadb
Next, you will need to make some changes in php.ini file.
sudo nano /etc/php/7.2/apache2/php.ini
Make the following changes:
file_uploads = On allow_url_fopen = On memory_limit = 256M upload_max_file_size = 128M max_execution_time = 360 date.timezone = Asia/Kolkata
Save and close the file when you are finished.
Configure MariaDB
By default, MariaDB is not secured, so you will need to secure it first. You can do this by running the following command:
sudo mysql_secure_installation
Answer all the questions as shown below:
Enter current password for root (enter for none): Just press the Enter Set root password? [Y/n]: n 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
Once the MariaDB is secured, log in to MariaDB shell:
mysql -u root -p
Enter your root password, then create a database for SilverStripe:
MariaDB [(none)]> CREATE DATABASE stripedb;
Next, create a user for SilverStripe and grant privileges:
MariaDB [(none)]> CREATE USER ‘stripeuser’@’localhost’ IDENTIFIED BY ‘password’;
MariaDB [(none)]> GRANT ALL ON stripedb.* TO ‘stripeuser’@’localhost’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
Next, flush the privileges with the following command:
MariaDB [(none)]> FLUSH PRIVILEGES;
Finally, exit from the MariaDB shell:
MariaDB [(none)]> exit;
Install SilverStripe CMS
First, you will need to download the latest version of the SilverStripe. You can download it with the following command:
wget https://silverstripe-ssorg-releases.s3.amazonaws.com/sssites-ssorg-prod/assets/releases/SilverStripe-cms-v4.0.1.zip
Once the download is completed, extract the downloaded file to the Apache web root directory with the following command:
sudo unzip SilverStripe-cms-v4.0.1.zip -d /var/www/html/silverstripe
Next, give proper permissions to the silverstripe directory:
sudo chown -R www-data:www-data /var/www/html/silverstripe/
sudo chmod -R 755 /var/www/html/silverstripe/
Next, you will need to create an apache virtual host directive for silverstripe. You can do this with the following command:
sudo nano /etc/apache2/sites-available/silverstripe.conf
Add the following lines:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/silverstripe ServerName example.com ServerAlias www.example.com <Directory /var/www/html/silverstripe/> Options +FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Save and close the file, then enable apache virtual host with the following command:
sudo a2ensite silverstripe.conf
Next, enable Apache rewrite module and restart Apache with the following command:
sudo a2enmod rewrite
sudo systemctl restart apache2
Access SilverStripe CMS
Now, SilverStripe CMS is installed, it’s time to access SilverStripe web interface.
Open your web browser and type the URL http://example.com, you will be redirected to the following page:
Here, provide your database and admin username details, then click on the Install SilverStripe button. Once the installation is completed, you should see the following page:
Now, click on the “Click here to delete the install files”, You should see the following page:
Now, provide your login credential and click on the LOG IN button. You will be redirected to the SilverStripe CMS dashboard as shown below: