Friday, March 21, 2014
Setup SNMP On A Linux Host
Monday, July 29, 2013
Problems Booting Centos Guest In A Virtual Machine
Problem
Booting into a fresh Centos installation inside a virtual machine results in a black screen. The Centos login screen does not appear. This problem has been replicated in VMWare Workstation 9, VMWare ESX 4.0, and Virtual Box.Resolution
This problem occurs when the Centos ISO is still attached to the virtual guest. Disconnect the Centos ISO and reboot the virtual machine.Saturday, July 13, 2013
Linux Error Message: inter-device move failed, unable to remove target: Is a directory
inter-device move failed, unable to remove target: Is a directory
In my case it turned out to be that the destination folder already existed. By changing the destination folder to a folder that didn't exist and the move worked straight away. It's weird because I would've assumed that the default behaviour would've been to merge the contents of the two folders and delete the source folder. I'll do some more research on this one when I get the chance.
Saturday, January 26, 2013
Mounting A Local Linux Folder
The problem comes us with the way bit torrent works. It's doing massive amounts of really small network IOs writing and reading blocks from the disk. In my case this happens across a 100 Mbps network. I don't think the Pi is handling it that well. The other side affect appears to be on the wdtvlivehub side of things. It looks like it's detecting the file changes and is always trying to recompile the media library. Side affect - the wdtvlivehub is not usable (but I'm sure fixable :) )
I've already added a powered USB disk to the Pi and the performance is much, much better. The next step is to relocate the existing torrents without upsetting transmission. To do this I'm going to setup a folder on the new external disk, move across my partially downloaded torrents, then mount this folder back to the original mount point.
To start with I'll create the new folders to match my existing structure
mkdir /media/usbdrive2/wdtvlivehubmkdir /media/usbdrive2/wdtvlivehub/temp
Next I'll copy the partially completed torrents across
mv /media/wdtvlivehub/temp/*.part /media/usbdrive2/wdtvlivehub/tempNext I'll add the following lines to my /etc/fstab:
/media/usbdrive2/wdtvlivehub /media/wdtvlivehub auto bind,gid=46,defaults 0 0To finish up I re-mount all the mount points specified by fstab
sudo mount -a
Saturday, January 19, 2013
Problems Mounting Drives Formatted With ExFAT In Ubuntu
mount: unknown filesystem type 'exfat'
sudo apt-add-repository ppa:relan/exfatsudo apt-get updatesudo apt-get install fuse-exfat
Friday, January 11, 2013
Enable Remote Connections to MySQL
Sunday, January 6, 2013
Ubuntu–Adding An Extra Disk To The Server
Note – these instructions don’t cover the physical side of adding a disk to your server. They assume that the disk has already been added and that we’re back at the command line.
# confirm details of second disk
sudo lshw -C disk
# open fdisk partitioning tool (assuming new disk is /dev/sdb)
sudo fdisk /dev/sdb
# at the menu press "n" and "enter" to create a new partition
# press "p" to create a primary partition
# press "1" to create 1 partition
# press enter to accept the default start position of the partition
# press enter to accept the default end position of the partition
# press "w" to write the partition
# create the filesystem
sudo mkfs -t ext4 /dev/sdb1
# create the mount point
sudo mkdir /srv
# automount the partition on startup - edit the fstab
sudo nano /etc/fstab
# add the following line
/dev/sdb1 /srv ext4 defaults 0 1
# remount the filesystems
sudo mount -a
To finish reboot the server and confirm the changes have taken affect and remain intact after the reboot.
Monday, December 19, 2011
How To Install A LAMP Server On Ubuntu
Open up a terminal session (or SSH onto the Ubuntu server) and run the following command:
sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql phpmyadmin
This will download approximately 40MB and use 105MB of disk space. During the install you will be prompted a couple of times:
- mysql admin password – enter a password of your choosing
- The next screen will ask you if you would like your webserver reconfigured automatically. Select apache2 and click ok.
- Congigure database for phpmyadmin with dbconfig-common? Select Yes
- Enter the mysql password you entered before for the phpmyadmin mysql configuration
- Enter a new administrator password for phpmyadmin
And voila – we done! To test that it’s worked point your browser to http://< server IP>. If everything’s worked you should have a page saying “It Works!”. To use the phpmyadmin tool to administer your site point your browser to /phpmyadmin">http://<serverIP>/phpmyadmin.
And finally the default web root is located at /var/www.
Sunday, December 18, 2011
Setup Nagios Monitoring – The Easy Way Part 3
In the first two parts of this guide we’ve installed Nagios 3 onto an Ubuntu server. We’ve restructured the layout of the configuration files so that they are more manageable. In this step we will look at time periods and how to configure them.
Time periods are used just that, a schedule that defines when things should or should not happen. Typical time periods defined in Nagios include:
- 24x7 – All the time, from 00:00 to 23:59 Monday to Sunday.
- Work Hours – 09:00 to 17:00 Monday to Friday.
- After Hours – All the time outside of the work hours.
- Never – Empty schedule with no times defined.
These time periods are used in a few places. Firstly they can be used to determine when host and service checks occur. For example we may want critical production servers to be monitored 24x7 but only want non critical servers monitored during business hours.
The second major place they are used is to determine when contacts should be alerted that problems have occurred. For example we may send alerts to an administrators email group during business hours but send an alert via SMS after work hours.
In the /etc/nagios3/timeperiods folder we’ll create four different time periods:
- /etc/nagios3/timeperiods/24x7.cfg
- /etc/nagios3/timeperiods/never.cfg
- /etc/nagios3/timeperiods/afterhours.cfg
- /etc/nagios3/timeperiods/workhours.cfg
First we’ll start by defining the 24x7 time period. Create the file /etc/nagios3/timeperiods/24x7.cfg as shown below:
# This defines a timeperiod where all times are valid for checks,
# notifications, etc. The classic "24x7" support nightmare. :-)
define timeperiod{
timeperiod_name 24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}
Next we’ll create the never time period as shown below:
# Here is a slightly friendlier period during work hours
define timeperiod{
timeperiod_name never
alias Never
}
Now we’ll create the afterhours definition:
# The complement of workhours
define timeperiod{
timeperiod_name nonworkhours
alias Non-Work Hours
sunday 00:00-24:00
monday 00:00-09:00,17:00-24:00
tuesday 00:00-09:00,17:00-24:00
wednesday 00:00-09:00,17:00-24:00
thursday 00:00-09:00,17:00-24:00
friday 00:00-09:00,17:00-24:00
saturday 00:00-24:00
}
And finally we’ll create the workhours definition:
# Here is a slightly friendlier period during work hours
define timeperiod{
timeperiod_name workhours
alias Standard Work Hours
monday 09:00-17:00
tuesday 09:00-17:00
wednesday 09:00-17:00
thursday 09:00-17:00
friday 09:00-17:00
}
These four time period definitions should cover most smaller IT shops. If you need another time period definition it’s as simple as creating a new text file in the /etc/nagios3/timeperiods folder and define the time periods accordingly.
So we’ve finished defining the time periods, in the next blog post we’ll look at defining contacts in Nagios which will make use of the time periods we’ve defined here.
Tuesday, December 13, 2011
Using Arping To Scan An IP Range For Duplicate IP Addresses
This script will scan an IP range for duplicate IP addresses using the arping command (Linux). Firstly you will need to install arping – in Ubuntu this can be done using the command:
sudo apt-get install arping
Then we need to create the bash script below. Make sure you customise the IP range to suit the range you want to scan. In the below example the script just appends the last number in the IP address sequence so you can only do 254 addresses in a single hit.
for i in $(seq 1 254);
do
echo "Checking 192.168.196.${i}";
sudo arping -q -d -i eth0 -c 2 192.168.196.${i}; [ $? -ne 0 ] && echo "192.168.196.${i} duplicate";
done
Now run this script from the command line to scan the IP range.