Linux Tips and Tricks

This category contains 17 posts

Setup HaProxy HTTP Load Balancer on CentOS

Load Balancing per wikipedia, improves the distribution of workloads across multiple computing resources, such as computers, a computer cluster, network links, central processing units, or disk drives. Load balancing aims to optimize resource use, maximize throughput, minimize response time, and avoid overload of any single resource. Using multiple components with load balancing instead of a single … Continue reading

Redirect HTTP traffic to HTTPS

You will find the need to implement a redirection of HTTP request to HTTPS. With this all you need to use is Apache’s mod_rewrite module. Below is the sample configuration for both the entire site or just a sub section. To redirect ALL traffic to HTTPS: RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] … Continue reading

VMPlayer CLI Tips

As I have posted earlier, you can run VMs from a command line using VMWare VXI API. In addition to that, you can also view your running VMs as well as get their IP addresses and a lot more. For this topic, will be covering two things that I consider most important. That is, getting … Continue reading

Running Headless(NoGUI) VMPlayer VMs

Environment: VMs under Linux Host Sometimes, you will find the need to run or start VMs from the command line especially when you are working remotely. This can be done using VMware VIX API. If not yet done, download the VMware VIX API for Linux from VMware Website and install it on the same host where … Continue reading

Setup AWStats on CentOS 6 to analyze Apache Logs

Environment: CentOS 6 64bit with Apache already installed AWStats is an opensource software that generates statistics graphically. For more info, visit awstats office website here. 1. Install Epel Repo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 2. Install awstats package. yum install awstats 3. Setup apache for stats By default AWStats creates an Apache configuration file /etc/httpd/conf.d/awstats.conf. If you … Continue reading

Upgrade RHEV(Red Hat Enterprise Virtualization) from 3.0 to 3.2

We have upgraded our RHEV Environment recently to 3.2. 3.3 is the latest but are not moving to that yet as there might still be bugs since this was just released earlier this year. The purpose of this documentation is just to keep my sanity. I will be posting as well the official Documentation of … Continue reading

Correcting Linux Clock on a Virtualized System

We have had issues on some of our VMs under RHEV. Setting up NTP won’t help as the time always gets off. To correct the time, modify the kernel boot options as below then reboot the machine for changes to take effect. For x64 systems: divider=10 clocksource=acpi_pm For x86 systems: notsc divider=10 See complete parameters … Continue reading

Find Multiple Files with Different Extensions

Linux “Find” command is one of my tools when administering Linux Servers. I came into situation where I need to find multiple file with different extensions at once. I have tried the regex options but can’t seem to make work. But after googling a bit I have managed to find what I was looking for … Continue reading

Route Mail to other SMTP based on the Sender

We are currently migrating Mail Restriction from Linux System to Exchange but we have to do it by batch so as to limit the effect if in case something might not go as planned. With that said, we have identified the users to be migrated but the problem is that we can’t relay mails to … Continue reading

Setup NRPE on Centos 6

Environment: Centos 6 x86_64 GNU/Linux 1. Install required packages rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm yum -y install nagios-plugins-all nagios-plugins-nrpe nrpe 2. Set NRPE to start at boot time and start NRPE service. chkconfig nrpe on /etc/init.d/nrpe restart