Keeping track of hundreds of different passwords for hundreds of different websites is not only a pain, but it leads to poor security practices. Protocols such as OAuth and OpenID have provided single sign-on support, which eventually expanded to use social media platforms such as LinkedIn, Twitter, and Facebook. Once you have single sign-on support across multiple websites and services, you have the added benefit of tracking users across platforms.
Janrain offers a single sign-on solution complete with customer identity and access-management tools. They offer a range of products, but in this tutorial we will show you how to deploy WordPress with the Janrain Engage plugin on CenturyLink Cloud services. This provides you with a solid base on which to build a cross-platform social media customer identity solution.
Before We Start
If you don’t have a CenturyLink Cloud account yet, head over to our website and sign up for a free trial. You’ll need it to use CenturyLink Cloud tools.
You will also need a Janrain account. Visit the Janrain sign-in page to create one.
CenturyLink Cloud Compute servers are high-performance cloud servers. These enterprise-grade virtual machines are easy to deploy and manage from the CenturyLink Cloud Console and via our powerful API.
CenturyLink Cloud MySQL is a cloud-hosted managed relational database solution. It is backed by 100% flash storage, and automatically scales to handle even the most demanding workloads.
Deploy a New Virtual Server
Our first step is to deploy a new CenturyLink Cloud virtual server. Follow the steps below.
- Log-in to the CenturyLink Cloud control portal at https://control.ctl.io/
On the left side menu, click Infrastructure and then Servers.
On the left-hand side of the server panel, click on the region for the server we will provision.
- Click create and then server.
- Fill out the form for your new server.
- For operating system, select "Ubuntu 16 | 64-bit".
- Click create server.
Your server provisioning request will enter the queue. You can watch the progress of your request on the screen. Your server is provisioned when the status of all tasks in the queue is complete.
After your new server is provisioned, in the CenturyLink control portal, click Infrastructure on the left side menu, then click Servers.
- Navigate to your new server and click on its name.
- Click the more menu, and then click add public ip.
- Check the boxes for HTTP (80) and SSH/SFTP (22).
- Click add public ip address.
Provision a CenturyLink MySQL Database
Next, we will provision a new CenturyLink Cloud MySQL database. Follow the steps below.
- Log-in to the CenturyLink Cloud control portal at https://control.ctl.io/
- On the left side menu, click Services and then Relational DB.
- On the "Database Instances" page, click + database.
In the "Create Database" form, select "MySQL" for the engine.
For "location", pick a data center close to the one you selected for your virtual server.
- For "database name", pick a name that makes sense, such as "wordpress". Save this name for later.
- Enter a new username and password into the "username" and "password" fields. Save these for later.
- You can change the rest of the parameters if your requirements call for them, but the defaults work just fine for this tutorial.
- Click Create Database.
- You will be redirected to the status page for your new database.
- Look for the "CONNECTION" value. This will contain the hostname and port for your database. Save this for later.
Installing and Configuring WordPress
This section is based on the WordPress Famous 5-Minute Install, but we will guide you through the configuration options for each step.
Creating a DNS Record for Your Virtual Server
To get Janrain and WordPress configured properly, you will need to create a DNS "A" record so you can refer to your server properly. There are too many ways to handle DNS configuration to cover in this tutorial, so we can't walk you through the whole process. However, you will need your virtual server's public IP address to configure DNS. Follow these steps to find it.
- Log into the CenturyLink Cloud control portal at https://control.ctl.io/
- On the left side menu, click Infrastructure, and then click Servers.
- Navigate to the virtual server you provisioned in the previous step and click on its name.
- On the right hand side of the server status page, look for IP ADDRESS(ES). Your server's public IP address will be underlined.
Preparing the Virtual Server and Getting Software
From a shell or terminal on your local machine, connect to your virtual server with the following command. Replace "YOUR.HOST.NAME" with your server's hostname.
Install the required Ubuntu packages with the following commands.
apt update apt-get install lamp-server^ postfix -y a2enmod rewrite service apache2 restart
Download and install the WordPress package.
wget -O wordpress.tar.gz https://wordpress.org/latest.tar.gz cd /var/www/html/ tar --strip-components=1 -xvzf ~/wordpress.tar.gz cp wp-config-sample.php wp-config.php rm index.html
Configuring the Database
Next, we need to prepare the CenturyLink Cloud MySQL database that we created earlier. For this step, you will need the following configuration values from the "Provision a CenturyLink MySQL Database" section.
- Hostname and port
From the shell prompt on your virtual server, run
ifconfigto get your server's private IP address. In the example below, it is "10.80.109.12", highlighted.
Run the following command to configure the database. Replace "CONNECTION_HOST", "CONNECTION_PORT", "USERNAME", and "PASSWORD" with the configuration values for your CenturyLink Cloud MySQL database.
mysql -h CONNECTION_HOST -P CONNECTION_PORT -u USERNAME -pPASSWORD
At the "mysql>" prompt, run the following commands. Replace "PRIVATE.VPS.IP" with your private IP address. Replace "USERNAME" and "PASSWORD" with the configuration values for your CenturyLink MySQL database. Each command should produce a "Query OK" response.
CREATE DATABASE wordpress; GRANT ALL PRIVILEGES ON wordpress.* TO 'USERNAME'@'PRIVATE.VPS.IP' IDENTIFIED BY 'PASSWORD'; FLUSH PRIVILEGES; EXIT
Setting Up wp-config.php
Next, we will configure WordPress to connect to the MySQL database we just created. The following commands will be run in the shell on your virtual server.
Run the following command to make sure you're in the correct directory.
In your favorite text editor, open wp-config.php. Look for the line that says
/** MySQL settings - You can get this info from your web host **/and edit the section under it to look like the following. Replace "CONNECTION_HOST", "CONNECTION_PORT", "USERNAME", and "PASSWORD" with the configuration values for your CenturyLink Cloud MySQL database.
/** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'USERNAME'); /** MySQL database password */ define('DB_PASSWORD', 'PASSWORD'); /** MySQL hostname */ define('DB_HOST', 'CONNECTION_HOST:CONNECTION_PORT'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', '');
Run the following commands to make sure permissions are set correctly and the web server is running.
chown -R www-data.www-data /var/www/html/ service apache2 restart
Finish WordPress Configuration
To finish the configuration of your new WordPress installation, follow these steps.
- In your web browser, go to "http://YOUR.HOST.NAME/". Replace "YOUR.HOST.NAME" with the IP address of your virtual server.
- Follow the rest of the configuration instructions on the screen.
Create a Janrain Engage Application
Before we add the WordPress plugin, we need to create a new Janrain Engage application to support social login. Follow these steps.
- Login to your Janrain dashboard at https://dashboard.janrain.com/
- Click + New Property.
Click Create an App next to "Engage".
Follow the instructions on the app creation wizard.
- When you are returned to your dashboard, click the "Manage Engage app" icon next to your new application.
- Take note of the "API Key (Secret)". You will need that value later.
- Add the hostname for your CenturyLink Cloud Compute virtual server to the "Domain Whitelist" box and click Save.
Add the Janrain Engage Plugin to WordPress
Finally, we will add the Janrain Engage plugin to your WordPress installation and configure it. Follow the steps below:
- Login to your WordPress control panel at http://YOUR.HOST.NAME/wp-admin/ -- replace "YOUR.HOST.NAME" with the hostname for your virtual server.
- In the left panel, click Plugins > Add New.
- In the search box, enter "RPX".
- You will see a list of plugins pop up. Under "Janrain Social Login", click Install Now.
- Once the installation is complete, click Activate.
- In the left panel, click Janrain Engage.
- On the "Janrain Engage Setup", enter your Janrain Engage application API Key into the "Engage API Key" box.
- Configure the rest of the plugin options to suit your requirements.
- Click Save Changes.
Your WordPress application will now have social login and registration for users. You can see it in action on the admin login form or on blog post comment forms.
Janrain offers a wide variety of powerful social user management tools. Once you have Janrain Engage working in WordPress, you can explore further integration in other applications. Leveraging the capabilities of the CenturyLink Cloud with social user management brings the full power of distributed cloud-based applications to your project.
We’re a different kind of cloud provider – let us show you why.