Longview with Varnish

Linode's Longview service gives you a great insight into how welll your server is running. The standard automatic install failes when trying to set Nginx monitoring up if you have Varnish or something else listening on port 80. Thankfully there is a simple fix.

When promted choose no to the automated setup.

Add the following to your Nginx site configuration:

server {
listen 127.0.0.1:8090;
server_name 127.0.0.1;
location /nginx_status {
    stub_status on;
    allow 127.0.0.1;
    deny all;
 }
}

The above code will open a nginx status page (which Longview users to get its information) on port 8090 which only listens on the loop back address.

To finish simply configure longview to use the correct URL using the file below:

nano /etc/linode/longview.d/Nginx.conf

The file should look like this:

Lastly restart longview:

service longview restart

If it works you should see data begin to be gathered and displayed like below:

Linode finished

Setting G Suite Relay up in Ghost

Setting up a G Suite (formally Google Apps) is easy in Ghost. Simply configure G Suite to allow the IP address of the server in the SMTP relay service settings.

To finish simply set the following mail settings in your instances config.js

mail: {
          transport: 'SMTP',
          options: {
            host: 'smtp-relay.gmail.com',
            port: 587,
          }

    },

How to fix thin print driver install failure in Windows 2000 when using VMWARE

When working with Windows 2000 you may notice that you can't install the thinprint drivers and you get an error saying "RUNDLL Error loading tpvmmon.dll the specified procedure cannot be not found" or:

Printer User Interface Printer rundll command failed. 

Command: /ia /f "C:\Program Files\Common Files\VMWare\Drivers\Virtual Printer\TPOG3\OEMPRINT.INF" /r "TPVM:" /m "TP Output Gateway" /h "Intel" /v "Windows 2000"". 

Here is a fix. I have tested this on VMWARE fusion although it should work in VMware player and workstation if you end the files in Windows and use the correct link. The trick is to roll back the vmware tools to the last version that works.

I have provided official VMWARE links below:

Vmware Fusion (tested on 8.5.1) - https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/7.1.3/3204469/packages/com.vmware.fusion.tools.windows.zip.tar

Vmware Player & workstation - https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/7.1.3/3204469/packages/com.vmware.fusion.tools.windows.zip.tar

Before we being we are going to shut the virtual machine down. Open up the folder where the virtual machine is stored. Right click the Virtual Machine and click "Show package contents"

Show package

Within this folder will be a file called <machine name>.vmx - right click this file and edit it with a text editor. I used BBEdit in this example.

machine file

Change it to:

tools.upgrade.policy = "manual"

Extract the tar file by double clicking it.

Go into the folder and mount windows.iso into the virtual machine:
mount iso

The thinprint and other drivers will install (press yes if you are prompted to install the print drivers as below):

After a reboot the printer will be visible (you may have to wait a few seconds for the driver to fully load)

Fixing Windows 10 with BootCamp - when it won't install and you've tried everthing

I use a Mac Mini Late 2014 which has a fusion drive. I hit a common problem where it refuses to install saying either:

  • We couldn't create a new partition or locate an existing one
  • The Partition type is GPT

I have tired a number of suggestions for fixing this issue with no luck. In the end I figured out a surprsingly simple solution, its part mine, part macriot.com

Create the USB media as normal

Boot camp USB media creation

Reboot the Mac
Now add the bootcamp parition in the normal way
Boot campt partition

The Mac will reboot automatically.

If you see the partition type is GPT:

  • Turn the Mac off by holding the power button down
  • Turn the Mac on again and hold the alt key down.

The boot menu will appear, pick the efi option and press enter:

The Mac will start setup again:

If you format the bootcamp partition and then press next you will get the "We couldn't create a new partition or locate an existing one"

To fix this all you have to do is look at the other paritions. For some reason the fusion drive creates two EFI partitions. This confuses windows setup.

If you look at partition 4 (which is the bootcamp partion) it is on Disk 1. So we will simply delete the EFI partition on Disk 0. Unfortunatly I fotgot to take a photo of this.

Highlight the EFI on Drive 0. Press delete and leave the small 200mb partition as unused space.

You should now have just have the one:

Press the bootcamp partition again in most peoples case partition 4. Press next and it will work.

Vmware Fusion to Hyper-V Disk Conversion using a Mac

Today I wanted to convert a virtual machine from VMWare Fusion to Hyper-V using a Mac. There is talk of doing it on Windows but nothing on a Mac. The process is actually nearly identical you just need to swap a few things round and learn where the tools are.

The Microsft VM convertor tool assumes the VMDK files are in a single file. VMWare fusion seems to split the files up by default. I did not find this
worked. I used VMWare Fusion to merge into a single image then used winimage to convert.

The first thing we need to do is merge them together using the following method. If you don't do that you will get an error like below:

powershell conversion error

Before you do anything ensure your virutal machine is powered down and VMware tools are removed.

Firstly open terminal. To access the commands you need to go into the application bundle itself to that do the following:

cd /Applications/VMware Fusion.app/Contents/Library/

Now run the following command noting the correct vm. In this example my VM is called Windows on a drive called Virtual Machines.

./vmware-vdiskmanager -r /Volumes/Virtual\ Machines/Windows.vmwarevm/Virtual\ Disk.vmdk -t 0 /Volumes/Virtual\ Machines/test.vmdk

Copy over the single file to your windows server or workstation running hyper v. Ensure you have the win image software installed. You can download a trial.

Use WinImage to convert the HD from VMDK to VHD selecting convert a virtual disk image as shown below:

Open Hyper-V create a new virtual machine ensuring you select the existing virtual hard disk. Start the new virtual machine.

To complete uninstall vmware tools using programs and features.

Setting up Sophos Antivirus for Linux

Most people use ClamAV for their server anti virus, some still question the need to have antivirus on their servers. On that point, its true there is very few virus / malware out there for Linux. If it comes from your server and the user is running Windows for example it can infect them. Its also your reputation to think about.

Although Sophos claim 1GB as the minimum RAM requirements, it does run on a 512mb Digital Ocean droplet without issue.

Setting up

To get started go to here to download https://www.sophos.com/en-us/products/free-tools/sophos-antivirus-for-linux.aspx

1) Extract the file you download and upload the folder to your server using SFTP.

2) Connect to your server over SSH and elevate to root.

3) Change to the sophos folder using cd sophos-av/

4) Run (with root privileges) ./install.sh

5) Sophos AV will install, follow the prompts ensuring you select the free option

If you have a supported operating system that Sophos provides pre compiled kernal modules for you are finished. If you don't have a OS that has pre compiled binaries like myself who uses Debian follow these steps:

If you don't have a standard OS supported by Sophos

Again ensure you are running with root privileges:
1) Ensure make is installed with apt-get install make

2) Ensure the extra header packages are installed to allow the custom module to compile correctly apt-get install linux-headers-$(uname -r)

3) Install the modules and let it compile by running: /opt/sophos-av/engine/talpa_select select

4) Restart the service using /etc/init.d/sav-protect restart

Sophos Logo