Tutorial

How To Install OctoberCMS on a VPS running Ubuntu 14.04

Published on May 28, 2014
How To Install OctoberCMS on a VPS running Ubuntu 14.04

About OctoberCMS

OctoberCMS is a relatively new open-source CMS based on the Laravel PHP framework. It has a number of attractive features – especially for developers – that can be explored by visiting this page.

In this tutorial we are going to install OctoberCMS on a VPS running Ubuntu 14.04. There are two ways you can install OctoberCMS: via the wizard and via the command line. We’ll look at installing it using the second method.

Requirements

To install OctoberCMS, you’ll need to meet a few system requirements. You’ll need to have the LAMP stack (Linux, Apache, MySQP, PHP) installed, but Nginx and Lighttpd are also acceptable web servers. The PHP version needs to be 5.4+ with safe_mode restrictions disabled. Ubuntu 14.04 comes with a version of PHP 5.5 so you shouldn’t have any problems with that.

You can read this great tutorial on how to install LAMP on Ubuntu 14.04 if you don’t already have it set up.

Since we are using Apache as a webserver and October can make use of URL rewriting, we’ll need to also make sure that Apache will in fact let it do that. If you haven’t already done the following steps, you’ll need to do them now.

Edit the virtual host file that is responsible for the folder where October will be installed (in our case, the default Apache document root: /var/www/html):

sudo nano /etc/apache2/sites-available/000-default.conf

Within the block contained by the starting:

<VirtualHost *:80>

Add the following block:

<Directory "/var/www/html">
    AllowOverride All
</Directory>

Next thing we need to do is enable mod_rewrite (again, if you don’t already have it enabled). To check if it’s already enabled, use the following command:

apache2ctl -M

If you see “rewrite_module” in the list, you are fine. If not, use the following command to enable the module:

a2enmod rewrite 

OctoberCMS also needs the cURL extension installed, so run the following command to do that:

sudo apt-get install curl php5-curl

Then you should restart the Apache server in order for the changes to take effect:

sudo service apache2 restart

Installation

For installing via the command line, we will need Composer. If you don’t know how to work with it, or have not yet set it up, consult this tutorial that will get you going. Additionally, you’ll need Git installed on the system; if you don’t already, go ahead and run this command:

sudo apt-get install git-core

Now we can proceed with the installation. I said above that we will install October in the Apache web root (/var/www/html). So first, remove all the files in that folder. This is of course only if OctoberCMS is the only application you want in the web server’s root folder. After you made sure you have the Composer.phar file in the /var/www folder and you navigate to it, run the following command:

php composer.phar create-project october/october html dev-master

What this will do is clone October from the repository and create a new project in the html/ folder.

Setup

The next thing we need to do is modify a few files. Open the app/config/app.php file and where you find this line:

'url' => 'http://yourwebsite.com'

Change the path to your own site. Let’s say http://example.com (for later referencing in this tutorial).

Additionally, you should also modify this line:

'key' => 'UNIQUE_ENCRYPTION_KEY'

In order to pick an encryption key October will use.

Optionally, editing the app/config/cms.php file will allow you to change what the theme of the site is, which modules are loaded, and even customize the URI of the backend.

Database

Next, let’s set up a database for October to use. I will guide you through some quick steps to set up your MySQL database, but there is a great tutorial here for more information.

The first thing you need to do is log in to mysql from your terminal (you can use PHPMyAdmin as well, but I will show you how to do it from the command line):

mysql -u username -ppassword

From there, run the following command to create a database called october:

create database october;

You can of course change its name to something else if you want. And that’s pretty much it. Next, edit the app/config/database.php file and under the MySQL connection block specify your database credentials where appropriate. Finally, it’s time to run the console command that will set up the October database:

php artisan october:up

Make sure you run this command from within the October root folder and if you get the following notice:

Mcrypt PHP extension required

Run the following command to install it:

sudo apt-get install php5-mcrypt

Then you’ll need to enable this extension manually. Edit the php.ini file:

vi /etc/php5/apache2/php.ini

And inside at the following line:

extension=mcrypt.so

Then navigate to /etc/php5/apache2 and if you do not have a conf.d folder in there, create one:

sudo mkdir conf.d

And inside that folder create a file called mcrypt.ini with the following content in it:

extension=mcrypt.so

Then create a link between that file and the available PHP modules by running this command:

sudo ln -s /etc/php5/apache2/conf.d/mcrypt.ini /etc/php5/mods-available

And enable the module:

sudo php5enmod mcrypt

Followed by restarting Apache:

sudo service apache2 restart

Creating the conf.d folder is necessary only if it’s not there already with the mcrypt.ini file (that you have to link to the available modules folder). If it’s already there, skip the step and perform the linking directly.

And now you can run the php artisan october:up command again to set up the database which should be successful.

Permissions

In order for OctoberCMS to run, some folders need to be writable by the web server. So let’s change their ownership to the www-data group which includes the www-data user (Apache) and make it so that this group can write in these folders.

sudo chown -R root:www-data app/storage
sudo chown -R root:www-data themes
sudo chown -R root:www-data uploads

sudo chmod -R 775 app/storage/
sudo chmod -R 775 themes
sudo chmod -R 775 uploads

Make sure you run these commands from within the OctoberCMS root folder and keep in mind that with this command we are making the owner of the files the root user. If you are using another user, just replace that username.

And that should be it. You can now navigate to http://example.com where you should see your brand new installation of OctoberCMS. To log in the backed at http://example.com/backend (by default), you can use the username admin and password admin.

<div class=“author”>Submitted by: <a href=“http://www.webomelette.com/”>Danny Sipos</a></div>

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
9 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

This comment has been deleted

    I installed octobercms on a virtual host and is working well after installation, but when I open http://october.app/backend link it displays a 404 error: “The requested URL /backend was not found on this server”.

    My mod_rewrite is enabled, I changed to “AllowOverride All” in my virtual host and I uncommented the "RewriteBase / " in my .htaccess

    Am I missing something? Can someone please help me?

    Can someone PLEASE help with URL rewriting for Nginx? Each time I paste the following text in the “server” section of the ‘default’ file (found in /sites-available), Nginx fails to start. If I remove the text then Nginx starts up just fine:

    location / { try_files $uri $uri/ /index.php$is_args$args; }

    rewrite ^themes/./(layouts|pages|partials)/..htm /index.php break; rewrite ^bootstrap/.* /index.php break; rewrite ^config/.* /index.php break; rewrite ^vendor/.* /index.php break; rewrite ^storage/cms/.* /index.php break; rewrite ^storage/logs/.* /index.php break; rewrite ^storage/framework/.* /index.php break; rewrite ^storage/temp/protected/.* /index.php break; rewrite ^storage/app/uploads/protected/.* /index.php break;

    Any ideas of exactly where it goes? I have my site installed in the default Nginx directory (/usr/share/nginx/html).

    first step, you need to fix locale. example for en_US. from root. # export LANGUAGE=en_US.UTF-8;export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; locale-gen en_US.UTF-8; dpkg-reconfigure locales

    \# reboot

    It is also good to mention, that after installation, you may want to update october through admin interface or install plugins. In order to do that, you have to give permissions to other folders and files.

    I basically added permissions to all files inside html with :

    sudo chmod -R 775 .
    sudo chown -R root:www-data .
    

    This may not be best practice, so maybe somebody could correct me…

    … I also had problem with composer error - lack of memory, so I made a swapfile according to this tutorial on Discourse

    hope this helps

    root@blackpearl:/var/www/pro/wick# php artisan october:up
    PHP Warning:  require(/var/www/pro/wick/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/pro/wick/bootstrap/autoload.php on line 17
    PHP Fatal error:  require(): Failed opening required '/var/www/pro/wick/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/pro/wick/bootstrap/autoload.php on line 17
    root@blackpearl:/var/www/pro/wick# config_templates.inc.php
    config_templates.inc.php: command not found
    root@blackpearl:/var/www/pro/wick# php -f /common/configs/config_templates.inc.php
    Could not open input file: /common/configs/config_templates.inc.php
    
    

    hi …I got some error line like this… can some body help me …thanks

    I keep getting issues with permissions using their. https://octobercms.com/docs/help/installation#wizard-installation

    Can someone put a chmod command that would help me here?

    I also get the same error, and I didn’t want to chmod anything I don’t have to.

    Currently I get around it by running artisan to update octoberCMS.

    php artisan plugin:install PLUGIN_NAME php artisan october:update

    After finishing all this, I’m getting an error when trying to attach a project and downloading plugins.

    Update failed "ZipArchive::extractTo(): Permission denied" on line 71 of /var/www/html/vendor/october/rain/src/Filesystem/Zip.php
    

    Looks like a permission issue? Thanks

    Try DigitalOcean for free

    Click below to sign up and get $200 of credit to try our products over 60 days!

    Sign up

    Join the Tech Talk
    Success! Thank you! Please check your email for further details.

    Please complete your information!

    Become a contributor for community

    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

    DigitalOcean Documentation

    Full documentation for every DigitalOcean product.

    Resources for startups and SMBs

    The Wave has everything you need to know about building a business, from raising funding to marketing your product.

    Get our newsletter

    Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

    New accounts only. By submitting your email you agree to our Privacy Policy

    The developer cloud

    Scale up as you grow — whether you're running one virtual machine or ten thousand.

    Get started for free

    Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

    *This promotional offer applies to new accounts only.