rpm --scripts -qp rpmname.rpm
Tuesday, 7 January 2014
View what the spec file does on an RPM
This can be done using the following command:-
Thursday, 2 January 2014
Extend logical volume to occupy the rest of the free space
Check that nothing is locking the partition:-
Unmount the partition:-
Extend the partition:-
Check the filesystem:-
Resize the filesystem:-
Check the filesystem:-
lsof /opt/
Unmount the partition:-
umount /opt
Extend the partition:-
lvextend -l +100%FREE /dev/mapper/vg_root-lv_opt
Check the filesystem:-
e2fsck -f /dev/mapper/vg_root-lv_opt
Resize the filesystem:-
resize2fs -p /dev/mapper/vg_root-lv_opt
Check the filesystem:-
e2fsck -f /dev/mapper/vg_root-lv_opt
Remount the partition:-
mount /opt/
Saturday, 28 September 2013
Migrating VMs from Redhat to Ubuntu
Recently I have installed Kubuntu onto my PC and had some Virtual Machines that I had used on a Centos machine under Virt-Manager/KVM that I needed to use on the Kubuntu system. I thought this would be a simple enough process but ran into some problems.
When trying to start up VMs in Virt-Manager on Ubuntu I got the following message:-
To fix this I initially created a new VM to see what types it supported it does support Redhat VMs. Once this was created I viewed the XML for the image with the following command:-
test being the name of the new VM I had created. The following line was relevant:-
In my other VM I saw the following:-
So the problem is machine='rhel6.2.0' to change this run the following command:-
Then change 'rhel6.2.0' to 'pc-1.0' it should then boot
When trying to start up VMs in Virt-Manager on Ubuntu I got the following message:-
error: Failed to start domain blackhat.example.net supported
machines are
...
To fix this I initially created a new VM to see what types it supported it does support Redhat VMs. Once this was created I viewed the XML for the image with the following command:-
virsh dumpxml test
test being the name of the new VM I had created. The following line was relevant:-
<type arch='x86_64' machine='pc-1.0'>hvm</type>
In my other VM I saw the following:-
<type arch='x86_64' machine='rhel6.2.0'>hvm</type>
So the problem is machine='rhel6.2.0' to change this run the following command:-
virsh edit blackhat.example.net
Then change 'rhel6.2.0' to 'pc-1.0' it should then boot
Monday, 9 September 2013
ssh in a loop
Using ssh in a loop will break the loop to fix this use the -n flag, i.e:-
while read server
do
echo $server
ssh -n $server "ls -l /etc/rc.modules"
echo
done < servers
while read server
do
echo $server
ssh -n $server "ls -l /etc/rc.modules"
echo
done < servers
Tuesday, 3 September 2013
Show vendor when searching through installed RPMs
This is done using the %{VENDOR} tag. For example:-
rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE} %{VENDOR}\n'
rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE} %{VENDOR}\n'
Labels:
rpm
Monday, 2 September 2013
Highlight all occurences of selected word in vi
To do this:-
:set hlsearch
To undo this:-
:nohlsearch
:set hlsearch
To undo this:-
:nohlsearch
Labels:
vi
Subscribe to:
Posts (Atom)