by michi | Dec 27, 2013 | RHEL
[root@centos5 ~]# rpm -qa gpg-pubkey* --qf "%{version}-%{release} %{summary}n"
e8562897-459f07a4 gpg(CentOS-5 Key (CentOS 5 Official Signing Key) )
217521f6-45e8a532 gpg(Fedora EPEL )
6b8d79e6-3f49313d gpg(Dag Wieers (Dag Apt Repository v1.0) )
Now delete the repoforge gpg key (dag’s key).
[root@centos5 ~]# rpm -e gpg-pubkey-6b8d79e6-3f49313d --allmatches
[root@centos5 ~]# rpm -qa gpg-pubkey* --qf "%{version}-%{release} %{summary}n"
e8562897-459f07a4 gpg(CentOS-5 Key (CentOS 5 Official Signing Key) )
217521f6-45e8a532 gpg(Fedora EPEL )
by michi | Oct 7, 2013 | *nix, RHEL
One of my CentOS Test VMs is a standard install with / living on a LVM. Re-assigning the VMs hard disk a larger size in virtualbox is easy (on the cli ofc).
michi@imagine ~ $ VBoxManage list hdds
michi@imagine ~ $ VBoxManage modifyhd /media/stuff/vms/centos6.vdi --resize 15000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Though, the magic boot-resize2fs-done does not apply here đ
First, use fdisk to recreate the partition using all cylinders.
- p … list all partitions (note: 1912 cylinders)
- d – 2 … delete secondary partition
- n – p – 2 … create new primary partition
- 64 – 1912 … old start, new end (noted from above, and auto-selected)
- t – 8e … set type to Linux LVM
- p … verify new partition layout
- w … write changes to disk
Then reboot the vm.
[root@localhost coding]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Befehl (m fĂŒr Hilfe): p
Platte /dev/sda: 15.7 GByte, 15728640000 Byte
255 Köpfe, 63 Sektoren/Spur, 1912 Zylinder
Einheiten = Zylinder von 16065 Ă 512 = 8225280 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000051ef
GerÀt boot. Anfang Ende Blöcke Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 endet nicht an einer Zylindergrenze.
/dev/sda2 64 1045 7875584 8e Linux LVM
Befehl (m fĂŒr Hilfe): d
Partitionsnummer (1-4): 2
Befehl (m fĂŒr Hilfe): n
Befehl Aktion
e Erweiterte
p PrimÀre Partition (1-4)
p
Partitionsnummer (1-4): 2
Erster Zylinder (64-1912, Vorgabe: 64): 64
Last Zylinder, +Zylinder or +size{K,M,G} (64-1912, Vorgabe: 1912): 1912
Befehl (m fĂŒr Hilfe): t
Partitionsnummer (1-4): 2
Hex code (L um eine Liste anzuzeigen): L
Hex code (L um eine Liste anzuzeigen): 8e
Der Dateisystemtyp der Partition 2 ist nun 8e (Linux LVM)
Befehl (m fĂŒr Hilfe): p
Platte /dev/sda: 15.7 GByte, 15728640000 Byte
255 Köpfe, 63 Sektoren/Spur, 1912 Zylinder
Einheiten = Zylinder von 16065 Ă 512 = 8225280 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000051ef
GerÀt boot. Anfang Ende Blöcke Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 endet nicht an einer Zylindergrenze.
/dev/sda2 64 1912 14845116 8e Linux LVM
Befehl (m fĂŒr Hilfe): w
Die Partitionstabelle wurde verÀndert!
Rufe ioctl() um Partitionstabelle neu einzulesen.
WARNING: Re-reading the partition table failed with error 16: Das GerÀt oder die Ressource ist belegt.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Synchronisiere Platten.
[root@localhost coding]# reboot
Having the partition layout modified, we can now extend the phyiscal volume to the new size.
[root@localhost ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup
PV Size 7,51 GiB / not usable 3,00 MiB
Allocatable yes (but full)
PE Size 4,00 MiB
Total PE 1922
Free PE 0
Allocated PE 1922
PV UUID JAWtzB-1vwT-t0w3-KjD1-tVFV-TVI7-51pInW
[root@localhost ~]# pvresize /dev/sda2
Physical volume "/dev/sda2" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
[root@localhost ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup
PV Size 14,16 GiB / not usable 836,00 KiB
Allocatable yes
PE Size 4,00 MiB
Total PE 3624
Free PE 1702
Allocated PE 1922
PV UUID JAWtzB-1vwT-t0w3-KjD1-tVFV-TVI7-51pInW
Now check the volume groups and the available cylinders (Note the Free PE 1702)
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 14,16 GiB
PE Size 4,00 MiB
Total PE 3624
Alloc PE / Size 1922 / 7,51 GiB
Free PE / Size 1702 / 6,65 GiB
VG UUID 5eot8g-GTdh-C1pD-V1SQ-VDHt-hV4M-ved3yq
Check the logical volumes and resize the root volume with the additional free PE 1702.
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/VolGroup/lv_root
LV Name lv_root
VG Name VolGroup
LV UUID 8K1Uvp-G5nN-DU08-7f3r-ql1T-iPSp-qNLTcv
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2013-02-14 20:40:06 +0100
LV Status available
# open 1
LV Size 6,54 GiB
Current LE 1674
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@localhost ~]# lvextend -l +1702 /dev/VolGroup/lv_root
Extending logical volume lv_root to 13,19 GiB
Logical volume lv_root successfully resized
Once done, resize the root filesystem online (another reboot does not hurt afterwards).
[root@localhost ~]# resize2fs /dev/VolGroup/lv_root
resize2fs 1.41.12 (17-May-2010)
Das Dateisystem auf /dev/VolGroup/lv_root ist auf / eingehÀngt; Online-GrössenverÀnderung nötig
old desc_blocks = 1, new_desc_blocks = 1
FĂŒhre eine Online-GrössenĂ€nderung von /dev/VolGroup/lv_root auf 3457024 (4k) Blöcke durch.
Das Dateisystem auf /dev/VolGroup/lv_root ist nun 3457024 Blöcke groĂ.
Verify the new size, and have fun!
[root@localhost ~]# df -h
Dateisystem Size Used Avail Use% EingehÀngt auf
/dev/mapper/VolGroup-lv_root
13G 3,2G 9,3G 26% /
by michi | Sep 9, 2013 | RHEL
Stolen from here.
# vim /etc/yum.repos.d/Centos-Base.repo
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=
$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=
$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=
$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=
$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=
$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=2
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=
$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=2
Then run the following commands to refresh the repo cache.
# yum clean all
# yum repolist
by michi | Sep 9, 2013 | RHEL
# vim /etc/sysconfig/keyboard
LAYOUT=âdeâ
KEYBOARDTYPE=âpcâ
# reboot
by michi | Apr 15, 2013 | *nix, RHEL
Once in a while I am required to setup some virtual machines to test various Icinga stuff (I know, that can be automated, but anyways – normal user systems are not either, so the challenge is to know what a blank system looks like).
For testing the Icinga RPMs, a CentOS 6 netinstall VM is a pretty obvious choice, also for further testing of Icinga 2. While installing isn’t that much magic, getting sshd to accept root logins and public key authentication is.
First, the vm requires some portforwarding in virtualbox, like putting the guest’s port 22 onto the host’s port 10022 (just greater than 1024 not to interfere with system services).

Boot the vm, and login there once. Now edit /etc/ssh/sshd_config and permit root login, as well as set authentication to pub key
# vim /etc/ssh/sshd_config
LoginGraceTime 2m
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#PasswordAuthentication yes
PermitEmptyPasswords no
Then edit /root/.ssh/authorized_keys and add your public key (the one from the host).
While this should work on every other system, CentOS 6 got a bug which prohibits sshd to access the root’s authorized_keys file when SELinux is runnning in enforced/permissive mode.
So, disable SELinux to the time being (it’s a localhost vm with restricted access anyways).
# vim /etc/sysconfig/selinux
SELINUX=disabled
and reboot the CentOS vm.
For lazyness, create yet another bashrc alias on the host running the vm.
alias vm_centos6='ssh root@localhost -p 10022'
VoilĂ !
by michi | Feb 15, 2013 | *nix, RHEL
I wasn’t expecting the install _that_ minimal when using the CentOS 6.3 netinstall iso – ssh works, but scp is missing.
# yum whatprovides "*/scp"
# yum install openssh-clients