How To Install WordPress with Docker on Ubuntu 16.04 LTS

Install WordPress with Docker on Ubuntu 16

Docker is an open-source project that automates the deployment of application inside the software container. The container allows the developer to package up all project resources such as libraries, dependencies, assets etc. Docker is written in Go Programming language and is developed by Dotcloud. It is basically a container engine which uses the Linux Kernel features like namespaces and control groups to create containers on top of an operating system and automates the application deployment on the container.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation WordPress content management systems on an Ubuntu 16.04 Xenial Xerus server.

Install WordPress with Docker on Ubuntu 16.04 LTS

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Docker.

A Ubuntu 16.04 Docker server is required. If you do not have Docker installed, you can follow our guide here.

Step 3. Installing MariaDB Container.

Before installing WordPress with Docker you will need to have somewhere to store the data. MariaDB is a community-developed relational database management system and a drop-in replacement for MySQL:

mkdir ~/wordpress && cd ~/wordpress

Next we create the MariaDB container with the command:

docker run -e MYSQL_ROOT_PASSWORD=<password> -e MYSQL_DATABASE=wordpress --name wordpressdb -v "$PWD/database":/var/lib/mysql -d mariadb:latest

If Docker was successful at creating the container, you should see a code at the end of the output similar to the example below:

...
Status: Downloaded newer image for mariadb:latest
23df0ec2e48beb1fb8704ba612e9eb083f4193BMWe4611102bc91232955cccc54

You can confirm that the MariaDB container is running by using the following command:

docker ps

Step 4. Installing WordPress Container.

WordPress is made officially available on Docker Hub, pull the image using with the command below:

docker pull wordpress

Run the command below while replacing the and as appropriate to your cloud server:

docker run -e WORDPRESS_DB_PASSWORD=<password> --name wordpress --link wordpressdb:mysql -p <server public IP>:80:80 -v "$PWD/html":/var/www/html -d wordpress

Finally step, restart Docker and the database container, also make sure no other service is already bound to the port 80:

sudo service docker restart
docker start wordpressdb

*Note: Full command-line documentation is also available over at Docker support page.

Step 5. Accessing WordPress Installation.

WordPress will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com/wp-admin/install.php or http://server-ip/wp-admin/install.php and complete the required the steps to finish the installation. If you are using a firewall, please open port 80 to enable access to the control panel.

Congratulation’s! You have successfully installed WordPress with Docker. Thanks for using this tutorial for installing WordPress with Docker on your Ubuntu 16.04. For additional help or useful information, we recommend you to check the official Docker web site.

You Might Also Like: How To Install WordPress with OpenLiteSpeed on Ubuntu 16.04 LTS

How To Install WordPress with OpenLiteSpeed on Ubuntu 16.04 LTS

Install WordPress with OpenLiteSpeed on Ubuntu

WordPress is an online, open source website creation tool written in PHP. But in non-geek speak, it’s probably the easiest and most powerful blogging and website content management system (or CMS) in existence today.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation WordPress content management systems on an Ubuntu 16.04 Xenial Xerus server.
Install WordPress with OpenLiteSpeed on Ubuntu 16.04 LTS

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing OpenLiteSpeed.

First, download the OpenLiteSpeed 1-click script on your server:

wget https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh

Make the file executable with the following command:

chmod +x ols1clk.sh

Step 3. Install PHP 7 on OpenLiteSpeed.

To install PHP 7, run the following command:

./ols1clk.sh --lsphp 70

When the installation is complete, configure an administrative username and password for the OpenLiteSpeed’s web interface by running the following command:

/usr/local/lsws/admin/misc/admpass.sh

Step 4. Installing MariaDB.

To install MariaDB, run the following command:

apt-get install -y mariadb-server

Configuring MariaDB for WordPress.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Next we will need to log in to the MariaDB console and create a database for the WordPress. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for WordPress installation:

CREATE DATABASE wordpress character set utf8 collate utf8_bin;
GRANT ALL PRIVILEGES on wordpress.* to 'wpuser'@'localhost' identified by 'your_password';
FLUSH PRIVILEGES;

Step 5. Installing WordPress.

First thing to do is to go to WordPress’s download page and download the latest stable version of WordPress, At the moment of writing this article it is version 4.8.1:

cd /usr/local/lsws/example
wget http://wordpress.org/latest.zip

Unpack the WordPress archive to the document root directory on your server:

unzip latest.zip

We will need to change some folders permissions:

chown -R nobody:nogroup /usr/local/lsws/example/wordpress/

Configuring WordPress

In this step we will configure the main configuration file of WordPress, where we need to configure it’s basic parameters so that it can be connected with the database and user:

cd wordpress
mv wp-config-sample.php wp-config.php

Now open it using any of your favourite editor, to make any changes in the WordPress configuration file:

nano wp-config.php

Here are the values that we need to update according to our previous database and user’s setup:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wpuser');

/** MySQL database password */
define('DB_PASSWORD', 'your_password');

/** MySQL hostname */
define('DB_HOST', 'localhost');

Step 6. Configure OpenLiteSpeed.

First, modifying the default virtual host that is already present in the OpenLiteSpeed configuration so that we can use it for our WordPress installation. First, login to the OpenLiteSpeed WebAdmin panel at https://your-ip-address:7080.

Once logged into the OLS WebAdmin Pick “Virtual Hosts” in the menu bar and click on the “View” link:

This will let you edit the configuration of your virtual server.

First, we will change the Document origin of this Virtual Host to tip into our WordPress directory.

Click on the “General” tab to the virtual host and then click on the “Edit” button to the “General” table:

In the “Document Root” field, change the value from $VH_ROOT/html/ to $VH_ROOT/wordpress/:

Click “Save” when you’re finished.

Then, We’ll allow index.php files so They Can be used to Process requests that are not handled by static documents. This will allow the primary logic of WordPress to operate properly.

Click the “Edit” button for the “Index Files” table:

From the field for valid “Index Files”, add index.php before index.html to let PHP index files to take precedence:

Click “Save” when you are finished.

Configure WordPress Rewrites to Enable Permalink Support:

Next, we will install the compilation instructions in order that we could use permalinks inside our WordPress installation.

To do so, click on the “Rewrite” tab to the virtual host. From the Second screen, click on the “Edit” button to the “Rewrite Control” table:

Select “Yes” under the “Enable Rewrite” alternative:

Click “Save” to return to the primary display menu. Click on the “Edit” button for the “Rewrite Rules” table:

Remove the rules that are currently present and add the following rules to enable rewrites for WordPress:

Click on the “Save” button to execute your new rewrite rules.

The second thing that we have to do would be to change the default listening port from 8088 to 80.

Select “Listeners” in the menu bar and click on the “View” link:

Next, click on the “Edit” button for the “Address Settings” table:

In the Port area, change the port number from 8088 to 80:

Click “Save” when you are finished.

Restart the Server to Implement the Change

With All the aforementioned configuration out of the way, we can now Gently restart the OpenLiteSpeed host to enable our modifications.

Step 7. Accessing WordPress.

WordPress will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com or http://server-ip/ and complete the required the steps to finish the installation.

Congratulation’s! You have successfully installed WordPress with Docker. Thanks for using this tutorial for installing WordPress with OpenLiteSpeed on your Ubuntu 16.04. For additional help or useful information, we recommend you to check the official OpenLiteSpeed web site.

You Might Also Like: How To Install WordPress with Docker on Ubuntu 16.04 LTS

How To Install FFmpeg on Ubuntu 17.04

Install FFmpeg on Ubuntu

FFmpeg is a cross-platform solution for streaming audio and video as well as recording and conversion. There’s also a great PHP package called ffmpeg-php that allows for easy use of FFmpeg from inside PHP scripts. In this tutorial i will show you the easy way to install ffmpeg and ffmpeg-php (php extension).

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation FFmpeg on an Ubuntu 17.04 Zesty Zapus server.
Install FFmpeg on Ubuntu 17.04 Zesty Zapus

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing FFmpeg.
You’ll need to add FFmpeg’s PPA (personal package archive) to your system:

sudo add-apt-repository ppa:jonathonf/ffmpeg-3
sudo apt-get update
sudo apt upgrade

To undo the changes and restore to the stock version of FFmpeg in main Ubuntu repositories, purge the PPA via command:

sudo apt install ppa-purge
sudo ppa-purge ppa:jonathonf/ffmpeg-3

Congratulation’s! You have successfully installed FFmpeg. Thanks for using this tutorial for installing FFmpeg on your Ubuntu 17.04 Zesty Zapus. For additional help or useful information, we recommend you to check the official FFmpeg web site.

How To Install Apache Hadoop on Ubuntu 16.04 LTS

Install Apache Hadoop on Ubuntu

Apache Hadoop is a an open-source software framework written in Java for distributed storage and distributed process, it handles very large size of data sets by distributing it across computer clusters. Rather than rely on hardware to deliver high-availability, the library itself is designed to detect and handle failures at the application layer, so delivering a highly-available service on top of a cluster of computers, each of which may be prone to failures.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. We will show you through the step by step installation Apache Hadoop on an Ubuntu 16.04 Xenial Xerus server.

Install Apache Hadoop on Ubuntu 16.04 LTS

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Java (OpenJDK).

Since hadoop is based on java, make sure you have java jdk installed on the system. If you don’t have Java installed on your system, use following link to install it first.

Install Java JDK 8 on Ubuntu 16.04

[email protected] ~# java -version
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

Step 3. Installing Apache Hadoop.

To avoid security issues, we recommend to setup new Hadoop user group and user account to deal with all Hadoop related activities, following command:

sudo addgroup hadoopgroup
sudo adduser —ingroup hadoopgroup hadoopuser

After creating user, it also required to set up key based ssh to its own account. To do this use execute following commands:

su - hadoopuser
ssh-keygen -t rsa -P ""
cat /home/hadoopuser/.ssh/id_rsa.pub >> /home/hadoopuser/.ssh/authorized_keys
chmod 600 authorized_keys
ssh-copy-id -i ~/.ssh/id_rsa.pub slave-1
ssh slave-1

Download the latest stable version of Apache Hadoop, At the moment of writing this article it is version 2.8.1:

wget http://www-us.apache.org/dist/hadoop/common/hadoop-2.8.1/hadoop-2.8.1.tar.gz
tar xzf hadoop-2.8.1.tar.gz
mv hadoop-2.8.1 hadoop

Step 4. Configure Apache Hadoop.

Setup Hadoop environment variables. Edit ~/.bashrc file and append following values at end of file:

export HADOOP_HOME=/home/hadoop/hadoop
export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin

Apply environmental variables to current running session:

source ~/.bashrc

Now edit $HADOOP_HOME/etc/hadoop/hadoop-env.sh file and set JAVA_HOME environment variable:

export JAVA_HOME=/usr/jdk1.8.0_74/

Hadoop has many of configuration files, which need to configure as per requirements of your hadoop infrastructure. Lets start with the configuration with basic hadoop single node cluster setup:

cd $HADOOP_HOME/etc/hadoop

Edit core-site.xml:

<configuration>
<property>
  <name>fs.default.name</name>
    <value>hdfs://localhost:9000</value>
</property>
</configuration>

Edit hdfs-site.xml:

<configuration>
<property>
 <name>dfs.replication</name>
 <value>1</value>
</property>

<property>
  <name>dfs.name.dir</name>
    <value>file:///home/hadoop/hadoopdata/hdfs/namenode</value>
</property>

<property>
  <name>dfs.data.dir</name>
    <value>file:///home/hadoop/hadoopdata/hdfs/datanode</value>
</property>
</configuration>

Edit mapred-site.xml:

<configuration>
 <property>
  <name>mapreduce.framework.name</name>
   <value>yarn</value>
 </property>
</configuration>

Edit yarn-site.xml:

<configuration>
 <property>
  <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
 </property>
</configuration>

Now format namenode using following command, do not forget to check the storage directory:

hdfs namenode -format

Start all hadoop services use the following command:

cd $HADOOP_HOME/sbin/
start-dfs.sh
start-yarn.sh

You should observe the output to ascertain that it tries to start datanode on slave nodes one by one. To check if all services are started well use ‘jps‘ command:

jps

Step 5. Accessing Apache Hadoop.

Apache Hadoop will be available on HTTP port 8088 and port 50070 by default. Open your favorite browser and navigate to http://yourdomain.com:50070 or http://server-ip:50070. If you are using a firewall, please open port 8088 and 50070 to enable access to the control panel.

Congratulation’s! You have successfully installed Apache Hadoop. Thanks for using this tutorial for installing Apache Hadoop on Ubuntu 16.04 system. For additional help or useful information, we recommend you to check the official Apache Hadoop web site.

Easy Guide to Add the Official Twitter Follow Button in WordPress

In this article we will cover what is the twitter follow button, and how you can add it in your WordPress site.

What is the Twitter Follow Button

Twitter follow button is a small widget which allows users to easily follow your twitter account (or any twitter account) from any website. The follow button uses the same implementation model as the official tweet button, and it is really simple to integrate. You can see the demo of the follow button on the top left corner of the image below. When you click on the follow button, a window opens with more information about the user.

 

You are probably wondering how it is different from the Smart Follow button below?

Well the smart follow button requires you to do the whole Twitter Anywhere integration. It also doesn’t allow you to show your follower count or do any customization. Whereas the Twitter follow button lets you show the count, and it is very easy to integrate. Check out the live example below (don’t forget to click follow to see what it does):

How to Add the Official Twitter Follow Button in WordPress

You can go to the Follow Button page and generate a code for you. Or you can simply copy the code below:

1
2
<a href="http://twitter.com/wpbeginner" class="twitter-follow-button" data-show-count="true">Follow @wpbeginner</a>

P.S. Make sure to change the username with your own.

If you are using the official tweet button, then you do not need to paste the script twice. So your code will look like this:

1
<a href="http://twitter.com/wpcademy" class="twitter-follow-button" data-show-count="true">Follow @wpcademy</a>

Now you can paste the code anywhere you like in your WordPress theme. Most folks will put such code in their sidebar.php file. However, if you don’t feel comfortable editing a theme file, then you can utilize WordPress theme widgets as well. All good themes come with widget-ready sidebars. So all you would have to do is go to Appearence » Widgets tab. Then add a text widget to your appropriate sidebar. Lastly, paste the code above, and you are done. Look in the screenshot below for the example:

There is really no need to add a plugin to do something as simple as this.

Advanced Customization

This section is for designers and developers who want to customize this button further to match their site’s color scheme etc. Twitter lets you customize the button color, text color, link color, language, widget, and alignment of the plugin.

Available variables in the JavaScript version that we are using:

  • data-show-count (true or false)
  • data-button (blue or grey)
  • data-text-color (hex code)
  • data-link-color (hex code)
  • data-lang (en, fr, de, es) – uses the two letter ISO-639-1 language code
  • data-width – (300px)
  • data-align – (right)

If you want to specify it in the a code it would look something like this:

1
<a href="http://twitter.com/wpbeginner" class="twitter-follow-button" data-button="grey" data-text-color="#FFFFFF" data-link-color="#ffa24f" data-show-count="true">Follow @wpbeginner</a>

Resources:

Follow Button Documentation
Follow Button Generator

How To Install Ionic Framework on Ubuntu 18.04 LTS

Install Ionic Framework on Ubuntu 18

In this tutorial we will show you how to install Ionic Framework on Ubuntu 18.04 LTS. Ionic Framework is the free, open source mobile UI toolkit for developing high-quality cross-platform apps for native iOS, Android, and the web—all from a single codebase.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation ClamAV on a Ubuntu 18.04 LTS (Bionic Beaver) server.
Ionic Framework on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Node.js.

First, use the following commands to install NPM and Node.js:

sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs

Step 3. Installing Cordova.

Run the following command to install Cordova on your system using npm command:

sudo npm install -g cordova

Step 4. Installing Ionic Framework on Ubuntu 18.04 LTS.

Use NPM command to install Ionic framework on your system:

sudo npm install -g ionic

Verify the ionic installation:

ionic -v

Step 5. Create Ionic Application.

First, create a new Cordova project on your computer using the following command:

ionic start HelloM0na blank

Now use one of the following commands to enable iOS or Android platform:

ionic platform add ios
ionic platform add android

Congratulation’s! You have successfully installed Ionic Framework. Thanks for using this tutorial for installing Ionic Framework open source antivirus engine in Ubuntu 18.04 LTS Bionic Beaver system. For additional help or useful information, we recommend you to check the official Ionic Framework web site.

Easy Guide to Change WordPress Theme via phpMyAdmin

Change WordPress Theme via phpMyAdmin

In this tutorial we are going to learn how to change WordPress theme from the database. WordPress makes it extremely easy to manage themes from the admin area. However, if you are unable to access your WordPress admin area, then you will need to find other ways to change your WordPress theme.

Why and When You Need to Use phpMyAdmin?

Normally, the easiest way to change your WordPress theme is by visiting the Appearance » Themes page in WordPress admin area. However, sometimes a WordPress error can make your website admin area inaccessible.

In that case, the safest way to recover your website is by restoring it from backup. Another way is to troubleshoot the WordPress error causing the problem. In troubleshooting, the easiest way to switch themes is to make a backup of your existing theme via FTP, and then remove all theme folders from /wp-content/themes/ except for the default theme. WordPress will automatically revert to the default theme.

Both of the above methods will give you access to the WordPress admin area, and you will be able to change the theme.

However if you don’t have a backup, and you don’t want to revert to a default theme, then you can change to a custom WordPress theme from your database by using phpMyAdmin.

That being said, let’s take a look at how to change your WordPress theme via phpMyAdmin.

Changing Your WordPress Theme via phpMyAdmin

This method allows you to tell WordPress which theme to use by changing the information in the database. For this method to work, the theme you want to switch to must already be installed on your website.

You will need to connect to your website using a FTP client and go to the /wp-content/themes/ folder. There you will be able to see all the themes that are currently installed on your website.

create ad with wordpress blog

Note: Write down the theme folder name that you want to switch to. You will need it in the next step.

If the theme you want to switch to isn’t installed on your website, then you can manually install a WordPress theme via FTP.

After making sure that theme you want is installed on your website, you can now go ahead and change the theme via phpMyAdmin.

Step 01. you need to go to cPanel dashboard of your WordPress hosting account. Next, scroll down to the databases section and then click on phpMyAdmin.

Once you are in phpMyAdmin, you’ll see a list of databases on the left side of the screen. Simply click on the database that you are using for your WordPress site.

If you are not using cPanel but using phpMyadmin, go to yourdomain.com/phpmyadmin or yourip/phpmyadmin.

Step 02. it will show you the list of tables in this database. You need to click on the ‘wp_options’ table to open it.

Note: By default, WordPress database tables use wp_ as the prefix for table names. However, it is possible to see a different database prefix if you or an administrator on your site had changed the WordPress database prefix.

select table from database

Step 03. Upon opening the table, you need to scroll down and locate ‘template’ and ‘stylesheet’ rows. Next, click on the Edit button next to the template row.

Step 04. This will open the row editor where you need to change the value for the option_value field to the theme you want to use. It is usually the same as the folder name in /wp-content/themes/ folder.

Step 05. After that click on the ‘Go’ button below to save your changes. Now, repeat the process for stylesheet row as well.

Once you have saved your changes, you can go to your website to see the new theme in action.

Congratulations! You have changed your WordPress theme via phpMyAdmin successfully. You may also want to see how to install phpMyAdmin.