How To Install Varnish on Ubuntu 16.04 LTS

Install Varnish on Ubuntu 16

Varnish Cache is a powerful open source HTTP accelerator that can be installed in front of any Webserver such as Apache or Nginx. Varnish Cache can improve overall performance of your web server by caching contents. The Varnish cache stores the copy of user request’s and serves the same page when the user revisits the webpage. It makes your website really fast and accelerate your web site performance up-to 300 – 1000x (means 80% or more).

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 Varnish Cache on a Ubuntu 16.04 (Xenial Xerus) server.
Install Varnish 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. Install Apache web server.

For this part we will be assuming that you have already installed Apache on your server and have it running properly. If not write this command in your terminal:

sudo apt-get install apache2

Step 3. Installing Varnish.

Install Varnish using apt-get command:

apt-get install varnish

After the installation is finished, start and enable varnish.service using the systemctl command:

systemctl start varnish.service
systemctl enable varnish.service

Step 4. Configuring Varnish.

Varnish is automatically configured to server content over port 80 and fetch contents from Apache on port 8080, we need to update Apache to serve content over port 8080:

### nano /etc/apache2/ports.conf
Listen 127.0.0.1:8080

If you have any virtual hosts configured, you will need to update these as well – ensure your configuration looks like this:

<VirtualHost 127.0.0.1:8080>

We need to configure varnish to run on port 80. First, create a file called varnish.service inside the /etc/systemd/system directory:

### nano /etc/systemd/system/varnish.service

Then, add the following configuration:

[Service]
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m

Once you save and exit out of that file, open up the default.vcl file:

### nano /etc/varnish/default.vcl
backend default {
    .host = "127.0.0.1";
    .port = "8080";
}

Restart the Apache and Varnish service for the changes to take effect:

systemctl restart apache2.service
systemctl restart varnish.service

You can check to see if varnish is working by typing the following command:

varnishstat

Step 5. Testing Varnish.

The test consists in making a HTTP request via curl and verifying that it is handled by Varnish:

[root@wpcademy ~ ]# curl -I 192.168.146.161
 HTTP/1.1 403 Forbidden
 Date: Mon, 01 May 2017 24:06:10 GMT
 Server: Apache/2.4.6 (Ubuntu) PHP/7.0.16
 Last-Modified: Thu, 16 Dec 2016 19:30:58 GMT
 ETag: "1321-5058ranty728280"
 Accept-Ranges: bytes
 Content-Length: 4897
 Content-Type: text/html; charset=UTF-8
 X-Varnish: 32779
 Age: 4
 Via: 1.1 varnish-v4
 Connection: keep-alive

Congratulation’s! You have successfully installed Varnish. Thanks for using this tutorial for installing Varnish Cache on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official Varnish web site.

How To Secure SSH Using Two Factor Authentication on Ubuntu 16.04 LTS

Two Factor Authentication on Ubuntu 16

Securing SSH with two factor authentication using Google Authenticator Two-step verification (also known as Two-factor authentication, abbreviated to TFA) is a process involving two stages to verify the identity of an entity trying to access services in a computer or in a network. This is a special case of a multi-factor authentication which might involve only one of the three authentication factors (a knowledge factor, a possession factor, and an inheritance factor) for both steps.

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 secure SSH using two factor authentication on a Ubuntu 16.04 (Xenial Xerus) server.
Secure SSH Using Two Factor Authentication 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 the Google Authenticator.

To install the package on Ubuntu, run the following command:

apt-get install libpam-google-authenticator

The next step is to get the verification code. It’s a very simple command to get the verification code and scratch codes by just answering simple questions of server which he will ask you. You can do that step by running the following command:

google-authenticator

You will be prompted to answer a few questions; answer the first two questions with yes (y):

Do you want authentication tokens to be time-based (y/n) y

Big QR code will be generated in your terminal. You can scan the code with the authenticator application on your Android/iOS/Windows phone or tablet or enter the secret key generated on the screen.

Emergency scratch codes will also be generated. You can use these codes for authentication in case you lose your mobile device:
Your emergency scratch codes are:

80461001
68335920
89765548
12485672
11145603
/php]


Save the authentication settings for the root user by answering YES to the next question:
[php]
Do you want me to update your "/root/.google_authenticator" file (y/n) y

Next, you can configure the authenticator to generate one-time passwords. Since they last 30 seconds, all generated passwords can be used once. Answer y to create the file that stores these settings:

Do you want to disallow multiple uses of the same authentication
token? This restricts you to one login about every 30s, but it increases
your chances to notice or even prevent man-in-the-middle attacks (y/n) y

You can use the next setting if you have time syncing issues across your devices, so we will not use this option:

By default, tokens are good for 30 seconds and in order to compensate for
possible time-skew between the client and the server, we allow an extra
token before and after the current time. If you experience problems with poor
time synchronization, you can increase the window from its default
size of 1:30min to about 4min. Do you want to do so (y/n) n

The next setting prevents brute-force attacks. You will only have three chances per 30 seconds to enter the correct password:

If the computer that you are logging into isn't hardened against brute-force
login attempts, you can enable rate-limiting for the authentication module.
By default, this limits attackers to no more than 3 login attempts every 30s.
Do you want to enable rate-limiting (y/n) y

Congratulations! You have finished generating your key and adding it to your client, but some additional configuration is needed before these settings will go into effect.

The next step is to configure the authentication settings in openSSH. To do so, open the “/etc/pam.d/sshd” file and add the following line to the end of the file:

### nano /etc/pam.d/sshd
auth required pam_google_authenticator.so

Save the changes, and open the “/etc/ssh/sshd_config” file and enable Challenge Response Authentication:

### nano /etc/ssh/sshd_config
ChallengeResponseAuthentication yes

Finally, save the file and restart the SSH server for the changes to take effect:

systemctl restart ssh

Congratulation’s! You have successfully secure SSH. Thanks for using this tutorial for secure SSH using two factor authentication on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official SSH web site.

How To Upgrade From Ubuntu 16.10 to Ubuntu 17.04

Upgrade From Ubuntu 16.10 to Ubuntu 17

Ubuntu 17.04 released, codenamed “Zesty Zapus”;  bringing yet another version of a remarkable operating system in the Ubuntu ecosystem, with the latest and some of the greatest open source technologies in a high-quality, easy-to-use Linux distribution.

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 upgrade from Ubuntu 16.10 to Ubuntu 17.04 (Zesty Zapus).

Prerequisites:

There a couple of things you should do before performing an Ubuntu upgrade, like making a backup of important files and folders, disabling or purging third-party PPAs (the upgrade process will disable these, but it doesn’t hurt to be proactive), and installing all available updates.
Upgrade From Ubuntu 16.10 to Ubuntu 17.04

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 update
sudo apt dist-upgrade

Step 2. Upgrade Ubuntu 16.10 to 17.04.

You can upgrade to Ubuntu 17.04 in one of two ways, using the Software Updater app, or using the command line.
Upgrade Ubuntu 16.10 to Ubuntu 17.04 Using Command Line

Then make sure you have update-manager-core package installed:

sudo apt install update-manager-core

Next, edit a configuration file using nano or your preferred command line text editor:

sudo nano /etc/update-manager/release-upgrades

At the bottom of this file, change the value of Prompt from lts to normal:

Prompt=normal

Afterwards, launch the upgrade tool with the command below:

sudo do-release-upgrade
[php]


Once that upgrade has completed reboot, login and run the command again, this time to upgrade to Ubuntu 17.04:
[php]
sudo do-release-upgrade -d

Upgrade Ubuntu 16.10 to Ubuntu 17.04 Using Graphical Update Manager

Ensure that you system is fully up-to-date, run the commands below:

sudo apt update
sudo apt dist-upgrade

Then open Software & Updates from Unity Dash or your favorite application menu:

software center and updates
Next, Select the Updates tab and then at the bottom of window, change notification settings from For long-term support version to For any new version:
click on updates then select new version
Click the close button. You will be asked to enter your password to apply the above changes. Next, issue the following command in terminal:

update-manager -d

You should be notified that software is up-to-date and Ubuntu 17.04 is now available. Click the Upgrade button:
click on upgrade
Then enter your password. The Ubuntu 17.04 release notes window will appear. Click Upgrade and wait for the upgrade to finish:
Upgrade From Ubuntu 16.10 to Ubuntu 17

Congratulation’s! You have successfully upgrade Ubuntu. Thanks for using this tutorial for upgrade from Ubuntu 16.10 to Ubuntu 17.04 (Zesty Zapus) system. For additional help or useful information, we recommend you to check the official Ubuntu web site.

You Might Also Like: How To Install Ubuntu 17.04 Server Zesty Zapus

How To Install Google Play Music Desktop Player on Ubuntu 16.04

Install Google Play Music on Ubuntu 16

Google Play Music Desktop Player aka GPMDP, is an open source, unofficial Google play music app for Linux desktop released under MIT license, also available for Mac OS X and Windows. It’s made by a university student in Melbourne, Australia.

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 Google Play Music Desktop Player on a Ubuntu 16.04 (Xenial Xerus).
Features in Google Play Music Desktop Player

Customizable built-in equalizer for audio
Audio output device options
Simple and nicely-designed mini player
Native desktop notifications
Last.fm support with now playing and scrobbling features
HTML5-based. No need for Adobe Flash Player
Customizable media key support. Use media keys or create custom shortcuts if you don’t have any
UI customization: Set the dark theme to your taste
Customize almost everything
Interface with external apps like Rainmeter

Install Google Play Music Desktop Player 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 Google Play Music Desktop Player.

First, Download the deb package from Github project page and run the following commands to install Google Play Music Desktop Player on Ubuntu systems:

sudo apt install gdebi
sudo gdebi google-play-music-desktop-player*.deb

Once installed, Google Play Music Desktop can be started from Unity Dash or your preferred app launcher.

Congratulation’s! You have successfully installed Google Play Music. Thanks for using this tutorial for installing Google Play Music Desktop Player on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official Google Play Music Desktop Player web site.

How To Install KVM and Create Virtual Machines on Ubuntu 16.04 LTS

Install KVM and Create Virtual Machines on Ubuntu 16

Kernel-based Virtual Machine (KVM) is free and open source virtualisation software. You can create multiple VM (virtual machines) , each VM has its own private virtualised hardware like disk, CPU, RAM etc.

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 KVM and Create Virtual Machines on a Ubuntu 16.04 (Xenial Xerus) server.
Install KVM and Create Virtual Machines 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 KVM.

First, let us check if your system supports hardware virtualization. To do so, run the following command:

egrep -c ‘(svm|vmx)’ /proc/cpuinfo

A 0 indicates that your CPU doesn’t support hardware virtualization, while a 1 or more indicates that it does. You may still have to enable hardware virtualization support in your computer’s BIOS, even if this command returns a 1 or more.

Install KVM and other required packages to setup a virtualization environment in Linux:

apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager virtinst virt-viewer

The bridge-utils is used to create bridge networking so other devices on your network can see your virtual machine.

Verify the KVM installation:
virsh -c qemu:///system list

After running this command, log out and log back in. Run this command after logging back in and you should see an empty list of virtual machines. This indicates that everything is working correctly.

Step 3. Create Virtual Machines.

You can open the Virtual Machine Manager by typing the same in Dash Home.Click the icon , it will open the application.

Create-Virtual-Machines-KVM
In the virtual machine manager window, click the first icon in the toolbar
Create-Virtual-Machines-KVM-1
Next, Choose the location of your installation media.
Create-Virtual-Machines-KVM-2
You can install from a disc, ISO image, or even a network location.
Create-Virtual-Machines-KVM-3
Next, allocate memory and CPU to your virtual machine
Create-Virtual-Machines-KVM-4
After that, specify the size of your virtual disk. If you check the box before allocate entire disk now, then the disk size is fixed.
Create-Virtual-Machines-KVM-5
In the next window, you can give your virtual machine a name. Then click finish to begin installing OS to your virtual machine.
Create-Virtual-Machines-KVM-6
Here’s a screenshot of ubuntu virtual machine running in virt-manager window.
Create-Virtual-Machines-KVM-7
Congratulation’s! You have successfully installed KVM. Thanks for using this tutorial for installing KVM and Create Virtual Machines on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official KVM web site.

How To Install Google Drive Ocamlfuse on Ubuntu 16.04

Install Google Drive Ocamlfuse on Ubuntu 16

Google Drive Ocamlfuse is a FUSE-based file system powered by Google Drive. It lets you mount your Google Drive on Linux so that you can access your files and folders, either via the command line or through a traditional GUI file manager, like Nautilus, Nemo or Caja.

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 Google Drive Ocamlfuse on a Ubuntu 16.04 (Xenial Xerus) server.
Install Google Drive Ocamlfuse on Ubuntu 16.04

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 Google Drive Ocamlfuse.

Run the following commands in Terminal to install Google Drive Ocamlfuse:

sudo add-apt-repository ppa:alessandro-strada/ppa
sudo apt update
sudo apt install google-drive-ocamlfuse

Once installed complete you can go ahead and set up the app to work with your Google Drive account. While there isn’t a fancy-pants GUI front-end for setting things up don’t feel put. GDO is super simple to use via the CLI:

google-drive-ocamlfuse

It will open a new tab in your browser asking you to grant it permission to view and manage the files in your Google Drive. Click Allow:
Google-drive-ocamlfuse-browser-auth

Step 3. Mount Your Google Drive.

First, create a mount point for your Google Drive, such as ~/google-drive:

mkdir ~/google-drive
google-drive-ocamlfuse ~/google-drive/

If you have more than one account, you can run:

google-drive-ocamlfuse -label label [mountpoint]

Step 4. Unmount Google Drive:

To unmount the filesystem, run this command:

fusermount -u ~/google-drive

Congratulation’s! You have successfully installed Google Drive. Thanks for using this tutorial for installing Google Drive Ocamlfuse on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official Google Drive web site.

How To Install WebTorrent Desktop on Ubuntu 16.04 LTS

Install WebTorrent Desktop on Ubuntu 16

WebTorrent Desktop is a free, open source streaming torrent application for Mac, Windows, and Linux. With WebTorrent Desktop, you can watch video from the Internet Archive, listen to music from Creative Commons, or audiobooks from Librivox.

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 WebTorrent Desktop on a Ubuntu 16.04 (Xenial Xerus) server.
WebTorrent Desktop Features

Lightweight, fast torrent app
Beautiful user experience
Free, non-commercial, ad-free, and open source
Instantly stream video and audio
WebTorrent fetches file pieces from the network on demand for instant playback.
Even when the file isn’t fully downloaded, seeking still works.
(Seeking just reprioritizes which pieces are fetched from the network.)
Stream videos to AirPlay, Chromecast, and DLNA
Based on the most popular and comprehensive torrent package in Node.js, web torrent
Full-featured, but bloat free
Opens magnet links and .torrent files
Drag-and-drop makes adding or creating torrents easy
Discovers peers via tracker servers, DHT (Distributed Hash Table), and peer exchange
Supports the WebTorrent protocol for connecting to WebRTC peers (i.e. web browsers)

Install WebTorrent Desktop 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 WebTorrent Desktop.

First, Download the deb package from Github project page and run the following commands to install WebTorrent Desktop on Ubuntu systems:

sudo apt-get install gdebi
wget https://github.com/feross/webtorrent-desktop/releases/download/v0.18.0/webtorrent-desktop_0.18.0-1_amd64.deb
sudo gdebi webtorrent-desktop_0.18.0-1_amd64.deb

Once installed, WebTorrent Desktop can be started from Unity Dash or your preferred app launcher or from the terminal:

webtorrent-desktop

Congratulation’s! You have successfully installed WebTorrent Desktop. Thanks for using this tutorial for installing WebTorrent Desktop on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official WebTorrent Desktop web site.