Open Social is a distribution for building social communities and intranets. The distribution is positioned as the successor of Drupal Commons, taking full advantage of the new possibilities of Drupal 8.
In this article, i'll take you through the quick steps of installing Open Social and as a bonus, i'll show you how to setup and activate Facebook login.
Before we begin, you'll need Composer as this is the quickest to downloading all you require (core and modules) as well as any library dependencies required.
I had to install and setup Open Social for a client that was using A2Hosting on a shared hosting (yes, despite some complains i hear. Drupal 8 runs perfectly fine and is fast under this hosting environment. If people are having issues, that's because the hosting company they are using is terrible).
This article should work with any other standard shared hosting platform.
A2Hosting comes preinstall with Drush 8 and even though Open Social installation uses it to setup the finish part of the installation (setting up database), you don't really need to complete that stage. You can complete it via web browser.
To keep this article simple, we are going to install Open Social on A2Hosting.
At this stage, while you are logged into cPanel, we will setup a database to use. Click on 'MySQL databases' and setup your database. Write down your database credentials (DB name, DB username and DB password). You will need this for the final stage of running the installation process via web browser.
Once you are done, open up a terminal (command line) and ssh to your server using:
ssh -p 7822 email@example.com
Replace username with your user name (usually the one for your cpanel) and replace domain.com with your own website domain. You will then be asked for your password (usually password you use for cPanel). Also, the port number 7782 maybe different from your server setup. Please consult your hosting provider to find out.
Now we can install Composer locally on your server.
First, we configure your shell environment to use composer so the system knows where to execute composer. Type the following commands. Replace username with your account username:
echo 'alias composer="php -d allow_url_fopen=On /home/username/composer.phar"' >> ~/.bashrc source ~/.bashrc
If you are not sure about the complete path, type:
cd ~/ pwd
This will print out the full path.
To download the composer installer, type the following commands:
cd ~/ curl -k -O https://getcomposer.org/installer
Now we can install Composer, type:
php -d allow_url_fopen=On installer
You can confirm it is installed by running this command to check version:
That should print out the Composer's version info.
Later on, you may update Composer by running this command:
The full 'Howto install Composer' can be found at A2Hosting knowledge Base.
We can now install Drupal 8 with Open Social and any dependencies required.
To do this download the template json file and place this in your root directory, type:
cd ~/ wget https://raw.githubusercontent.com/goalgorilla/social_template/master/composer.json
This should download the composer.json file for you. This file is important, it helps to pull all the required files needed for the complete setup.
Ok, now let's run a command to tell Composer to install Open Social, type:
Note: I keep getting these warnings:
Deprecation Notice: The callback cweagans\Composer\Patches::postInstall declared at /home/username/vendor/cweagans/composer-patches/src/Patches.php accepts a Composer\Script\PackageEvent but post-package-install events use a Composer\Installer\PackageEvent instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes in phar:///home/username/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:320 Deprecation Notice: The callback cweagans\Composer\Patches::gatherPatches declared at /home/username/vendor/cweagans/composer-patches/src/Patches.php accepts a Composer\Script\PackageEvent but pre-package-install events use a Composer\Installer\PackageEvent instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes in phar:///home/username/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:320
If you get this as well, i think you can safely ignore it because it still installs all the libraries and files.
If you have gotten this far, go reward yourself with a nice cup of coffee or tea because the download will take awhile to complete...
Once completed, all the downloads should be installed into /public_html directory where your website is served from.
So the last part is to open up your web browser, type in your website domain. You should now see an installation page. Go through the installation process to complete your Open Social installation.
You will need your database login details. Remember you have already setup a new database in your cPanel so you should have the DB login details to use.
Well done! you can enjoy this wonderful distribution if you are setting up a social/community site.
UPDATE (22 Apr): I noticed that each time you need to update Opensocial, you need to download the composer.json file and overwrite previous one and run composer update command. Otherwise, it will not pick up any new updates. The composer.json file you need is at: https://github.com/goalgorilla/open_social
But we have one more final thing, setting up Facebook Connect so users can login to your site using their Facebook account.
Login to your new Open Social website with admin user.
Navigate to menu > configuration > Social API settings > User authentication (admin path: /admin/config/social-api/social-auth).
Click on 'Facebook' tab.
Go to https://developers.facebook.com/apps and signup and add the product 'Facebook Login'.
You can see your Application ID (App ID) and Application Secret (App secret) under your dashboard in FB app page. Copy these to your Facebook App settings on your website.
Check the 'Active' box and save your settings. Your FB Connect should now show on your signup/login page, like below:
But we are not finished yet. You will probably noticed that when you try to login using FB Connect on your website, you get an error message about the url domain.
To get the domain url, click on the FB Connect on your website and on the next page where the error occurs, copy the complete website address url. Copy this into 'Valid OAuth redirect URIs' field in your Facebook Login App page as shown below:
That's it! try the FB Connect on your website again. If everything is working, it should redirect you to Facebook sign in page to complete the process.