Using a Different System?
-
How to Install SilverStripe CMS on a CentOS 7 LAMP VPS
-
How to Install SilverStripe CMS on a Debian 9 LAMP VPS
-
How to Install SilverStripe CMS on a Fedora 26 LAMP VPS
-
How to Install SilverStripe CMS on an Ubuntu 16.04 LAMP VPS
SilverStripe is a flexible and extensible, 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.
Prerequisites
- A clean Vultr FreeBSD 11 server instance with SSH access
- A non-root sudo user
Step 1: Update FreeBSD System
Before installing any packages on the FreeBSD 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 freebsd-update fetch
sudo freebsd-update install
sudo pkg update
sudo pkg upgrade
Step 2: Install Apache Web Server
Install the Apache 2.4 web server.
sudo pkg install apache24
And enter “y
” when prompted.
We can now use the sysrc
command to enable the Apache service to execute automatically at boot time.
sudo sysrc apache24_enable=yes
This command updates the /etc/rc.conf
configuration file, so if you want to verify the configuration update manually, you can simply open the /etc/rc.conf
file with your favorite terminal editor.
vi /etc/rc.conf
Note: You can quit vi
by pressing the “Escape
” key (to enter command mode) and typing :q
to quit. If you have edited the file manually and you want to save the changes, you should type :wq
to write the changes to the file and quit. On the other hand, if you have edited the file, but you want to discard the changes, you should simply type :q!
.
Now start the Apache service.
sudo service apache24 start
You can quickly check that apache is running by visiting the IP address or domain of the server instance in your browser.
http://YOUR_VULTR_IP_ADDRESS/
You should see the default FreeBSD Apache page displaying the following text.
It works!
We now need to enable the mod_rewrite
Apache module. We can do this by searching the default Apache configuration file for the term mod_rewrite
. So, first open the Apache configuration file.
sudo vi /usr/local/etc/apache24/httpd.conf
Search for the term mod_rewrite
in vi
by typing /mod_rewrite
in command-mode (after pressing the “escape
” key):
By default, the mod_rewrite
Apache module will be commented out (which means it is disabled). The configuration line on a fresh FreeBSD 11 install will look like this.
#LoadModule rewrite_module libexec/apache24/mod_rewrite.so
Simply remove the hash symbol to uncomment the line and load the module. This, of course, applies to any other required Apache modules too.
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
We now need to edit The Directory
Apache directive in the same configuration file so that mod_rewrite
will work correctly with SilverStripe.
Find the section of the configuration file that starts with <Directory "/usr/local/www/apache24/data">
and change AllowOverride none
to AllowOverride All
. The end result (with all comments removed) should look something like this.
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Also, ensure that your DocumentRoot
directive points to the correct directory. It should look like this.
DocumentRoot "/usr/local/www/apache24/data"
If you’re using the vi
editor you can save the file by pressing the “Escape
” key (to enter command mode) and then type :wq
to write any changes to the file and quit the editor.
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 apache24 restart
Step 3: Install PHP 7.1
Install the latest version of PHP along with the PHP modules required by SilverStripe.
sudo pkg install php71 mod_php71 php71-gd php71-mbstring php71-mysqli php71-xml php71-curl php71-tidy php71-ctype php71-tokenizer php71-simplexml php71-dom php71-session php71-iconv php71-hash php71-json php71-fileinfo
Please note: If you are using a later version of PHP such as PHP 7.2, 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.2 you would probably change the module php71-gd
to php72-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.
FreeBSD 11 gives us the option to use a development php.ini
or a production php.ini
. Since we are going to install Silverstripe on a public web server, we’ll use the production version. First, back up php.ini-production
.
sudo cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini-production.bakup
And then soft-link php.ini-production
to php.ini
.
sudo ln -s /usr/local/etc/php.ini-production /usr/local/etc/php.ini
The date.timezone
configuration option in php.ini
must be set correctly. So open the php.ini
file with your favorite terminal editor.
sudo vi /usr/local/etc/php.ini
Set the date.timezone
option to your preferred timezone. The correct setting for a London instance, for example, will look like this.
date.timezone = Europe/London
Once the timezone is set you can save and close php.ini
.
We now need to configure Apache to actually use PHP, so let’s create a new file called php.conf
in the Apache Includes
Directory.
sudo vi /usr/local/etc/apache24/Includes/php.conf
Enter the following text in to the newly created file.
<IfModule dir_module>
DirectoryIndex index.php index.html
<FilesMatch "/.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "/.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
</IfModule>
And save the file.
Now, let’s restart Apache again.
sudo service apache24 restart
Step 4: Install MariaDB (MySQL) Server
FreeBSD 11 defaults to using MariaDB, which is an enhanced, fully open source, community developed, drop-in replacement for MySQL server.
Install the latest version of MariaDB.
sudo pkg install mariadb102-server mariadb102-client
Start and enable MariaDB to execute automatically at boot time.
sudo sysrc mysql_enable="yes"
sudo service mysql-server start
Secure your MariaDB installation.
sudo mysql_secure_installation
When prompted, make sure you enter a password for the MariaDB/MySQL root
user, and then simply answer “Y
” to all of the yes/no questions.
Step 5: Create a Database for SilverStripe
Log into the MariaDB shell as the MariaDB root
user by running the following command.
sudo mysql -u root -p
To access the MariaDB command prompt, simply enter the MariaDB root
password when prompted.
Run the following queries to create a MariaDB 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.
cd /usr/local/www/apache24/data
And use wget
to easily 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 definitely 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.
ls -la
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:www * .htaccess
Let’s restart Apache once more.
sudo service apache24 restart
And 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 FreeBSD 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: my_email@example.net
Password: AnotherUltraSecurePassword
Default language: English UK
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 the following.
sudo rm install.php index.html
That should do the trick. After that little fix, you can simply refresh the warning page in your browser and you will be good to go.
If you haven’t already set up your Vultr DNS, then that should probably be your next step.
Now you can 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.
Want to contribute?
You could earn up to $300 by adding new articles
Suggest an update
Request an article