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 FreeBSD 11 FAMP VPS
-
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.
Prerequisites
- A clean Vultr Fedora 26 server instance with SSH access
Add a Sudo User
We will start by adding a new sudo
user.
First, log into your server as root
.
ssh root@YOUR_VULTR_IP_ADDRESS
Add a new user called user1
(or whatever name you prefer).
useradd user1
Next, set the password for the user1
user.
passwd user1
You will be prompted for a password, so enter a secure password and make sure you remember it.
Now check the sudoers
file to make sure that the sudoers group is enabled.
vi sudo
Look for a section like this.
%wheel ALL=(ALL) ALL
As long as it is uncommented, this tells us that users who are members of the wheel
group can use the sudo
command to gain root
privileges. If it is commented out, you will need to uncomment it and save the file by pressing the “Escape
” key (to enter command mode) and then typing :wq
(followed by “Enter
“) to write changes to the file and quit the editor.
Please note: If your default terminal editor is not set to vi
or vim
, you will need to use some alternative commands to save and exit the file.
Next, we need to add user1
to the wheel
group.
usermod -aG wheel user1
We can now use the su
command to switch to the new sudo user user1
account.
su - user1
The command prompt will update to show that you are logged into the user1
account, and you can verify this with the whoami
command.
whoami
Now restart the sshd
service so that you can login via ssh
with the new non-root sudo user account.
sudo systemctl restart sshd
Exit the user1
account.
exit
Exit the root
account (which will disconnect your ssh
session).
exit
You can now ssh
into the server from your local host using the new non-root sudo user user1
account.
ssh user1@YOUR_VULTR_IP_ADDRESS
Step 1: Update the Fedora System
Before installing any packages on the Fedora server instance, we will first update the system.
Make sure you are logged in to the server using a non-root sudo user and run the following command.
sudo dnf -y update
Step 2: Install Apache Web Server
Install the Apache web server.
sudo dnf -y install httpd
Then use the systemctl
command to start and enable Apache to execute automatically at boot time.
sudo systemctl enable httpd
sudo systemctl start httpd
We now need to make sure that the mod_rewrite
Apache module is loaded. We can do this by searching the Fedora Apache base modules configuration file for the term mod_rewrite
.
sudo vi /etc/httpd/conf.modules.d/00-base.conf
Search for the term mod_rewrite
in vi
by typing /mod_rewrite
in command-mode (after pressing the “escape
” key).
If the mod_rewrite
Apache module is loaded, the configuration line should look like this.
LoadModule rewrite_module modules/mod_rewrite.so
If the above line starts with a semi-colon, you will need to remove the semi-colon to uncomment the line and load the module. This, of course, applies to any other required Apache modules too.
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 now need to edit Apache’s default configuration file so that mod_rewrite
will work correctly with SilverStripe. So open the file.
sudo vi /etc/httpd/conf/httpd.conf
Then, find the section that starts with <Directory "/var/www/html">
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 "/var/www/html"
You can now save and close the Apache configuration file.
We now need to open the default HTTP
and HTTPS
ports as they will be blocked by firewalld
by default.
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=443/tcp
Reload firewalld
to apply the changes.
sudo firewall-cmd --reload
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 systemctl restart httpd
Step 3: Disable SELinux
SELinux stands for “Security Enhanced Linux”. It is a security enhancement to Linux which allows users and administrators more control over access control. It is enabled by default in Fedora 26, but it is definitely not essential for server security as many Linux server distributions do not ship with it installed or enabled by default.
To avoid file permission problems with SilverStripe CMS later down the line, we are going to disable SELinux, for now. Open the SELinux configuration file with your favorite terminal editor.
sudo vi /etc/selinux/config
And change SELINUX=enforcing
to SELINUX=disabled
, then save the file.
To apply the configuration change, SELinux requires a server reboot, so you can either restart the server using the Vultr control panel or you can simply use the shutdown
command.
sudo shutdown -r now
When the server reboots, your SSH session will get disconnected and you may see a message complaining about a 'broken pipe'
or informing you 'Connection closed by remote host'
. This is nothing to worry about, simply wait for 20 seconds or so and then SSH back in again (with your own username and domain).
ssh user1@example.net
Or (with your own username and IP address).
ssh user1@YOUR_VULTR_IP_ADDRESS
Once you have logged back in, you should check the status of SELinux with the sestatus
command to make sure it is properly disabled.
sudo sestatus
You should see a message saying SELinux status: disabled
. If you see a message saying SELinux status: enabled
(or something similar) you will need to repeat the steps above and ensure that you properly restart your server.
Step 4: Install PHP 7.1
We can now install PHP 7.1 along with the necessary PHP modules required by SilverStripe.
sudo dnf -y install php php-gd php-mbstring php-xml php-tidy php-mysqlnd
The date.timezone
configuration option in php.ini
must be set correctly. So open your php.ini
file with your favorite terminal editor.
sudo vi /etc/php.ini
Set the date.timezone
option to your preferred timezone. The correct setting for a London instance, for example, would look like this.
date.timezone = Europe/London
Step 5: Install MariaDB (MySQL) Server
Fedora 26 defaults to using MariaDB, which is an enhanced, fully open source, community developed, drop-in replacement for MySQL server.
Install MariaDB.
sudo dnf -y install mariadb-server
Start and enable MariaDB to execute automatically at boot time.
sudo systemctl enable mariadb
sudo systemctl start mariadb
And secure your MariaDB server installation.
sudo mysql_secure_installation
The root
password will be blank, so simply hit “enter
” when prompted for the root
password.
When prompted to create a MariaDB/MySQL root
user select “Y
” (for yes) and then enter a secure root
password. Simply answer “Y
” to all of the other yes/no questions as the default suggestions are the most secure options.
Step 6: 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 ss_data CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'ss_user'@'localhost' IDENTIFIED BY 'UltraSecurePassword';
GRANT ALL PRIVILEGES ON ss_data.* TO 'ss_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
You can replace the database name ss_data
and username ss_user
with something more to your liking, if you prefer. Also, make sure you change “UltraSecurePassword” to an actually secure password.
Step 7: Install Silverstripe CMS Files
Change your current working directory to the default web directory.
cd /var/www/html/
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.
pwd
We can 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
And change ownership of the web files to avoid permissions problems.
sudo chown -R apache:apache * .htaccess
Let’s restart Apache again.
sudo systemctl restart httpd
Now we’re ready to move on to the final step.
Step 8: Complete SilverStripe CMS Installation
It’s time to visit the IP address of your Fedora 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: ss_user
Database password: UltraSecurePassword
Database name: ss_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 of 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.
sudo rm install.php
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.
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 correctly.
Want to contribute?
You could earn up to $300 by adding new articles
Suggest an update
Request an article