Friday 24 July 2015

Adding a new volume to server


The following is assuming that the server can already see the disk

Scan on linux box
                                                                                                                                                                             
ls /sys/class/scsi_host/ | while read host ; do echo "- - -" > /sys/class/scsi_host/$host/scan ; done

vgcreate vg_data2 /dev/sdd

To view the volume group
vgdisplay

4. Create the logical volume
lvcreate -n lv_data2 vg_data2 -l 100%VG

To view the logical volume
lvdisplay

5. Make the filesystem
mkfs -t ext4 /dev/vg_data2/lv_data2

6. Create the mount point and mount
mkdir /data2

mount -t ext4 /dev/vg_data2/lv_data2 /data2

7. Make permanent by adding to /etc/fstab
/dev/mapper/vg_data2-lv_data2 /data2                 ext4    defaults        1 2

Debugging DNS


Note: Do not do this at peak times as it produces a lot of grunt


  1. rndc trace 9
To turn on trace

  1. Perform test
To produce output

  1. rndc notrace
To turn off trace

Output will be in /var/named/data/named.run

Tuesday 13 August 2013

Use iptables to block ssh access to your server



You should read up on iptables first before making any changes to any meaningful servers

http://en.wikipedia.org/wiki/Iptables

To block inbound ssh access to your server do the following

iptables -A INPUT -p tcp -m tcp --dport 22 -j DROP

-A means "Append to INPUT chain"
-p means "protocol" in this case TCP
-m means "load module" i.e. match the protocol TCP
-dport means destination port, in this case 22
-j means what to do if the rule is matched i.e. DROP

Make sure that line is above this line in the configuration as iptables reads from the top to the bottom down:

iptables -A INPUT -p tcp -m state --state NEW,ESTABLISHED -j ACCEPT

Thursday 25 July 2013

Install gcc with all pre-requisites - easily!



Download the tar file from http://gcc.gnu.org

untar to /tmp or wherever

cd to /tmp/

Run this command to get correct versions of mpfr, mpc, gmp:

./contrib/download_prerequisites

Then compile as usual

./configure
make 
make install

Tuesday 23 July 2013

Installing VMWare Tools on RedHat 5

scp the VMWare tools iso to /tmp on machine that will be installed.

Mount from within ESXi – Right click the host and select install vmware tools

ssh to machine and mkdir /mnt/cdrom

mkdir /mnt/cdrom

mount /dev/cdrom /mnt/cdrom/

cd /mnt/cdrom

cp VMwareTools-8.6.0-425873.tar.gz /tmp/

cd /tmp and tar zxf VMwareTools-8.6.0-425873.tar.gz

cd vmware-tools-distrib/

cd INSTALL

Run /vmware-install.pl and pick the defaults.


Wednesday 10 July 2013

Unpacking ISO files



Linux

mkdir /mnt/iso
mount -o loop disk1.iso /mnt/iso
cd /mnt/iso
cd /mnt/iso/RedHat/RPMS

Solaris

Given an ISO image in /export/temp/software.iso, a loopback file device (/dev/lofi/1) is created with the following command:
lofiadm -a /export/temp/software.iso /dev/lofi/1

The lofi device creates a block device version of a file. This block device can be mounted to /mnt with the following command:
mount -F hsfs -o ro /dev/lofi/1 /mnt

These commands can be combined into a single command:
mount -F hsfs -o ro `lofiadm -a /export/temp/software.iso` /mnt

Tuesday 9 July 2013

How to add some extra IP addresses - Solaris and Linux


Linux

Increase the eth0: by 1 and the IP by 1 

/sbin/ifconfig eth0:1 10.xx.xx.xx netmask 255.255.255.xx broadcast 10.xx.xx.xx up

To make permanent after reboot:

Add the lines to the /etc/rc.d/rc.local file as such:

/sbin/ethtool -s eth0 speed 100 duplex full autoneg off

/sbin/ifconfig eth0:1 10.xx.xx.xx netmask 255.255.255.xx broadcast 10.xx.xx.xx up                     

Solaris

ifconfig ce0:1 plumb
ifconfig ce0:1 10.xx.xx.xx netmask 255.255.255.xx up

To make permanent after reboot:

Add IP to /etc/hosts and more importantly

echo 10.xx.xx.xx > /etc/hostname.ce0:1