Installing ZFS RAID-Z on CentOS 6.2 with SSD caching.

I recently had a project that required data storage with deduplication, data integrity assurance, and hardware fault tolerance. Instead of going with a traditional hardware RAID solution I opted to test out ZFS. My configuration utilized a single 120GB SSD drive and four 1TB SATA drives. My solution was to run the main Operating System on the SSD, reserve space for caching on the SSD and utilize ZFS RAID-Z on the four large SATA drives. Here are the steps I took to create such a setup.
Continue reading

Posted in Linux Guides | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

KVM Hardware Virtualization on CentOS 6.2 Dedicated Servers

I wrote this guide to show you how to do a proper KVM setup on your CentOS dedicated server. We will be using VNC and connecting to the dedicated server remotely from your workstation. I realize there are a lot of other guides for utilizing Kernel-based Virtual Machine (KVM) hardware virtualization. What sets this guide apart is that it does not require a desktop Linux operating system. Many other guides are great, but they will NOT work for those of us that run dedicated servers. We simply do not have a GUI to complete our installs. I will show you how to setup KVM from start to finish on a remotely hosted dedicated Linux server without a desktop environment.
Continue reading

Posted in Linux Guides, Virtualization | Tagged , , , , , , , , , , , , , , , , , , | Leave a comment

List all installed Perl modules on server.

Sometimes you may need to figure out which Perl modules you have installed on your server. This can be very useful when cloning a server for a development project. The easiest way to see every installed module and the module’s version is via a perl script. Here is a simple perl script that does this:

#!/usr/bin/perl

use ExtUtils::Installed;
my $instmod = ExtUtils::Installed->new();
foreach my $module ($instmod->modules()) {
    my $version = $instmod->version($module) || "???";
    print "Module Name: $module Module Version: $version\n";
}
Posted in Linux Guides, Perl Programming | Tagged , , , , | Leave a comment

Can’t remove or re-add a cPanel addon or parked domain?

Sometimes you may find that a domain just won’t go away from cPanel. You may be trying to simply remove an addon domain or a parked domain, or you may be trying to re-add a domain that was at some point on the server. Now you’re either unable to do so, or you’re getting a ‘domain already exists’ type error. Here is a checklist of things to check to clear out the domain via SSH:

  • Remove domain from /etc/userdomains
  • Remove domain from /etc/trueuserdomains
  • Remove domain from /etc/named.conf
  • Move zone file from /var/named/ to /root
  • Reload named via ‘rndc reload’
  • Edit user file in /var/cpanel/users/ to not contain the domain(s)
  • Remove vhosts from /etc/httpd.conf
  • Reload apache via ‘service httpd stop; sleep 10; service httpd startssl;’
Posted in cPanel Guides | Tagged , , , , , | Leave a comment

Download a backup over 2GB through cPanel instead of Apache.

Apache/FTP in some configurations can’t serve files that are over 2GB. This has been largely corrected on most HEL/CentOS cPanel servers, but there are legacy exceptions. There is a way to get such a large file via a cPanel function. This is typically useful when a customer has a large backup. Here is an example of the process to retrieve a large backup:

  1. Generate a full backup via cPanel.
  2. SSH into the server you will be transferring the data to, or just open your browser if you need to download a copy.
  3. You can now wget http://user:pass@domain:2082/getbackup/backup-date_username.tar.gz or use your browser to get the file.
  4. Make sure to replace date and user with the correct info that matches the backup file.
Posted in cPanel Guides | Tagged , , , , | Leave a comment

Secondary Exim Port for cPanel and WHM.

Some ISPs block outbound connections to servers on port 25 for SMTP. This is becoming less common, but still occurs on smaller or foreign ISPs. The reason they block this port is to prevent compromised client computers, especially botnets, from being used to send spam to other mail servers. So what do you do if you or a customer need to connect to your cPanel/WHM VPS or dedicated server to send mail through Exim? Continue reading

Posted in cPanel Guides, E-Mail & SMTP Guides | Tagged , , , , , , , , , , | Leave a comment

See logged in users on CISCO IOS and disconnect them.

So you may want to see who else is accessing the switch or router that you’re on. Sometimes this is because you get a write error when trying to save the running config. The error would be something like:

startup-config file open failed (Device or resource busy)

This is because another user is utilizing the running config. It could even be a timed out user that didn’t disconnect yet. So what can we do? First of all lets find the right command. The command you want is the ‘systat’ command, which is used to “Display information about terminal lines” of the active device. It may take a few moments to run, and will show you something like this:
Continue reading

Posted in CISCO IOS Guides | Tagged , , , , , , , , , , , , , | Leave a comment

Disable ModSecurity For Single Vhost

Some times you may find that a script trips a ModSecurity rule, but the rule is useful for general security on the box. If it’s your own site, it’s easy enough to change the code. However if it’s a customer’s site you can’t. You can however disable ModSecurity via this code in httpd.conf for the domain’s vhost. NOTE: This will disable all mod sec rules for that domain:

<IfModule mod_security.c>
     SecFilterEngine Off
     SecFilterScanPOST Off
</IfModule>
Posted in cPanel Guides, Linux Guides | Tagged , , , , , , , | Leave a comment

Kill All Sleeping MySQL Connections

Sometimes you may find that your server has a ton of MySQL connections with their state set to “Sleep”

mysqladmin proc | grep Sleep | awk '{print $2}' | while read LINE; do mysqladmin kill $LINE; done

This will clear out those connections. You will need to look at your MySQL config and see how long you’re allowing connections to remain open. Furthermore if there is a single user opening too many you need to limit max client connections.

Posted in Bash One-Liners | Tagged , , , , , , | Leave a comment

CentOS 6 Yum-Cron Automatic Updates

Some of us prefer the yum-cron method of automatic updates. CentOS 6 shipped out with a daemonized updater that may not suit your particular needs. Here is the proper procedure for switching over to yum-cron:

yum install yum-cron
chkconfig yum-cron on
chkconfig yum-updatesd off
service yum-cron start
service yum-updatesd stop

You should then run a ‘yum update’ to make sure you’re currently up to date. This will also show you that there are no conflicts. Remember, if there are conflicts yum won’t be able to update. This means that yum-cron won’t be able to auto update you either. Resolve ANY conflicts before assuming your system will be staying up to date.

Posted in Linux Guides | Tagged , , , , , , , , , | Leave a comment