Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Friday, September 27, 2013

How to install Logwatch on cPanel servers running CentOS 6

Logwatch isn't included by default in CentOS 6 & cPanel installs. You can install it manually by following these instructions:
  1. Go get the latest version of logwatch by going to: http://sourceforge.net/projects/logwatch/
    Make sure you download the NOARCH rpm file.
  2. Log into your cPanel server, and run the command as root or with appropriate sudo permissions:
    $ rpm -Uvh logwatch-7.3.6-1.noarch.rpm
  3. Now you need to edit the logwatch.conf file to add some lines to get it working:
    $ nano -w /usr/share/logwatch/default.conf/logwatch.conf
  4. Add the following lines after tmpdir = /var/cache/logwatch:
    #Output/Format Options
    #By default Logwatch will print to stdout in text with no encoding.
    #To make email Default set Output = mail to save to file set Output = file
    Output = mail
    #To make Html the default formatting Format = html
    Format = text
    #To make Base64 [aka uuencode] Encode = base64
    Encode = 0
  5. Save the file.
That is it. You can test your changes immediately by running the following command or wait until the daily cronjob is run.
$ perl /etc/cron.daily/0logwatch > /root/output.txt
$ less /root/output

Thursday, May 23, 2013

Count how many times your Wordpress login page has been requested

With all of the hacking and botnet activity probing Wordpress sites the past few months, you might wonder how many times your Wordpress login page (wp-login.php) has been requested. Here's a command that you can run from the terminal prompt to see:

/home/user $ grep -c wp-login access.log
On my personal Wordpress site, I found the following results:
  • May 5th to 12th - 598 http requests 
  • May 12th to 19th - 7,555 http requests
  •  May 19th to 22nd - 55 http requests
Very interesting indeed.

Tuesday, November 20, 2012

Installing ConfigServer Firewall (CSF)

http://configserver.com/cp/csf.html

If you get the following error during installation:
Checking Perl modules...
Can't locate LWP/UserAgent.pm in @INC (@INC contains: /etc/csf /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at (eval 19) line 2.
BEGIN failed--compilation aborted at (eval 19) line 2.
Then you need to install perl-libwww-perl package (as well as its prerequisites).
yum install perl-Compress-Zlib perl-HTML-Tagset perl-URI perl-HTML-Parser perl-libwww-perl

Friday, November 16, 2012

OpenVZ VPS CentOS Linux setup notes

OpenVZ VPS running CentOS Linux, setup notes:

To change the timezone:
[root@voyager asterisk-1.8.18.0]# date
Sat Nov 17 06:12:49 MSK 2012
[root@voyager etc]# ln -sf /usr/share/zoneinfo/EST /etc/localtime
[root@voyager etc]# date
Fri Nov 16 22:13:52 EST 2012
Make sure to restart your VPS and also check the syslog daemon that it has its time properly. I noticed I had to restart the syslog daemon service to get the date and time updated.
service syslog restart

Thursday, June 7, 2012

How to receive an e-mail alert when your linux server or linux VPS restarts

Here is a quick tip on how to receive an e-mail alert if your linux server or linux VPS restarts:

1. Log into your linux server or VPS using ssh.
2. Type in crontab -e into the commandline.
            Depending on the default text editor, it could be nano or vi. Here are the directions for vi:
3. Press insert button on your keyboard.
4. Then type in @reboot echo "Rebooted, now online" | mail -s "`hostname` REBOOTED" you@yourdomain.com
5. Then type in :wq to save and quit the vi text editor.

If your default text editor is nano, then the commands to type in are:

3. Find a new line or create one by pressing the Enter key.
4. Now type in on one line:
@reboot echo "Rebooted, now online" | mail -s "`hostname` REBOOTED" you@yourdomain.com
5. Then press CTRL and X on the keyboard to save.
6. Press Y to save the changes. Press Enter to exit.

If you want to send the e-mail to multiple people, edit the line to show this instead:
@reboot echo "Rebooted, now online" | mail -s "`hostname` REBOOTED" -c "user2@yourdomain.com" you@yourdomain.com

Now you will receive an e-mail alert when your server or VPS reboots. Very handy in troubleshooting issues with your VPS provider or your own server.