Showing posts with label CentOS. Show all posts
Showing posts with label CentOS. Show all posts

Sunday, January 8, 2012

VirtualBox installation on CentOS 5.6

Headless Virtualbox 4.1.8 install and setup on CentOs 5.6 Host

Create a user account
# groupadd vbox_admin (whatever user you would like here)
 
# useradd -d /home/vbox_admin -m -g admin -s /bin/bash vbox_admin


Enable the RPMforge repository as the dkms package (Dynamic Kernel Module Support Framework). It isn't available in the official CentOS 5.6 repositories.

# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

# cd /usr/local/src

# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

# rpm -ivh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

Install additional dependencies
# yum groupinstall 'Development Tools'

# yum groupinstall 'Development Libraries'

# yum install SDL kernel-devel kernel-headers dkms

 Verify your Kernel version
# uname -r

Example:
# uname -r
2.6.18-238.19.1.el5 

And now the architecture

# uname -m

Verify the headers located at /usr/src/kernels.

Create a symbolic link if necessary to resolve otherwise VirtualBox will fail when it attempts to build the kernel modules and can't find the necessary directory.

Example:
# ln -s 2.6.18-274.12.1.el5-x86_64 `uname -r`-`uname -m`

Download and register the VirtualBox public rpm key.
# wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc

# rpm --import oracle_vbox.asc

# rm -f oracle_vbox.asc

Enable the repository
# cd /etc/yum.repos.d/

# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

Install VirtualBox Software
# yum install VirtualBox-4.1

Should complete with the following or something similar

Running Transaction
  Installing     : VirtualBox-4.0                        1/1

Creating group 'vboxusers'. VM users must be member of that group!


No precompiled module for this kernel found -- trying to build one. Messages

emitted during module compilation will be logged to /var/log/vbox-install.log.

Stopping VirtualBox kernel modules [  OK  ]

Uninstalling old VirtualBox DKMS kernel modules [  OK  ]
Trying to register the VirtualBox kernel modules using DKMS [  OK  ]
Starting VirtualBox kernel modules [  OK  ]

Installed:

  VirtualBox-4.1-4.1.8_75467_rhel5-1.i386

Complete!

If you get an error on kernel modules go back and verify the kernel headers and symlink. 

Download and install the Extension pack associated with the installed version of VirtualBox.  This is required in order to run the system headless as it will establish the remote desktop session.

# wget http://download.virtualbox.org/virtualbox/4.1.8/Oracle_VM_VirtualBox_Extension_Pack-4.1.8.vbox-extpack 

Sudo or as root... 
# VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.8-75467.vbox-extpack

Note:  There is extensive documentation at virtualbox.org on the configuration and setting of all parameters including the use of multiple remote desktop sessions.  https://www.virtualbox.org/manual/

Add the user that will be running VirtualBox

# /usr/sbin/usermod -G vboxusers vbox_admin 
 
Command line -  Creating a VM (Windows 2003 Server, 3G, 200GB)

I wanted to use the mounted CD but found that problematic.  I'm sure there is a solution but for the the time being, I created an iso located at /home/vbox_admin/iso

# dd if=/dev/cdrom of=/home/vbox_admin/2003.iso

Become the vbox_admin user.

Review Options
# VBoxManage --help

# VBoxManage createvm --name "2003 Server" --register

#  VBoxManage modifyvm "2003 Server" --memory 3072 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0

#  VBoxManage createhd --filename 2003_Server.vdi --size 200000

#  VBoxManage storagectl "2003 Server" --name "IDE Controller" --add ide

#  VBoxManage storageattach "2003 Server" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium 2003_Server.vdi

#  VBoxManage storageattach "2003 Server" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /home/vbox_admin/iso/2003.iso

Just for good measure...
# VBoxManage modifyvm "2003 Server" --vrde on

Review your VM's settings 
# VBoxManage showvminfo "2003 Server"

2003 Server
Guest OS:        Other/Unknown
UUID:            ******-*****-*********-*****
Config file:     /home/vbox/VirtualBox VMs/2003 Server/2003 Server.vbox
Snapshot folder: /home/vbox/VirtualBox VMs/2003 Server/Snapshots
Log folder:      /home/vbox/VirtualBox VMs/2003 Server/Logs
Hardware UUID:   *******-*******-********-****
Memory size:     3072MB
Page Fusion:     off
VRAM size:       8MB
CPU exec cap:    100%
HPET:            off
Chipset:         piix3
Firmware:        BIOS
Number of CPUs:  1
Synthetic Cpu:   off
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): DVD
Boot Device (2): DVD
Boot Device (3): HardDisk
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          off
PAE:             on
Time offset:     0 ms
RTC:             local time
Hardw. virt.ext: on
Hardw. virt.ext exclusive: on
Nested Paging:   on
Large Pages:     off
VT-x VPID:       on
State:           running (since 2012-01-08T06:37:19.857000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Storage Controller Name (0):            IDE Controller
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
IDE Controller (0, 0): /home/vbox/VirtualBox VMs/2003 Server/2003_server.vdi (UUID: )
IDE Controller (1, 0): /home/vbox/iso/2003_server.iso (UUID:)
NIC 1:           MAC: 080027431395, Attachment: Bridged Interface 'br0', Cable connected: on, Trace: off (file: none), Type: Am79C973, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: PS/2 Mouse
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
Audio:           disabled
Clipboard Mode:  Bidirectional
Video mode:      1024x768x32
VRDE:            enabled (Address 0.0.0.0, Ports 3389, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
VRDE port:       3389
Video redirection: disabled
VRDE property: TCP/Ports  = "3389"
VRDE property: TCP/Address =
VRDE property: VideoChannel/Enabled =
VRDE property: VideoChannel/Quality =
VRDE property: VideoChannel/DownscaleProtection =
VRDE property: Client/DisableDisplay =
VRDE property: Client/DisableInput =
VRDE property: Client/DisableAudio =
VRDE property: Client/DisableUSB =
VRDE property: Client/DisableClipboard =
VRDE property: Client/DisableUpstreamAudio =
VRDE property: H3DRedirect/Enabled =
VRDE property: Security/Method =
VRDE property: Security/ServerCertificate =
VRDE property: Security/ServerPrivateKey =
VRDE property: Security/CACertificate =
USB:             disabled

USB Device Filters: 
Available remote USB devices: 
Currently Attached USB Devices: 
Shared folders: 

VRDE Connection:    not active
Clients so far:     0

Guest:

Configured memory balloon size:      0 MB
OS type:                             Other
Additions run level:                 0

Guest Facilities:
No active facilities.

Start the VM (Headless)

VBoxHeadless --startvm "Ubuntu 11.04 Server"

$ Oracle VM VirtualBox Headless Interface 4.1.8
(C) 2008-2011 Oracle Corporation
All rights reserved.

VRDE server is listening on port 3389.

 
You can now manage the VM from most remote desktop clients.  I used Remote Desktop Connection from my MacBook which worked but mouse control was somewhat problematic while completing the initial server setup.  

As soon as I was able to enable remote desktop within the Virtual Machine itself and connect directly it functioned normally.

Additional commands to control the VM Headless found @ http://www.virtualbox.org/manual/ch07.html#vboxheadless

Basic Controls
# VBoxManage controlvm "2003 Server" poweroff|reset|pause

_______________________________________________
 



Thursday, August 11, 2011

Hobbit/Xymon - Install on CentOS (coming soon)

A few notes for my future post...

After installing Xymon (Hobbit) on a CentOS system I found that the graphs didn't contain any text.  Very frustrating to say the least.  I did the following to temporarily solve my problem, but this might become permanent.

 Used the ldd tool to determine which rrdtool library was used

# ldd /usr/lib/xymon/server/bin/hobbitgraph.cgi
    linux-gate.so.1 =>  (0xffffe000)
    libpcre.so.0 => /lib/libpcre.so.0 (0xf7f5a000)
    librrd.so.2 => /usr/lib/librrd.so.2 (0xf7f10000)
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0x004c4000)
    librt.so.1 => /lib/librt.so.1 (0x00b9d000)
    libc.so.6 => /lib/libc.so.6 (0x00a3b000)
    libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x003ac000)
    libz.so.1 => /usr/lib/libz.so.1 (0x0050a000)
    libart_lgpl_2.so.2 => /usr/lib/libart_lgpl_2.so.2 (0xf7ef8000)
    libm.so.6 => /lib/libm.so.6 (0x00bc3000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00ba8000)
    /lib/ld-linux.so.2 (0x00a1c000)


Then...I did a strings and grep to see what ttf file it references

# strings /usr/lib/librrd.so.2 |grep ttf
 @/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf
"@/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf
@/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf
 @/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf
 @/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf

File did not exist nor the directory it was referencing...need to go back and determine why this is.

Created directory as referenced above.

Grep'd for the "DejaVuSnasMono-Roman.ttf" font and didn't find it on the system.  However I did find a very similar one named "DejaVuLGCSansMono.ttf and created a symbolic link to it for a test.

# ln -s /usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono.ttf ./DejaVuSansMono-Roman.ttf

Presto.  Worked like a charm.

Wednesday, July 27, 2011

OpenVPN - Bridging Mode

Scope:  OpenVPN 2.2.0 on CentOS 5.6

Previously I documented the install of OpenVPN on Debian in a bridged configuration.  Later I installed a similar setup on CentOS 5.6 and found that some additional steps were required.
 
As a place holder and reminder....
 
Create ifcfg-br0 file.
 
cat /etc/sysconfig/network-scripts/ifcfg-br0

DEVICE=br0
TYPE=Bridge
IPADDR=192.168.0.100
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
ONBOOT=yes

 
Modify the ifcfg-eth0 file (or the interface file you are creating the bridge to)
 
cat /etc/sysconfig/network-scripts/ifcfg-eth0
 
DEVICE=eth0
TYPE=ETHER
BRIDGE=br0
ONBOOT=yes

 
Set Scripts to run at start-up.











Thursday, January 22, 2009

SuperMicro 5015B-MTB & CentOS 5.2

A recent project required that I find a linux solution for the 1U SuperMicro Server (5015B-MTB). The 5015B ships with a SATA Raid controller -
  • Intel® ICH9R SATA2 (3 Gbps) controller built-in
  • RAID 0, 1, 5, 10 support (Windows Only)
  • RAID 0, 1, 10 support (Linux)
that allows you to enable Intel or an Adaptec configuration. I first attempted to install with a Debian Lenny distribution but was not initially able to get the RAID controller working properly. The installation would continue to see 2 separate drives regardless of the setup being a RAID 0 or 1. This led to the CentOS installation.

I started with a CentOS 5.2 Network Boot disk and completed a basic install. I did allow it to install iptables (firewall) and knowing that I would be using Samba, made the appropriate selections when prompted. The installation took approximately an hour to complete. I then installed via "yum" a few additional packages...screen, nmap, samba, lynx, sudo etc.

My main goal was achieved with this installation by having a working hardware RAID solution. Once installed, I did test this by removing one of the hard drives while using the system. There was only a momentary pause and then it returned to normal. I then reinserted the drive and after several minutes removed the other in the same fashion. The result was the same. I am very pleased to have had it pass this aggressive test.

Second on the list was to install VMware 2.0. This was my first install of VMware on CentOS. I downloaded the rpm from vmare.com and installed in the typical fashion.

sudo rpm -i vmware-package.rpm

I then proceeded to configure the application. Based on the installation it appeared to be successful. I however quickly found by running

lynx localhost:8222

that it was not listening on the assigned http port. That then led to some additional testing to determine what ports were actually listening on the box.

netstat -anp | grep 8333

This did not return a response and so I began to research the logs to see what information I could glean.

The logs showed the following.

VMware[init]: /usr/lib/vmware/bin/vmware-
hostd: error while loading
shared libraries: /usr/lib/vmware/vmacore/libvmacore
.so.1.0: cannot restore segment prot after reloc: Permission denied

After some careful googling, I was able to determine that this was a known issue that others had dealt with. I was presented with 2 different solutions but chose to correct it by issuing

chcon -t texrel_shlib_t /usr/lib/vmware/vmacore/
libvmacore.so.1.0

based on http://www.vmware.com/support/server2/doc/releasenotes_vmserver2.html#issues

I then restarted VMware and had a working VM Solution.

While researching this issue, I found several others determined it necessary to make a configuration change to

/etc/SELinux/config
SELinux=permissive

Note: I found this initally set to "enforcing". I later also changed it to "permissive" in order to help troubleshoot a Samba problem.

Update: October 2009

I ordered another one of these servers along with 4 1.5T Seagate drives.  I found that under the Adaptec Raid setting, it only saw 512GB of each drive instead of the full 1.5T.  It was necessary to configure the bios to use the Intel Raid setup in order for Debian (along with the dmraid=true) to recognize the full size of the drives.