How to create Apache htpasswd file in Linux OS?

What is htpasswd?

At times during web development, we will need to prevent the whole world from being able to access a particular website. That’s when Apache htpasswd comes into the picture. htpasswd is usually used together with htaccess.

Tutorial

This tutorial will teach you how to create a htpasswd file using command line.

Creating a htpasswd for the first time

Example

Appending new user to existing htpasswd file

Example

Using htpasswd in htaccess

 

That’s it you are done!

Upgrade PHP 5 to PHP 7 on CentOS/RHEL 6/7

As we all know, PHP 7 brings 2x the increase in performance to PHP powered systems. The main purpose of this guide will be focusing on the steps to upgrade your web server from PHP 5 to PHP 7 on CentOS.

Pre-requisite

If you are upgrading an existing system to PHP 7, it is advised to test your current system with this upgrade on a separate web server.

Check that your current PHP source codes is compatible with PHP 7 at the following link.

https://secure.php.net/manual/en/migration70.php

1. Install YUM Repository

CentOS/RHEL 7.x

CentOS/RHEL 6.x

1. Upgrade PHP

2. Install PHP 7

[Optional] APC

If you have existing APC (Alternative PHP Cache) installed in your web server, you will have to remove it as APC does not support PHP 7.

After uninstalling APC, modify the following file.

Comment the following line of code by adding a semicolon ‘;’ in front of it.

Check PHP Version

Run the following command to check your current version of PHP.

You should see the following.

 

That’s it! You are done upgrading from PHP 5 to PHP 7.

Install Varnish Cache on CentOS 6/7

Varnish Cache is a tool that helps to cache web pages for quicker loading of web pages.

Here we will cover how to install Varnish Cache on CentOS 6/7.

Step 1: Add EPEL

CentOS 6

CentOS 7

Step 2: Download Varnish Cache

CentOS 6

CentOS 7

Step 3: Install Varnish Cache

CentOS 6/7

Step 4: Start Varnish Cache

CentOS 6

CentOS 7

Step 5: Set Varnish Cache to run on boot

CentOS 6

CentOS 7

 

That’s it! It’s that simple to setup Varnish Cache.

Feel free to contact me at [email protected] if you have any questions.

Install Zabbix Agent on CentOS/RHEL

Zabbix is an open source software for application and network monitoring. There are two types of Zabbix installation, namely Zabbix server and Zabbix agent. Zabbix server is installed on the server where you will oversee and monitor all the networks or devices. Zabbix agent is installed on all networks or devices so that the Zabbix server is able to communicate with it.

This tutorial guides you step by step on how to install and configure a Zabbix agent on CentOS/RHEL server.

Installing Zabbix Agent

1. Configure Yum Repository

Run the following commands accordingly to the version of CentOS/RHEL you are using.

CentOS/RHEL 7

CentOS/RHEL 6

CentOS/RHEL 5

2. Install Zabbix Agent

Command to install Zabbix agent

3. Update Zabbix Agent Configuration File

Your Zabbix agent configuration file should be located at /etc/zabbix/zabbix_agentd.conf.

Edit configuration file

Modify the following lines

Save and exit nano editor

4. Restart Zabbix Agent

Command to restart Zabbix agent

(Additional Information) Alternately, you can start/stop your Zabbix agent via the following commands.

 

That’s it! You are done installing Zabbix agent on your server.

In case you have missed out on how to install Zabbix server on your server, you can refer to the guide on how to install Zabbix server on CentOS/RHEL.

Feel free to email me at [email protected] if you have any questions.

Install Zabbix Server on CentOS/RHEL

Zabbix is an open source software for application and network monitoring. There are two types of Zabbix installation, namely Zabbix server and Zabbix agent. Zabbix server is installed on the server where you will oversee and monitor all the networks or devices. Zabbix agent is installed on all networks or devices so that the Zabbix server is able to communicate with it.

This tutorial guides you step by step on how to install and configure a Zabbix server on CentOS/RHEL server.

1. Set up Apache, MySQL and PHP

Install Apache

Install MySQL

Install PHP

Start Apache and MySQL services

Setup MySQL by running the following command

2. Configure Yum Repository

RPM repository needs to be configured before installing Zabbix.

Run the following commands according to the version of OS that you are using.

CentOS/RHEL 7

CentOS/RHEL 6

CentOS/RHEL 5

3. Install Zabbix Server with MySQL

Command to install zabbix server

4. Setup Zabbix Apache Configuration

Locate Zabbix’s own Apache configuration file. By default it should be located at /etc/httpd/conf.d/zabbix.conf. Modify the config file by added your time zone.

Added time zone to config file

Restart Apache service after changing the time zone value

5. Create Zabbix MySQL Database

Zabbix MySQL user and database is required as part of Zabbix server installation.

Login to your MySQL first

After which you will be prompt to enter your root password that you have configured previously when you setup MySQL.

Create Zabbix database

Create Zabbix MySQL user to access Zabbix database

Grant privileges to Zabbix user on Zabbix database

Flush privileges

Exit MySQL

After creating MySQL user and database for Zabbix, you will need to restore the default MySQL database provided by Zabbix. The files can be found at /usr/share/doc/zabbix-server-mysql-<version>/create/ directory.

Note: remember to change the version accordingly to the version that you are installing.

6. Start Zabbix Server

Command to start Zabbix server

7. Start Zabbix Web Installer

You can now access your Zabbix web installer via the following url

Zabbix Setup Welcome Screen

Following is the welcome screen of Zabbix web installer. Click on Next to proceed.

Screen Shot 2015-08-15 at 11.55.34 am

Installation pre-requisites

If everything is ok, click Next to proceed.

Screen Shot 2015-08-15 at 11.57.54 am

Configure Database Connection

Enter the database information that you have created previously. Then click on Test Connection. If everything is correct, click Next to proceed.

Screen Shot 2015-08-15 at 12.00.35 pm

Zabbix Server Details

Click on Next to proceed.

Screen Shot 2015-08-15 at 12.01.46 pm

Pre-Installation Summary Screen

If all information is correct, click on Next to proceed.

Screen Shot 2015-08-15 at 12.12.48 pm

Installation Success

Click on Finish to proceed.

Screen Shot 2015-08-15 at 12.03.40 pm

Zabbix Login Screen

You can now login to Zabbix via the following url

Default username and password is as follows

Screen Shot 2015-08-15 at 12.15.08 pm

 

 

That’s it! You are done installing Zabbix server on your server. For installation of Zabbix agent, you can refer to my guide on how to install Zabbix agent on CentOS/RHEL.

Feel free to email me at [email protected] if you have any questions.