How to Install SilverStripe CMS on an Ubuntu 16.04 LAMP VPS
SilverStripe is a flexible and extensible free and open source enterprise-grade Content Management System (CMS) written in PHP. It is easy to use and learn, very robust and secure, has excellent reusable well-optimised and readable code, and includes a powerful templating engine that makes creating websites easy and fast.
- A clean Vultr Ubuntu 16.04 server instance with SSH access
- A non-root sudo user
Step 1: Update Ubuntu
Before installing any packages on the Ubuntu server instance, we will first update the system. Log in to the server using a non-root sudo user and run the following commands.
sudo apt-get update sudo apt-get -y upgrade
Step 2: Install Apache Web Server
Install the Apache2 web server.
sudo apt-get -y install apache2
And then use the
systemctl command to start and enable Apache to execute automatically at boot time.
sudo systemctl enable apache2 sudo systemctl start apache2
Now enable the
mod_rewrite Apache module.
sudo a2enmod rewrite
We now need to edit Apache's default site file so that
mod_rewrite will work correctly with SilverStripe. You can use any terminal editor for this.
sudo vi /etc/apache2/sites-enabled/000-default.conf
Now add the following
Directory Apache directives just before the closing
</VirtualHost> tag, so the end of your configuration file should look like this.
<Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>
The most important directive shown above is
Also, make sure your
DocumentRoot directive (which should be near the top of the file) points to the right place. It should look like this.
We will restart Apache at the end of this tutorial, but restarting Apache after any configuration change is certainly a good habit, so let's do it now.
sudo service apache2 restart
Step 3: Install PHP 7.0
Install the latest version of PHP along with the PHP modules required by SilverStripe.
sudo apt-get -y install php php7.0-gd php7.0-mbstring php7.0-mysql libapache2-mod-php php7.0-xml php7.0-curl php7.0-tidy
Please note: If you are using a later version of PHP such as PHP 7.1, you may need to alter the version numbers of the above PHP modules to match your version of PHP. So, for example, if you are using PHP 7.1 you would probably change the module
php7.1-gd. Please note that sometimes module names do change between versions, so if you experience any problems, simply visit the excellent PHP documentation site for guidance.
date.timezone configuration option in
php.ini must be set correctly. So open your
php.ini file with your favourite terminal editor.
sudo vi /etc/php/7.0/apache2/php.ini
date.timezone option to your preferred timezone.
date.timezone = Europe/London
Step 4: Install MySQL
sudo apt-get -y install mysql-server
During the MySQL server installation, make sure you enter a secure password for the MySQL
root user. This
root user is different from the
root user in Ubuntu as it is only used for connecting to your database server with full privileges.
Start and enable MySQL to execute automatically at boot time.
sudo systemctl enable mysql sudo systemctl start mysql
Secure your MySQL server installation.
When prompted, enter the password you created for the MYSQL
root user during installation and choose the security options appropriate for your particular use-case. Generally, choosing the most secure answers and answering "
Y" to all of the yes/no questions makes the most sense.
Step 5: Create a Database for SilverStripe
Log into the MySQL shell as the MySQL
root user by running the following command.
sudo mysql -u root -p
root password to log in.
Run the following queries to create a MySQL database and database user for SilverStripe.
CREATE DATABASE silverstripe_data CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER 'silverstripe_user'@'localhost' IDENTIFIED BY 'UltraSecurePassword'; GRANT ALL PRIVILEGES ON silverstripe_data.* TO 'silverstripe_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
You can replace the database name
silverstripe_data and username
silverstripe_user with something more to your liking, if you prefer. Be sure to change "
UltraSecurePassword" to an actually secure password.
Step 6: Install Silverstripe CMS Files
Change your current working directory to the default web directory.
If you get an error message saying something like
'No such file or directory' then try the following command.
cd /var/www/ ; sudo mkdir html ; cd html
Your current working directory should now be
/var/www/html/. You can check this with the
pwd (print working directory) command.
wget to download the SilverStripe CMS tarball.
sudo wget https://silverstripe-ssorg-releases.s3.amazonaws.com/sssites-ssorg-prod/assets/releases/SilverStripe-cms-v3.6.2.tar.gz
Please Note You should check for the most recent version by checking the SilverStripe download page. Simply right-click on the download button on the page and copy the URL. You can then paste the most up to date tarball URL into the
wget command shown above.
List the current directory to check we have successfully downloaded the file.
Now, uncompress the tarball.
sudo tar xvzf SilverStripe-cms-v3.6.2.tar.gz
Change ownership of the files to avoid permissions problems.
sudo chown -R www-data:www-data * .htaccess
Let's restart Apache again.
sudo service apache2 restart
Now we're ready to move on to the final step.
Step 7: Complete SilverStripe CMS Installation
It's time to visit the IP address of your Ubuntu server instance in your browser. Or, if you've already configured your Vultr DNS settings (and given it enough time to propagate) you can simply visit your domain instead.
Simply input the following database details (or your equivalent choices) into the SilverStripe installation page.
Database server: localhost Database username: silverstripe_user Database password: UltraSecurePassword Database name: silverstripe_data
Now fill in your email, password (to access the SilverStripe admin section), and set your default language.
Email: firstname.lastname@example.org Password: AnotherUltraSecurePassword Default language: English UK (in my case)
Once you have filled in all the necessary details, you can simply click on the
Install SilverStripe button and your new SilverStripe CMS will successfully install.
Please Note: You may get a warning about installation files not being removed. If that's the case, simply return to the terminal and run this.
sudo rm install.php index.html
And that should do the trick. After that little fix, you can simply refresh the warning page in your browser and you should be good to go.
If you haven't already set up your Vultr DNS, then that should probably be your next step.
You can now start adding your content and start configuring the look of your site. Be sure to check out the SilverStripe CMS User Help Guide for more guidance on how to build and configure your site.