Copy WordPress Website for Staging

Owning a WordPress will for sure require some updates from time to time. Since the uptime of a website is important, it is recommended to update your staging environment before changing your website into a production website. This will help to avoid having to fix issues on your production website, and to have it down for an extended time. This article explains how to turn your staging website into a production website.

To achieve this, you will need:

– Access to cPanel account
– Shell access
– MySQL or MariaDB database
– A backup of your site and database in case of manipulation error


This article is for users who do not have WHM access. By having access to WHM, it would be easier to create a new cPanel user for the staging environment, than having it created into a sub-domain.


Prepare Staging Environment

1. Create a sub-domain into your cPanel account. To do this, log into your cPanel account, and click on “Subdomain“, which is found in the “DOMAINS” menu.


2. Under “Create a Sub-domain”, enter the desired sub-domain name, but do not specify the domain it self; that part will be filled automatically. Once done, click “Create“.


3. Go to MySQL Databases by clicking on cPanel Home > MySQL Databases.


4. Under “Create New Database”, enter the new database name, and clickCreate Database” to create the sub-domain database.


5. Once the new database is created, click on “Go Back” and scroll to MySQL Users. Select “Add New User”, specify the username and password, and then clickCreate User“.


6. Once the new username and password are created, click on “Go Back“, and scroll to “Add User To Database“. Select the corresponding user and database, and click “Add


7. Give the “Full Access” privileges to the new database using the new user, go to “Manage User Privileges” review the user and database, check “ALL PRIVILEGES”, and then click “Make Changes”.


Migrate Your Data

Now that the sub-domain environment has been configured and is ready, it’s now time to do a data migration.

1. Log into the shell access using SSH and do a copy of the current website you’re using. The copy will be done out of the public_html folder, and in this case, you will do the copy using sync. To do so, use the following syntax:

# rsync -a /home/CPANEL_USER/public_html/ /home/CPANEL_USER/SUBDOMAIN_PREFIX/

2. Move the website copy into the right directory of the new sub-domain.

# rsync -a /home/CPANEL_USER/SUBDOMAIN_PREFIX/ /home/CPANEL_USER/public_html/SUBDOMAIN_PREFIX/

3. Do a dump of your current site database. To find the databasename, database user, and password, check in the wp-config.php file.

# mysqldump -u­ DB_USER -p DATABASE_NAME > DUMP_FILE_NAME.sql

4. Restore the dump of the database onto the new sub-domain WP database.

# mysql -u NEW_DB_USER -p NEW_DATABASE_NAME < DUMP_FILE_NAME.sql

5. Update the file wp-config.php located in the sub-domain folder, to match the new database name, database user, and password. Look for the following lines :

define( 'DB_NAME', 'NEW_DB_NAME_HERE' );
define( 'DB_USER', 'NEW_DB_USER_HERE' );
define( 'DB_PASSWORD', 'NEW_DB_PASSWORD_HERE' );

6. At this point, the database in the newly installed sub-domain WordPress still has the original site URL hard-coded into it. This has to be updated with the sub-domain URL. The fastest way to do it would be to change it into the database directly. You will need to first determine your WordPress database prefix, which can be found into the wp-config.php file.

$table_prefix = 'wp_';

7. Update the site URL into the sub-domain WordPress database.

# mysql -u NEW_DB_USER -p NEW_DATABASE_NAME
* Enter the database password

# mysql> UPDATE wp_options SET option_value = replace(option_value, 'ORIGNAL.DOMAIN', 'SUBDOMAIN-PREFIX.ORIGNAL.DOMAIN') WHERE option_name = 'home' OR option_name = 'siteurl';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0

# mysql> UPDATE wp_posts SET guid = replace(guid, 'ORIGNAL.DOMAIN', 'SUBDOMAIN-PREFIX.ORIGNAL.DOMAIN');
Query OK, 0 rows affected (0.02 sec)
Rows matched: 964 Changed: 0 Warnings: 0

# mysql> UPDATE wp_posts SET post_content = replace(post_content, 'ORIGNAL.DOMAIN', 'SUBDOMAIN-PREFIX.ORIGNAL.DOMAIN');
Query OK, 0 rows affected (0.05 sec)
Rows matched: 964 Changed: 0 Warnings: 0

# mysql> UPDATE wp_postmeta SET meta_value = replace(meta_value, 'ORIGNAL.DOMAIN', 'SUBDOMAIN-PREFIX.ORIGNAL.DOMAIN');
Query OK, 0 rows affected (0.01 sec)
Rows matched: 686 Changed: 0 Warnings: 0

Test Your Sub-domain Website

Having migrated the data, it’s now time to test your site for any errors. Take a look at php.ini, .user.ini, or any other files of that kind, which may have a hard-coded path. At this point, the WordPress site under the sub-domain may be working already. If it is not working, then any of the following two major things may be the cause:

1. Some URL are hard coded into the files into directory /home/CPANEL_USER/SUBDOMAIN_PREFIX/. This can be fixed by doing a replace into all files that are into that specific directory. The following command syntax may be used to do so:

# find /home/CPANEL_USER/SUBDOMAIN_PREFIX/ -type f -exec sed -i 's#ORIGNAL.DOMAIN#SUBDOMAIN-PREFIX.ORIGNAL.DOMAIN#g' {} +

2. Some PATH are hard coded into the files into directory /home/CPANEL_USER/SUBDOMAIN_PREFIX/. This can be fixed by doing a replace into all files that are into that specific directory. The following command syntax may be used to do so:

# find /home/CPANEL_USER/SUBDOMAIN_PREFIX/ -type f -exec sed -i 's#/home/CPANEL_USER/public_html#/home/CPANEL_USER/public_html/SUBDOMAIN_PREFIX#g' {} +

Hopefully, after all this hard work, the WordPress that has been copied into the sub-domain should be working correctly, just as the original site. If you’re still experiencing issues, check the error_log file in the sub-domain directory; it may give more details about any errors.

Need help with the above kind of operation? Being a customer of Globo.Tech, you can contact our support department for just that. Our highly technical staff would be glad to assist you.

Email Deliverability from cPanel

One of the most important thing for day to day business is surely Email. And for that, cPanel have something special for you! Email Deliverability is one of the newest feature of cPanel, available from version 78. It’s designed to help users keep their legitimate emails out of Spam folders.

Using Email Deliverability in cPanel

If you’re running server sending out Emails, then it is vital to have proper configuration to have successful mail delivery. This means that it’s far more likely your emails can be successfully delivered for your daily customer. No one want a unhappy customer.

How Email Deliverability can help?

The new email deliverability feature, in cPanel, will help you to ensure that you have the technical elements in place. Which allow other email servers to recognise your domain as trustworthy.

Simply by opening the cPanel’s email deliverability function, it will automatically flags issues that could harm Emails deliverability. All that, by checking proper RDNS, DKIM and SPF configurations.

Mail Deliverability Main page

1. RDNS Configuration

The first section looks at your email related DNS records (RDNS). Naturally, cPanel can only analyse these if the system controls your mail related DNS records. If cPanel detects a problem with these records, then it will flag it up in this section. Under certain circumstances, you can choose to have cPanel repair the errors automatically, by prompting the modification needed. This allowing you to review and customise the changes that it is going to make before they are carried out.

Depending on your server, the repair process can take up to five minutes. You can only update one domain record in the same zone at a time. However, if two domains have records in different zones, these can be updated simultaneously.

2. DKIM and SPF Configuration

The same setup is in place when it comes to managing your Domain Keys Identified Mail records (DKIM). Used by mail server, these records are used to identify trusted servers. Reducing the risk of Emails being caught in spam filters.

If you don’t have a DKIM record, the new cPanel interface can generate one for you. Treat this DKIM key with care though. Exposing it to others could allow them to send email in your name, harming your reputation as a safe and trustworthy sender.

Similar useful settings also exist to allow you to manage your server’s Sender Policy Framework (SPF).

What if the DNS are managed on a remote server?

In some case, the DNS may be managed from a remote server. Which means that cPanel won’t be able to handle the DNS changes for you, by using the repair function. In such scenario, the required configuration for DKIM and SPF will be prompted by cPanel. They will need to be manually updated into the proper DNS zone.

Overall, this new cPanel feature is undoubtedly a great way to handle the deliverability of your email at a glance. It allow to quickly identify, and resolve, any issues which may be impacting the success of your email delivery.

How to install LAMP on Ubuntu 18.04

LAMP is a software bundle that is an acronym of the primary or original open source products, which include a Linux operating system, an Apache server, a MySQL database, and utilizes the PHP programming language; the acronym originated from Linux, Apache, MySQL, and PHP. However, the stack has interchangeable options, such as another web server, scripting, or database options. Using open source software allows the stack to be customized in ways that benefit the user without fear of being locked into a specific vendor or software producer.

A commonly used iteration of Linux is Ubuntu, a user-friendly Linux-based operating system that new and experienced users often utilize. For this guide, Ubuntu 18.04 is being used, which is the current stable release.

Getting Started

To get started installing the stack, you will need a freshly installed virtual machine (VM) with root access; root access is used to engage in administrator level actions on the operating system.

Installing the Stack on Ubuntu

Make sure that your version of Ubuntu is the current stable release, 18.04, before proceeding with your stack installation. You can start by verifying that your system is up to date:
apt update && apt upgrade -y

Once complete, you will need to install tasksel:
apt install tasksel

After completing the tasksel installation, it’s time to install the lamp server package, which will include Apache 2.4, PHP 7.2, and MySQL 5.7:
tasksel install lamp-server

When finished, you will need to secure your MySQL installation, since there’s a blank password by default:
mysql_secure_installation

Securing your MySQL Deployment

It’s important to secure your MySQL server deployment, especially since it’s installed with a blank password by default. Once completed, you can connect to MySQL with a blank password and use the VALIDATE PASSWORD PLUGIN function to test passwords and help improve security.

The plugin helps you create passwords that are considered secure enough for the installation. You will be prompted to setup the VALIDATE PASSWORD PLUGIN, pressing “y” for ‘yes’ or any other key for ‘no’.

Once you select ‘yes,’ you will be prompted to set the root password, entering it twice for confirmation.

On the default setup, MySQL has an anonymous user account, which allows any user to log on without having a user account created. The anonymous user accounts allow for easier testing environments and easier installations, but they should be removed before placing your VM into production.

To remove anonymous users, there will be a prompt asking you to select “y” for ‘yes’ or any other key for ‘no.’ Make your selection of “y” and complete the removal when ready.

When setting up a stack installation with root access, it’s important to set up your root connection to connect from ‘localhost.’ Setting up the connection in this fashion keeps users from attempting to guess the password and connecting from unauthorized locations.

During setup, you will be prompted to “disallow root login remotely,” pressing “y” for ‘yes’ and any other key for ‘no.’ Select “y” to disallow remote root logins.

There is another default database, named ‘test,’ that can be accessed by anyone and should be removed before placing your database in production.

Similar to the other steps, you will be prompted to select “y” for ‘yes’ or any other key for ‘no.’ Select “y” and remove the test database.

Once the test database has been dropped and privileges are removed, you will be prompted to reload privilege tables to ensure that changes take effect immediately. You will be prompted to select “y” for ‘yes’ or any other key for ‘no.’ Select “y” and complete the table reload, making your changes take effect.

Conclusion

You’ve successfully completed installing your LAMP stack on a virtual machine running Ubuntu 18.04; you’re ready to move your installation into production. If you found this process guide helpful, please share it with other users engaging in a similar setup, and review our other guides for additional help and support.

How to Install VestaCP on Debian 9

Vesta control panel (often abbreviated as VestaCP) is an open source hosting control panel, allowing the user to manage websites, create email accounts, manage email accounts, manage FTP accounts, and more. During this guide, we will install VestaCP on Debian 9, which is a freely provided operating system designed to be similar to Unix systems and is a popular system used with cloud and dedicated server instances.

Getting Started

To get started installing VestaCP on Debian 9, you will need a node running Debian 9; you can choose to use a cloud server or dedicated server to host your node. Your node should be running the most up-to-date version of Debian 9.

Time to Install VestaCP on Debian 9

Now that you’ve selected your cloud or dedicated server, you’ve verified your node is running Debian 9, and you’ve confirmed Debian 9 is running the current software version, you’re ready to begin.

The first step is getting a Debian 9 minimal install on a virtual private server (VPS) or dedicated server.

Then it’s time to run the update for Debian 9 and reboot your node:
apt update && apt upgrade -y && reboot

Once the update is complete, you can download the VestaCP installation script:
curl -O http://vestacp.com/pub/vst-install.sh

After downloading the installation script, you can run it on your node:
bash vst-install.sh

If you need to customize your VestaCP installation, you can do so at https://vestacp.com/install/.

While running the installation script, you will be prompted to fill in the following questions with the appropriate answer:

Would you like to continue [y/n]: y
Please enter admin email address: your_email@email.com
Please enter FQDN hostname [vestacp]: server.example.com

The installation of VestaCP may take up to 15 minutes to complete.

Once the installation script completes, you may receive the following notification:
root is not in the sudoers file. This incident will be reported.
=======================================================
_| _| _|_|_|_| _|_|_| _|_|_|_|_| _|_|
_| _| _| _| _| _| _|
_| _| _|_|_| _|_| _| _|_|_|_|
_| _| _| _| _| _| _|
_| _|_|_|_| _|_|_| _| _| _|

You’ve completed the installation of VestaCP. You will receive a prompt with the username, password, and host once complete.

https://********:8083
username: admin
password: *******

You can now sign into your control panel and begin utilizing your VestaCP installation.

vestacp

Conclusion

Congratulations on completing your install of Vesta CP on Debian 9, you’re now ready to begin managing websites, email accounts, FTP accounts and more. If you found the use of this guide helpful in setting up your new control panel, please share it with other users engaging in the same setup process.

How To Configure Apache Virtual Hosts on Ubuntu 16

Virtual hosting is the technique of hosting multiple websites on one server. Virtual hosting enables efficient utilization of computing resources because the multiple websites share the computing resources of the host server. Apache is one of the most web servers in the world, and it provides a mechanism for enabling virtual hosting on a web server. Virtual hosting works by creating a directory for each domain/website and then redirecting visitors of a domain to that site’s specific directory. The whole process is handled transparently by Apache, and the user is not aware that the server is hosting other websites. Apache virtual hosting is very scalable and can be expanded to handle a large number of sites.

Getting started
To complete this walkthrough successfully the following are required:
• A node (Dedicated or Cloud Server) running Ubuntu 16
• All commands must be entered as root
Apache web server installed

Tutorial
This guide demonstrates how to implement virtual hosting for two domains, www.globo.tech and support.globo.tech, on a single server. The two domains can be substituted for any domain that you may use.

First, create the directories for each website in the /var/www directory using the following commands:
sudo mkdir -p /var/www/www.globo.tech
sudo mkdir -p /var/www/support.globo.tech
Next change the ownership of the directories so that the regular user can modify them:
sudo chown -R $USER:$USER /var/www/www.globo.tech
sudo chown -R $USER:$USER /var/www/support.globo.tech

Next change the permissions for the directories so that visitors to the site can have read access to the web pages:
sudo chmod -R 777 /var/www/www.globo.tech
sudo chmod -R 777 /var/www/support.globo.tech

The next step is creating a virtual host file for each website; this is accomplished by copying the default virtual host file and then editing it appropriately. Use the following commands to copy the default host file:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/www.globo.tech.conf
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/support.globo.tech.conf

The virtual host files have to be modified so that they can direct requests appropriately. Open the virtual host file for the www.globo.tech site using an editor of your choice. In this example nano has been used:

sudo nano /etc/apache2/sites-available/www.globo.tech.conf

Subsequently, add a directive for the ServerName, this is the domain for the website:

ServerName www.globo.tech

Next, modify the DocumentRoot directive so that it matches the directory that you have created for the website

DocumentRoot /var/www/www.global.tech

If the changes have been implemented correctly the virtual host file will look this:
<Virtualhost>
ServerAdmin webmaster@localhost
ServerName www.global.tech
DocumentRoot /var/www/www.global.tech
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</Virtualhost>

The same changes should be made for the support.global.tech website. Open the virtual host file using the following command:
sudo nano /etc/apache2/sites-available/support.globo.tech.conf

Alter the file so that it matches the following:
<Virtualhost>
ServerAdmin webmaster@localhost
ServerName support.global.tech
DocumentRoot /var/www/support.global.tech
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</Virtualhost>

The final step is for enabling the new virtual hosts and reloading the web server. Apache provides the a2ensite tool for enabling sites. Use the following commands to enable the two sites:
sudo a2ensite www.global.tech.conf
sudo a2ensite support.global.tech.conf

Finally, reload apache using the following command:
sudo systemctl restart apache2

Conclusion
You have now setup virtual hosting, and you can use your single server to serve two websites. You can experiment further by adding more sites to your server. If this walkthrough has assisted you, do not hesitate to share with other people.

How to Create a Package in WHM

WHM stands for Web Host Manager, which is a program designed for administrative access and management of the back end of an interface solution called cPanel. WHM provides the administrator with more control, more flexibility, and the ability to create or manage different cPanel instances. WHM provides users with a variety of tools that make administration more comfortable, which includes building or deleting cPanel accounts, managing sites, monitoring sites, configuring support requests, customization of the control panel and hosting solutions, and much more. Users should explore this solution when they need flexibility, more creative management solutions, and when they’re managing multiple sites.

Getting Started

To get started creating a package, you will need to have cPanel already setup. The goal of cPanel packages is to create an account with pre-selected settings and resources, which helps to speed up account creation without having to change settings each time a new account is created. Additionally, you will need to have a Linux-based hosting solution employed, since cPanel and the accompanying solutions are not designed for use on Windows instances.

If you’re unfamiliar with cPanel, it is an online web hosting control panel that is Linux-based, allowing the user to have a graphical interface, automation tools, and simplified management for web hosting options. The graphic user interface, often abbreviated GUI, provides a graphic and straightforward management console, similar to the point and click style of Windows systems. However, an interface like cPanel only works for Linux-based hosting solutions.

During this tutorial, a package named “unlimited” with the default resources was created, with a change to the Max Parked Domains and the Max Addon Domains; each of these options has been changed to unlimited.

Remember that many of the functions that exist in cPanel or the web hosting manager can require a more advanced understanding of the solution, and this means that the solution should be used on fresh installations that do not have a large amount of pre-existing configuration. Make sure to examine the needs of your server hosting solution before making your choice.

Creating packages in Web Hosting Manager

The first step in creating a package is logging into your WHM instance at the following address:
WHM

Once you’ve logged in, you can search at the top left search box for “package,” clicking on the option to “add a package” when you locate it:
Add Package

When selected, you can change the package’s name and the preferred resources and options for this creation, clicking “add” when complete:
Select Package - WHM
Package Settings - WHM

After your new package’s options have been selected and added, you can create new accounts using them:
Create New Account - WHM

Conclusion

Congratulations, you’ve successfully created a new package in WHM, giving you the ability to create new accounts with selected resources and options quickly. Make sure to remember the name you’ve assigned and you can always log back in and make changes to the preferred resources and options you selected. If you found this tutorial helpful, please share it with other users that are setting up packages in Web Hosting Manager.

How to Change a cPanel User Password

cPanel is a popular web hosting control panel, based on Linux, that gives users a graphic interface and automation tools; the use of cPanel helps simplify the web-hosting process that may be more time consuming or difficult without these tools. cPanel has been in existence for over 20 years and has become a popular option for administrators, end-users, and even resellers; cPanel can be useful for any of these user groups when it comes to managing the various aspects that come with website hosting and server administration.

cPanel also features command line tools and API-based tools that can be used to automate some standard processes for administrators.

Getting Started

To get started changing your cPanel user password, you will need to have cPanel already installed as a dedicated server or cloud server; it’s important to install cPanel on a fresh installation of an operating system with a minor amount of previous configurations.

How to Change a cPanel User Password

To change your cPanel user password, there are two different methods that can be explored. You may use the WHM (root) on port 2087 or the cPanel on port 2083 with the user.

Before choosing method one or method two, make sure to choose a strong password, featuring upper- and lower-case letters, numbers, and special characters; a strong password helps prevent malicious individuals from brute forcing your cPanel server.

Method 1

This method requires the use of WHM on port 2087.

Your first step in this method is logging in to the WHM using your root user credentials at https://x.x.x.x:2087.

WHM
WHM - Dashboard

Once logged in, search for “list accounts” on the top left search box, then click on “list accounts.”

WHM - Account List

Click on the + (plus) sign on the left of the account you’re changing the password for, then type the new password in the “change password” box.

WHM - Add

Click on the “change” prompt to complete your cPanel user password change.

WHM - Change Password

Method 2

This method requires changing the password through cPanel on port 2083.

First off, log in to your cPanel account at the following at https://x.x.x.x:2083.

cPanel

Once logged in, go to the bottom of the page, to the section titled “preferences,” then click on “password & security.”

cPanel - Preferences

On the password & security page, you will need to enter your current password and the new password. If you choose, you can have the password generator choose the password for you.

cPanel - Password Generator

After entering your current (old) password and the new password, you can click the “change your password now” option to complete the change.

cpanel user password

Please note: once completing the password change using cPanel on port 2083, you will be signed out and will need to log in with the new password to access cPanel again. Make sure you have taken note of your password before completing the change.

Conclusion

Congratulations, you’ve successfully seen two different methods to change your cPanel user password; one method uses root access through WHM and the other uses the cPanel account. Now you’re ready to log in with your new password, using cPanel as before but with a new, more secure password. If you found this guide helpful, please share it with other users pursuing the same process.

How to Install Joomla 3.7 on Ubuntu 17

Joomla! is a content management system (CMS), which is a system used for web publishing similar to other products like WordPress. Similar to other CMS, Joomla! is used to create a usable framework that encompasses page caching, printable page versions, news feeds, RSS feeds, blogs, search functions, and more; these are all functions used for standard web browsing.

After WordPress, Joomla! is considered the second most used CMS online, and has over 80 million downloads and roughly 7% of the market share for CMS. Joomla! was initially released in 2005, and is currently a free, open-source CMS that functions across multiple operating systems and platforms.

Install Joomla 3

Getting Started

When you’re ready to install Joomla 3.7, you will need to have a node available; your node can be on a Dedicated or a Cloud Server, whichever you choose or are comfortable using. This node should have Linux Ubuntu 17.04 installed, which is the operating system we’re using during this tutorial.

During this tutorial, Joomla! will be written as “Joomla” when referring to the specific release, Joomla 3.7. In other instances, Joomla! is the appropriate spelling.

Installing Joomla 3.7 on Ubuntu 17.04

The first step in almost any successful installation is updating the operating system, making sure recent patches or bug fixes are installed. You can update your Ubuntu 17.04 using the following command:
apt-get update && apt-get upgrade -y

After confirming your node is running the updated version of Ubuntu 17.04, it’s time to install the Apache web server:
apt-get install apache2 -y

Once installed, you can start the Apache service and then enable the Apache service on boot:
systemctl start apache2.service
systemctl enable apache2.service

Now that Apache has been installed and enabled during the system boot, you can proceed with installing the MySQL server and client:
apt-get install mysql-server mysql-client -y

When complete, you can then start the process to install Joomla 3.7 by creating the database and then the user for Joomla.
During this process, you will be creating the database “dbjoomla” for use during your installation:
mysql -u root -p
create database dbjoomla;
grant all on dbjoomla.* to 'userjoomla'@'localhost' identified by 'passjoomla';
flush all privileges;
exit

Now it’s time to install PHP on your node and then install the required modules for use with your Joomla 3.7 instance:
apt-get install php libapache2-mod-php php-mysql php-curl php-gd php-pear php-imagick php-imap php-mcrypt php-pspell php-tidy php-xmlrpc php-xml -y

After that completes, it’s finally time to download and install Joomla 3.7. You can start by downloading the Joomla files and then unzipping the files:
apt-get install unzip -y
wget https://downloads.joomla.org/cms/joomla3/3-7-5/Joomla_3-7.5-Stable-Full_Package.zip
rm -rf /var/www/html/index.html
unzip Joomla* -d /var/www/html

Once the download and unzip have completed, it’s time to change the permissions of the directory for the web server:
chown -R www-data:www-data /var/www/html
chmod -R 755 /var/www/html

When the permissions have been updated, it’s time to restart the web server:
systemctl restart apache2

You’re almost done, it’s time to finish the installation with information for the database, including the user and password information:
http://your_ip

Conclusion

Congratulations! You’ve completed the installation of Joomla 3.7 on your cloud server or dedicated server node running Ubuntu 17.04. In this tutorial, you’ve updated your operating system, installed an Apache web server, MySQL server and client, PHP modules, and then completed a Joomla installation; you’re ready to move your node into production. If you found this guide helpful, please share it with others pursuing the same setup.

GloboTech Communications is not affiliated with or endorsed by The Joomla! Project™. It is not supported or warranted by The Joomla Project or Open Source Matters. The Joomla!® name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.

Install & Configure Varnish Cache with Apache on Debian 9

Varnish Cache is an often used but not commonly known accelerator designed specifically for use with Hypertext Transfer Protocol, known by the abbreviation HTTP. As an HTTP accelerator, Varnish Cache works by taking information or data, storing it in a virtual memory cache, and then allowing the operating system to decide if information needs to be moved to more traditional storage. This alleviates the condition where the operating system continues to try and store tons of data on the disk itself. In practical use, Varnish Cache helps load web pages quicker when requested by a user.

configure varnish cache

Varnish Cache is open-source, meaning the software belongs to a family of free software licenses, allowing use and distribution with minimal restriction.

Getting Started

To install and configure Varnish Cache, a node with an updated Linux Debian 9 installation is required. Debian 9, sometimes called Debian Stretch, is a specific Linux-based operating system we’re using for this installation. Additionally, the node you choose may be cloud-based, or it can be hosted on a dedicated server.

Install and Configure Varnish Cache with Apache on Debian 9

Now that you’re chosen your node and have confirmed your node has Linux Debian 9 installed, we can setup Varnish Cache and Apache.

Installing Apache

Before we can install and configure Varnish Cache, we need to install Apache on your node. The first step in that process is updating the Apache package and the operating system:
apt update
apt upgrade

After the package is downloaded and the operating system is updated, install Apache 2.4:
apt -y install apache2

When the installation completes, it’s time to start and enable the Apache service:
systemctl enable apache2 && systemctl start apache2

If you have UFW enabled, you can utilize the commands below. If you do not have UFW enabled, skip the commands below:
ufw allow 80/tcp
ufw allow 443/tcp
ufw reload

Installing and Configuring Varnish Cache

With the Apache installation complete, it’s time to move onto Varnish Cache.

The first step is to download the GPG key and then add it:
curl -L https://packagecloud.io/varnishcache/varnish5/gpgkey | sudo apt-key add -

Next, the package repository requirements need to be installed:
apt install -y debian-archive-keyring apt-transport-https

Once complete, the repository needs to be added to the source list:
echo "deb https://packagecloud.io/varnishcache/varnish5/debian/ stretch main" > /etc/apt/sources.list.d/varnishcache5.list

The package manager will also need to be updated so that the new repository can be added:
apt update

Now that the repository has been installed and the necessary components are updated, Varnish Cache may be installed:
apt install -y varnish

With any installation, once complete, it’s important to check that the installed version matches what you anticipated. Check that Varnish Cache is installed and the proper version was installed:
varnishd -V

After confirming your installation, we can configure Varnish Cache to listen to port 80 by editing the following file, replacing port 6081 by port 80:
nano /lib/systemd/system/varnish.service

From:
ExecStart=/usr/sbin/varnishd -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m

To:
ExecStart=/usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m

Once the file has been edited, we need to reload the system daemon to update the file:
systemctl daemon-reload

When the reload is complete, the default configuration needs to be modified, telling the system where to redirect the received Varnish Cache requests:
nano /etc/varnish/default.vcl

backend default {
.host = "127.0.0.1";
.port = "8080";
}

Apache 2.4 will also need a slight modification, enabling it to listen on port 8080 instead of port 80:
nano /etc/apache2/ports.conf
Listen 8080

nano /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:8080>

Once the modification has been made, restart Apache 2.4 and Varnish Cache. When the restart completes, enable Varnish Cache:
systemctl restart apache2
systemctl restart varnish
systemctl enable varnish

Now it’s time to test Varnish Cache and Apache 2.4, ensuring both are functioning as expected:
curl -I http://127.0.0.1
HTTP/1.1 200 OK
Server: Apache/2.4.25 (Debian)
Vary: Accept-Encoding
Content-Type: text/html
X-Varnish: 2
Age: 0
Via: 1.1 varnish (Varnish/5.1)
ETag: W/"29cd-55771150d08a7-gzip"
Accept-Ranges: bytes
Connection: keep-alive

If necessary, the Varnish Cache stats can be checked using the following command:
varnishstat

Conclusion

Congratulations, you’ve successfully installed Apache 2.4 and the installed and configured Varnish Cache on your Linux Debian 9 node. This installation allows you to streamline your web page distribution, allowing users to access information quicker and more efficiently than before. If you found this guide helpful during your setup, or if you know of anyone else attempting the same installation, please share this with them.

How to Install WordPress on Ubuntu 17

WordPress is a commonly known and popular content management system (CMS), which means it is an application used to create and modify digitally created content. While WordPress has become the most popular option among users, many CMS feature similar features, such as search engine optimized web addresses, integrated help functions, compliance with accessibility requirements and more.

WordPress and other CMS also reduce the knowledge needed to create content, since they remove the code-from-scratch mentality of traditional websites. CMS also allows users to create a simple, unified feel across multiple pages, manage user permissions easily, and even save and revert to previous versions.

Getting Started

Before we jump into how to install WordPress, you need to make sure you’ve acquired at least one node, hosted on a cloud server or a dedicated server. This node will need to have Linux Ubuntu 17.04 LTS installed.

For this installation, you also need to ensure Secure Shell (SSH) root access is setup for your server. If you’re unfamiliar, SSH is a particular network protocol that’s used when executing services over an unsecured network. When using SSH, the implemented services are performed securely even without a secure network.

Tutorial

Installing WordPress

After setting up your cloud or dedicated server node, installing Ubuntu 17.04 LTS and confirming that you have SSH root access, it’s time to learn how to install WordPress on your node.

The first step in almost any successful installation is confirming that your software, or in this case server, is up to date. We’re going to verify that your server is running the most recent version of its’ software and that any necessary repositories are current:
apt-get update && apt-get upgrade -y

Once we’ve confirmed our server is updated, we need to go through the steps to create a functional LAMP setup, which means installing Linux, Apache, MySQL, and PHP. As we’ve already verified we have Linux Ubuntu 17.04 LTS installed, we’re going to proceed with installing Apache.

Installing Apache2

The following commands will allow you to gather the necessary repositories for the Apache2 installation:
apt-get install apache2 -y

After allowing the Apache2 installation scripts to finish processing, we need to confirm that the Apache2 service is correctly installed, running properly, and enabled at startup:
systemctl status apache2.service
systemctl enable apache2.service

If you encounter an issue with Apache2 not currently running, it may be started with the following command:
systemctl start apache2.service

Installing MySQL Server

We’ve confirmed Apache2 is installed and running, so it’s time to proceed with the MySQL server setup:
apt-get install mysql-server mysql-client -y

While you proceed with the MySQL server installation process, you will receive a prompt for the MySQL root password. Please make sure you save this password someplace safe since you will need it later during the setup.

Once the installation of the MySQL server has completed, you will want to make sure you secure the server using the following command:
mysql_secure_installation

Make sure to follow the prompts you receive, using the below answers to complete each prompt:

Enter password for user root: ENTER ROOT PASSWORD
Press y|Y for Yes, any other key for No: n
Change the password for root ? n
Remove anonymous users? y
Disallow root login remotely? y
Remove test database and access to it? y
Reload privilege tables now? y

Similar to the Apache2 setup, we need to confirm that MySQL is running and ensure that MySQL is setup to start on boot:
systemctl status mysql.service
systemctl enable mysql.service

Now that the Apache2 and MySQL server is installed on your node, it’s time to configure your MySQL credentials for the future WordPress setup. This step will require your MySQL root password from a few steps earlier:
mysql -u root -p

After signing into your MySQL instance, you need to create the wordpressdb database using the following command:
mysql> CREATE DATABASE wordpressdb;

Once created, run the following command to create a new user named “wpuser” with a new password. Then grant that user access to the wordpressdb database. During setup, it’s important to replace “type_new_password_here” with your chosen password:
mysql> GRANT ALL ON wordpressdb.* TO 'wpuser'@'localhost' IDENTIFIED BY 'type_new_password_here';

When your new user has been created, it’s important to reload the privileges for MySQL before leaving the console:
mysql> FLUSH PRIVILEGES;
mysql> exit

Installing PHP and Related Modules

We’ve completed the Apache2 and MySQL installations, so it’s time to proceed with installing PHP. Utilizing the below command, initiate the PHP installation:
apt-get install php libapache2-mod-php php-mysql php-curl php-gd php-pear php-imagick php-imap php-mcrypt php-recode php-tidy php-xmlrpc wget -y

Setting Up WordPress

Now that we’ve finished installing Apache2, MySQL, and PHP, it’s time to install the latest version of WordPress to your server:
cd /tmp/ && wget http://wordpress.org/latest.tar.gz

Once this completes, we need to extract the archive and then install the extracted archive under the apache vhost folder:
tar -xzvf latest.tar.gz
cp -R wordpress/* /var/www/html

After installing the extracted archive, it’s important to remove the default index page from Apache2:
rm -rf /var/www/html/index.html

Configuring WordPress

We’re getting close to finalizing your WordPress setup. Now we will copy the default configuration file example that’s provided by WordPress:

Once you’ve copied the default configuration file, you need to edit it to match the below setup:
nano /var/www/html/wp-config.php

According to what was created in the MySQL setup earlier, these are the areas that need modification:
define(‘DB_NAME’ => The database name we have created for this purpose, in our case: wordpressdb

define(‘DB_USER’ => The database user we have created to access this wordpressdb database

define(‘DB_PASSWORD’ => The database password we have created for this user (during: mysql> GRANT ALL ON wordpressdb.* TO ‘wpuser’@’localhost’ IDENTIFIED BY ‘type_new_password_here’; )

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpressdb');
/** MySQL database username */
define('DB_USER', 'wpuser');
/** MySQL database password */
define('DB_PASSWORD', 'type_new_password_here');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** 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', '');

Then you may save and close the editor.

Now that you’ve edited the WordPress config file with new settings, it’s time to change the Apache2 directory permissions and enable Apache-Modules, which allows WordPress to function properly:
chown -R www-data:www-data /var/www/html/
chmod -R 755 /var/www/html/
a2enmod headers
a2enmod rewrite
a2enmod env
a2enmod dir
a2enmod mime

Once the permissions have been changed and modules enabled, it’s time to restart Apache2:
systemctl restart apache2

Final Steps

The server part of your setup is complete. Now you’ll open your internet browser and access your server’s IP address.

For example, if the IP address for your server were 1.2.3.4, then you would open your browser and go to the following link: http://1.2.3.4

You will see the WordPress default setup page at this point, prompting you for the language of your WordPress setup and then prompting you to create an administrative account.

Wordpress-Install

Congratulations! You’ve just completed your WordPress setup on Ubuntu 17.04 LTS.

Conclusion

You’ve successfully moved through every step necessary to install WordPress on your dedicated node running Ubuntu 17.04 LTS. You are not able to begin using the WordPress CMS and exploring the features and benefits it provides when operated from a dedicated server. If you had success following this guide and found it helpful, please share it with other individuals that may be setting up their WordPress server.