Virtualmin Virtual Servers (GPL)

Following my last post I now found out that Webmin does not allow multi virtual servers :-(, BUT there is a module called Virtualmin Virtual Servers (GPL) which is what I need.

To save myself hassle, I installed a compatible OS (CentOS 6 64bit) and simply installed virtualmin from the install.sh command after downloading it:

cd /root
wget http://software.virtualmin.com/gpl/scripts/install.sh
sh ./install.sh

After this my next  move was to install csf lfd from configserver.com:
(there is now a new URI for the archive which I changed on 2017-02-08)

wget http://www.configserver.com/free/csf.tgz
wget https://download.configserver.com/csf.tgz
tar zxvf csf.tgz
cd csf
sh ./install.sh

Once installed integrate it in Webmin and you’re good to go.

– Install the csf webmin module in:
Webmin > Webmin Configuration > Webmin Modules > From local file > /etc/csf/csfwebmin.tgz > Install Module

Email access problems

All worked well from the word go except SMTP/POP3 (Dovecot) server; I was getting Failed to connect to localhost:143 : Connection refused  (as well as port 993,995,110 and 25) when trying to connect either via my email client or usermin.

System Information was reporting that Dovecot IMAP / POP3 Server was offline, and trying to start Dovecot failed:

Starting dovecot: Error: socket() failed: Address family not supported by protocol
Error: service(pop3-login): listen(::, 110) failed: Address family not supported by protocol
Error: socket() failed: Address family not supported by protocol
Error: service(pop3-login): listen(::, 995) failed: Address family not supported by protocol
Error: socket() failed: Address family not supported by protocol
Error: service(imap-login): listen(::, 143) failed: Address family not supported by protocol
Error: socket() failed: Address family not supported by protocol
Error: service(imap-login): listen(::, 993) failed: Address family not supported by protocol
Fatal: Failed to start listeners

After editing the /etc/dovecot/dovecot.conf file and commenting out/insert: listen = *  Here is how my edited file looks like:

# A comma separated list of IPs or hosts where to listen in for connections. 
# "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
# If you want to specify non-default ports or anything more complex,
# edit conf.d/master.conf.
#listen = *, ::
listen = *

Now, why would Dovecot server come with this line disabled is baffling, anyway, after this, Dovecot starts fine allowing usermin and email clients to connect without problems:

dovecot

 

Server heartbeat

This little perl program allows you to check the availability of an IP address via a cron command that outputs the result in a text file.

#!/usr/bin/perl
# This script pings IP addresses
#
# In a live application, read host list
# from a config file
@hosts = ("192.168.1.1","192.168.1.19");
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$mon += 1;
$min = sprintf("%02d", $min);
$sec = sprintf("%02d", $sec);
$mon = sprintf("%02d", $mon);
$mday = sprintf("%02d", $mday);
$year = sprintf("%02d", $year % 100);

@live = ();
foreach $h (@hosts) {
        $r = `ping -c2 $h`;
        if ($r =~ /2 re/) {
                push @live,$h;
                }
        }
$alive = "@live";
print ("You have $alive on $mday $mon $year @ $hour:$min:$sec\n");

This script can then be used in a cron like:

*/5 * * * * /path/to/file/pingtest.pl >> /some/path/pingtest.txt

This command will write the result on a new line in the file called pingtest.txt every 5 minutes. Which will look like that:

You have 192.168.1.1 192.168.1.19 on 06 01 13 @ 20:05:01
You have 192.168.1.1 192.168.1.19 on 06 01 13 @ 20:10:01
You have 192.168.1.1 192.168.1.19 on 06 01 13 @ 20:15:01

Plesk panel, backup strategy when low in space

Plesk backup is a real pain in the backside, if your server disk space is limited, even when choosing to backup in a ftp repository. All the files are created locally and then send over via ftp.

Prerequisites

Note that in order to implement this backup strategy, one must have an external backup space available like rsync.net (which I use) so that you can use the “rsync” command to transfer your files.

Minimising disk usage

In order to exclude any gigantic compressed (or not) archives being stored in your local hard drive, here is a little guide to help you avoid filling your server disk.

The first thing to backup regularly is the Plesk server configuration, this backup will not save the websites/email/database data but the content/configuration of your Panel, which is the first thing to restore if your server packs up.

Backing up Plesk (11) configuration

  1. Open your Plesk Panel as Admin
  2. Choose Tools & Settings from the Server Management sub-menu
  3. Click on Backup Manager
  4. Select Scheduled Backup Settings
  5. Activate the scheduled backup
  6. Select Store backup in: Server repository (or you can chose ftp there also as the files aren’t big, a couple of MB’s)
  7. I have set the Maximum number of backups in repository to “3”, but you can choose another value here
  8. Under the Backup content section, select  “
  9. Press OK

Obviously the choice of Schedule and prefix is at your convenience, I personally back up every day at 00:10 and the prefix is set to “configuration”.

If you aren’t using ftp, the content of this backup is stored in the /var/lib/psa/dumps/ directory. So in order to backup this on another server, simple rsync this location with a command that could be:

rsync -avz /var/lib/psa/dumps/ user@domain.rsync.net:var/lib/psa/dumps

If you don’t want to keep aggregated data add the –delete option:

rsync -avz --delete /var/lib/psa/dumps/ user@domain.rsync.net:var/lib/psa/dumps

To automate

To automate all this simply stick it in a cron (one can use the “Scheduled Tasks” under “Tools & Settings” (select root user) with a command that could look like this:

nice -20 rsync -avz --stats --delete /var/lib/psa/dumps/ user@domain.rsync.net:var/lib/psa/dumps 2>&1 | mail -s "backups dir rsync report" you@youremail

Databases

I will refer to MySQL databases in this section.

Database content is important, and you must back them up regularly, be it incrementally or not. I have Perl scripts that are in charge of dumping the content of the entire dataset and compress it. The file for my setup ends up being about 300MB, which is acceptable. I proceed to dump the content of the dataset via a “schedule” (root cron) and another cron simply “rsync’s” this file over to the backup server.

Email

All the email accounts are in /var/qmail/mailnames, the process is the same as above, use a rsync via a cron:

rsync -avz /var/lib/qmail/mainames/ user@domain.rsync.net:var/qmail/mailnames

Website content

Same as email but the directory is /var/www/vhosts/ so:

rsync -avz /var/www/vhosts/ user@domain.rsync.net:var/www/vhosts

There you have it, obviously I am providing this entirely as guidance and will in no way be liable for any loss you may get using these instructions. Even if you are on a cloud server (like me) it is a good idea to be able to extract files, especially databases or web content should a mistake be made that a cloud server cannot prevent like deleting a site by mistake etc…

Feel free to comment if you have any questions or if I have missed some important bits to backups that a Plesk backup may make which aren’t in this article.

Thunderbird: There was an error saving the message to Draft. Retry?

There was an error saving the message to Draft Retry? = Crash

A nagging problem has really made me crazy today, so much so that I finally decided to fix it. As usual this problem is probably not common, basically I could not save messages in the draft folder on one of my accounts. I don’t usually use the Draft folder, however Thunderbird does, automatically, try to save messages into draft after a set period. Having a problem saving to draft always led me to lose very long messages for ever (having to restart the whole thing really did it for me!). So  I tried the following:

  1. Compact folder (a popular one for Thunderbird users)
  2. Changed the folder permissions
  3. Deleted the folder and the Draft.msf file
  4. Repaired folder (under folder properties)

None of the above worked.

The fix

So if this happens to you also, this is how I finally fixed it:

  • Closed Thunderbird
  • Created a new folder under the Mail directory
  • Changed the local folder in the account settings > server settings in Thunderbird to point to the newly created above folder.
  • Copied the content of the old folder to the new one (I omitted  the Draft folder  and draft.msf file though, they were empty – remember I could not save into it)

Restarting Thunderbird made the problem go away. Finally!

 

How Exciting!

Just added a new Plugin on this Blog to enable me to be more creative. I am still experiencing with it. I am glad to see that one of the biggest issues with CMS systems is still their level of complexity.

The most important barrier to past, modern and future technologies is simplicity and foremost usability and ability to remember how it works. In 2001 that was when I saw a website called Superupdate, now Hannon Hill advertising their CMS, I looked into it, it was relatively simple. So I though, I can easily do that even easier and simpler and created my own CMS system A very simple system, so simple that It is for people that are barely able to use Computers at all. Most of these people being the mature generation,

This is not a problem for things that you’re using all the time like Smart phones (well how much do you actually know about the phone you’re using? Do you know for example it’s got a feature allowing you to make phone calls). It’s more like when you tend to not do it often and you’re not an Internet Guru, let alone a PC wiz kid. For most people having or managing a website is not necessarily something they do on a full time basis. like the chairman of a Club or a charity or a one man business. That is my target market. My website design site provides an unique design plus the ability to edit the pages easily and fast without having to hold a degree in Computing Science. My clients only contact me when they need technical assistance, it works because it is KISS.

WordPress

This CMS system is quite good I must say, (the one that I used to create this content.), it is relatively simple, the strategy is working great especially the Plug-In system, although I must say that I struggle, it’s getting too complicated for me already.

How Exciting?

Now the reason, finally, of my excitement is that when you are using WordPress you tend get a lot of spam messages (well this site does). I am happy to announce that on this front there’s  been a development, with the use of a Plug-in called Spam-stopper which is the easiest one ever. I have yet to receive a single spam comments 🙂 or any comments at all for that matter.

File access PHP on Plesk

On certain occasions, and if you’re running Plesk on a dedicated server (like I do), there are certain problems with file access and other upload permissions which aren’t allowed unless you turn file permission to 777!

Obviously this isn’t the recommended way to operate a website, turning directories and files all open with rwx is kind of risky.

So I have found a solution that works everytime, simply change the “PHP Support” to run as “FastCGI Application” instead of the default “Apache”. This option is found under the Hosting setting of the domain.

I must point out that this hack only works if you’re running Plesk (10+) on Linux Servers.

How to create a bootable WIN7 USB flash disk?

  1. Connect the USB drive On a Win7 Machine
  2. Partition the USB disk drive NTFS, if the disk is large (i.e. 1TB, reduce active partition to say, 6GB, I used gparted on Linux ;-p)
  3. Run DISKPART in command line
  4. LIST DISK
  5. SELECT DISK n (n is the number matching the USB disk obtained above)
  6. CLEAN
  7. CREATE PARTITION PRIMARY
  8. then copy the content of the DVD with XCOPY e:\*.* /s /e /f j: (e: = CD drive, j: = USB drive)

Enable Grub multi-boots after re-installing Windows

My current working PC is a Dell Studio 1537 Laptop. This Laptop is configured with two Operating Systems; the first is Windows XP Pro, the second is Linux, more precisely Kubuntu.

Kubuntu is my [favourite] working OS, however the rest of my family “prefer” Windows for “Gaming”, I occasionally need to be able to use Windows in native mode for my work (I am a Webmaster for several Websites) so I need to see how they work using Internet Explorer :-(, mind you I usually use Virtualbox on Kubuntu to achieve this [but it’s a little slow], so I have a Dual boot which is managed by Grub. I have been playing with different versions of Windows on this Computer, the pre-installed OS was Windows Vista, which quite frankly, sucks. So I tried to install Windows XP Pro pretty much straight away. I gave up when I encountered the Blue Screen Of Death (BSOD) and subsequently installed the 90 days Windows 7 Enterprise trial.

This Version worked very well, only to shut down every hour as it was,after all, a trial version. So I had to find a solution to this, I finally decided to retry installing Windows XP Pro as there was no way that I’d re-install that joke of an Operating system called Vista.

The other problem, is that MS Operating System overwrites the MBR (Master Boot Record) and therefore prevents me from having Grub giving me the options of which partition I want to boot from.

So here is walk through of how to:

  1. Backup the MBR (which is always a good idea by the way)
  2. Change the BIOS “Onboard Devices>SATA Operation”
  3. Install Windows XP Pro on the first Partition
  4. Install [almost] all the missing Drivers
  5. Re-install the backed up MBR and reconfigure Grub afterwards

In the past, every time I was re-installing [any] Windows, I never managed to figure out how to overcome the MBR being overwritten, the HowTo’s where very daunting and I always resolved the problem by re-installing the Linux OS afterward due to lack of spare time, as a side note, one of the recommendation I have is that: it is always a good idea to have a home (/home) partition separated from the root (/) partition*.

Linux is more forgiving than Windows (and, shall I say, less monopolistic) by gladly allowing several OS’es living side by side on the same Hardware and thus performs a multi-boot initialisation operation after each fresh install.

The other challenge is that this particular version of Hardware [Studio 1537] is not supported by Dell to run Windows XP Pro. That makes work just a little more difficult.

So here are the steps in more details…

1) Backup the MBR

To backup the MBR of a Disk with Linux is really simple. Open a terminal window and type:

sudo dd if=/dev/sda of=/media/External/sda.mbr count=1

Where /media/External can be an external Hard drive or USB stick etc… It’s best to have this file saved out-with the Hard Disk Drive that will be worked on, just to be on the safe side.

2) Change the BIOS

At boot. press F2 and go to the Onboard Devices>SATA Operation and change AHCI to ATA. Save the configuration then reboot. (this operation is only needed once, subsequent re-installs do not require this step)

3) Install Windows XP Pro on the first Partition

My System has a couple of Partitions:

  • sda1 = Windows + MBR
  • sda5 = Linux / + Grub
  • sda6 = Linux /home
  • sda7 = swap

Obviously Windows must be installed on the first Partition and that’s where the MBR is.

Simply insert the Windows XP Pro installation CD, tell it to use the first Partition (optionally format it as NTFS) and follow the installation instructions. This will install a working version of windows with minimal functions.

4) Install all the missing drivers

Once windows has finished being installed, all the drivers [that have not been already installed, and that’s quite a few] must be installed. This is where it is getting a little tricky. Due to the futile nature of the web, it is like looking for a needle in a haystack in most parts, not to mention the huge amount of websites that try to entice you to install their rogueware.  The first descent source of information regarding the required drivers I have come across is Dell Studio 1535 converted to XP Professional  (this link is now rotten) by “Wickman Studios”. Most of the drivers are available here. For my particular configuration, it’s been trials and errors, as I haven’t kept tab on the different drivers’ executables I tried, it is kind of difficult to be specific.

The last few drivers I needed that Wickman Studio Post did not have were the “unknown” device which I managed to solve with I found on Dell Studio 1537 Windows XP Drivers / Downgrade (this link is now rotten) written by “AZ cloud tech” which is also a good source of information.

I still had issues with the ITECIR Driver which I eventually found on the Lenovo website (this link is now rotten) (the link from the Wickman Studios was throwing a “zip file corrupted” error during install).

The final problem I still have is the 1394 Firewire Network adapter not being recognised, but I have disabled it as I don’t really need it, if you have any idea let me know 🙂

Once I got [almost] everything working, I installed all the Windows Updates and the [free!?] Microsoft Security Essentials (MSE) which is the only thing I will ever recommend to use from Windows, that’s rare coming from me, trust me.

 5) Re-install the MBR and reconfigure Grub

For this part, I wish to thank John S. Denker for his information regarding  How to Reinstall Grub Onto Your MBR which was extremely useful and the first clear and concise Howto I managed to follow and recover my Dual boot system with.

After a few lots of trials and errors I managed to get the Dual boot working. Here’s the final order I used:

  1. Back up the MBR before anything else
  2. Restore the MBR without disturbing the current partition table
  3. Get the system to boot, note: my $partition on point 6 is sda5 but it might be something else for your System, So I am not responsible if your system fails!

In my first atempt to install Windows, I had a fail due to a problem with the sda1 Partition, there was a formatting issue (probably due to the fact I installed winXP without reformatting the old Win7 Partition first), so when I tired to do a Follow up I got a “Stage 1 error”  this problem got fixed when I did a full NTFS format prior to installing Windows XP again.

I also played with Using Grub Command Directly as before the re-install I was faced with the grub> command prompt at boot :-(, so just for the record, my root device is /dev/sda5. In addition as I had grub 2 installed, the correct command went from root (hd0,<tab> to:

set root='(hd0,<tab>

which in full is (don’t ask! It’s for the Record):

set root='(hd0,msdos6)'

Subsequently, the next command looks like:

linux /boot/vmlinuz-... root=/dev/sda5

Well, that’s it in a nutshell, I hopefully will not need to perform any of this again, as I made an disk image of sda1 with partimage and dd which is safely stored on an external USB Hard Disk Drive, I also have a complete backup of all the web pages, Zip archives and exectuables mentionned in this post just in case. One knows the elusive nature of the Web these days… So I hope this was worthwhile and may prove useful to someone else, in which case, good luck and let me know how you did.

*That way I can format / without losing all my stuff and simply mount my home Partition as /home after my install. This is also very useful when doing an upgrade as I know that none of my Data will be overwritten, I also do regular backups, that goes without saying.

Kmail migration – for the record

Transfer mail and settings to another computer (or another user account on the same machine)

Solution: The messages are typically in ~/.kde/share/apps/kmail/. For very old installations of KMail, the messages can also be in ~/Mail. Note that KMail uses hidden sub-directories inside that directory, so you need to make sure to copy hidden directories as well.

For settings you will need to copy the following files:

  • ~/.kde/share/config/kmailrc,
  • ~/.kde/share/config/mailtransports, (since KDE 4.0)
  • ~/.kde/share/config/emaildefaults and
  • ~/.kde/share/config/emailidentities .

Your address book is usually stored in ~/.kde/share/apps/kabc/. Calendar data is in ~/.kde/share/apps/korganizer

Be aware that some distributions use ~/.kde4 instead of ~/.kde/ for their KDE configuration data.

From version 4.4 you may have some Akonadi-controlled entries that also need to be kept. Add to the above list –

  • Everthing under ~/.local/share/
  • Everything under ~/.config/akonadi/.
  • ~/.kde/share/config/nepomukserverrc
  • Everything under ~/.kde/share/apps/nepomuk/ (KAddressBook stores contact groups in Nepomuk.)

Network manager not enabled on Kubuntu 10.04

For some unknown reason, kubuntu network manager caked on me, the way to restore it is to do the following:

sudo service network-manager stop
cd /var/lib/NetworkManager/
sudo rm NetworkManager.state
sudo service network-manager start

After these commands, the network manager was back on. Now why would this be needed? This is the one thing that really gets me to think that Windows might be bloated but it always kind of “works”