Silverstripe is an open source web content management system (CMS) that is both easy to develop and use by content editors and site administrators. It has a modern architecture which uses a PHP 5 based programming framework that makes it very flexible to customize.
In this tutorial, we will see how to install Silverstripe on our VPS running Ubuntu. If you want to follow along, you will need your own VPS set up with Ubuntu and the LAMP stack (Linux, Apache, MySQL and PHP), the preferred web server solution for Silverstripe.
Silverstripe requires PHP 5.3.2+, a web server such as Apache, Lighttpd or IIS and MySQL 5.0+, PostgreSQL 8.3+ or SQL Server 2008+ for the database.
Before we get on with the installation, there are a couple of things we need to take care of. First, we have to make sure mod_rewrite is enabled in our Apache and that the virtual host allows .htaccess files to override Apache instructions. To check if the former is available, use the following command:
If you see "rewrite_module" in the list, you are fine. If not, use the following command to enable the module:
Next, edit the Apache default virtual host file and make sure that Allow Overrides is set to All under the /var/www directory. Edit the file with the following command:
And where you see this block, make the changes to correspond to the following.
<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
We’ll also have to set timezone for PHP. Edit the php.ini file:
And in this file where you see the following line:
Remove the preceding semi-colon and set a PHP type timezone in the following format:
date.timezone = America/Toronto
Save the file and exit.
Next up, let’s install the PHP-GD Graphics Library. You can quickly install it with the following commands:
apt-get update apt-get install php5-gd
After all these steps, or after any individual one you had to perform, give Apache a restart so they take effect:
sudo service apache2 restart
First thing we need to do is navigate into the web server root directory (/var/www):
Next thing we need to do is download the Silverstripe archive file. You can find the link to the stable release here: http://www.silverstripe.org/
Make sure you replace the link with the one you found. This will download the tarball that you need to untag:
tar -zxvf SilverStripe-cms-v3.0.5.tar.gz
Confirm again that you replaced the name of the file with the one you downloaded. This command will unpack the archive and create a new folder that you can rename to something more friendly (let's say silver):
mv SilverStripe-cms-v3.0.5 silver
Now that the application is in the silver folder, it’s time to set some permissions so that the web installer can do its job. Run the following commands to make the www-data group the owner of the required files and folders (make sure you run these commands from the application root folder - /var/www/silver):
chown -R root:www-data assets chown root:www-data .htaccess chown root:www-data mysite/_config.php
Now we have to make sure the groups can write in these files and folders:
chmod 775 -R assets chmod 775 .htaccess chmod 775 mysite/_config.php
This takes care of the permissions issue. Finally, we’ll have to create an empty database for Silverstripe to use. So in your MySQL terminal, run the following command to create a database called silver (name is your choice):
create database silver;
Then quit the MySQL terminal and head to your browser and point it to the site folder: your-ip-address/silver. Don’t worry if you see a problem with the database connection. That is because you haven’t specified the relevant information yet and it's what we will do now. Provide the information and re-check the requirements to make sure all is fine and you can continue.
Now go ahead and create your admin account on this page before clicking on the big install button which should then run the installer and redirect you to a success message page from where you can then access the homepage of your new site (at your-ip-address/silver).
But what if you want the site to be available at your domain name which is set to point to your web server's root folder (/var/www)? You have three choices - One: you can move all the Silverstripe related files to this folder, Two: you can change the webserver's root directory to point to the /var/www/silver folder instead of the default one, or Three: you can create a new virtual host for the domain name with that directory as its document root. The choice depends on your setup.
If you want to create a virtual host for the domain name, follow the instructions in this tutorial. But if you want to quickly change the default web server document root, open up again the file you edited before to allow the .htaccess overrides:
And change this line from this:
This is assuming that your Silverstripe site is in the silver folder.
And now you should be able to access your new site straight from your domain name that is set to use your VPS' default virtual host.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.Sign up