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

Sunday, January 1, 2012

Installing WINE on CentOS 6

There really isn't too much to installing and setting up WINE on CentOS 6, just make sure to setup the EPEL and ATrpms repositories as described in my The OS Install post and run:
[root@htpc ~]# yum install wine
Since the /home/mythtv directory doesn't really have much space allocated to it, I wanted to change the location of the C: drive to /var/lib. First, login to the Gnome desktop as the mythtv user and run the following to create the hidden /home/mythtv/.wine folder (there is also the Wine Configuration launcher under Applications -> Wine which does the same thing)
[mythtv@htpc ~]# winecfg
In the window that popped up, I selected Windows 7 as the windows version in the Applications tab and then clicked on the Audio tab and allowed Wine the select the best driver for my setup. I didn't play around with any other settings and hit the OK button to save my settings and close the window.

Now that the /home/mythtv/.wine folder has been created, I performed the following to move the C: drive to /var/lib.

As root:
[root@htpc ~]# mkdir -p /var/lib/wine/mythtv
[root@htpc ~]# chown mythtv:mythtv /var/lib/wine/mythtv
As mythtv:
[mythtv@htpc ~]$ mv /home/mythtv/.wine/drive_c /var/lib/wine/mythtv
[mythtv@htpc ~]$ rm '/home/mythtv/.wine/dosdevices/c:'
[mythtv@htpc ~]$ ln -s /var/lib/wine/mythtv/drive_c '/home/mythtv/.wine/dosdevices/c:'
Finally, I wanted to test to see if the free version of Trackmania Forever worked. I downloaded the installer and ran:
[mythtv@htpc ~]$ wine tmnationsforever_setup.exe
The installer created a handy desktop launcher when it was done and I simply double clicked on it and the game started up and ran without any issues. Sweetness.

Now the challenge will be to get some of my other games to work, however, that may be difficult since the WINE version on EPEL is kind of old. I'll tackle that another day.

Saturday, December 24, 2011

Installing MythTV on CentOS 6

Now that OS environment is ready and all of the drivers have been installed and working properly, it's time to install MythTV. As a recap, here's everything that was done to get to this point:


First thing is to install MySQL and start it up
[root@htpc ~]# yum install mysql mysql-server
[root@htpc ~]# chkconfig mysqld on
[root@htpc ~]# service mysqld start
Next, secure MySQL. I basically answered all the questions with a 'Y'
[root@htpc ~]# /usr/bin/mysql_secure_installation
Enter current password for root (enter for none): <enter>
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
Install QT 4.7. Needed to remove qt-x11 because it was conflicting with QT 4.7.
[root@htpc ~]# yum remove qt-x11
[root@htpc ~]# yum install qt47 qt47-x11 qt47-webkit qt47-mysql
Install MythTV
[root@htpc ~]# yum install mythtv-backend mythtv-frontend mythtv-docs mythtv-setup 
Create the MythTV database and user in MySQL.
[root@htpc ~]# mysql -u root -p < /usr/share/doc/mythtv-docs-0.24.1/database/mc.sql
For performance reasons, it is recommended to tweak some MySQL settings. Simply edit /etc/my.cnf and add the following values:
  key_buffer = 16M
  table_cache = 128
  sort_buffer_size = 2M
  myisam_sort_buffer_size = 8M
  query_cache_size = 16M 
And restart MySQL for the changes to take effect
[root@htpc ~]# service mysqld restart
Finally, I like to do one last system update and reboot to make sure that all the necessary services start at boot time.
[root@htpc ~]# yum update
[root@htpc ~]# reboot
And test to make sure that MySQL and lirc are working
[root@htpc ~]# mysql -p
[root@htpc ~]# irw
Next up, configuring the MythTV backend...


Friday, December 23, 2011

The Remote Control

As I mentioned in my hardware post, I got a pretty generic Vista MCE Remote Control. By far, this was the most time consuming and frustrating piece of the install up to this point mainly because lirc is kind of a black box for me and guides for setting it up are scattered. Another problem that I ran into is that the USB IR receiver shows up as two devices. I finally got it working and minimized the process to a few basic steps, but a lot of blood and sweat went into the next set of instructions.

First off, install lirc. No additional drivers or kernel modules are necessary since I will be using /dev/input
[root@htpc ~]# yum install lirc
Next, get the generic lirc.conf for devinput from the lirc web site
[root@htpc ~]# wget http://lirc.sourceforge.net/remotes/devinput/lircd.conf.devinput -O /etc/lirc/lircd.conf
Then, because there are two devices in /dev/input, I needed a way to tie them together in lircd. I did this by editing the /etc/sysconfig file and putting in the following lines. The device names will be different depending on the remote, but these work for the one that I got.
LIRCD_OPTIONS_1="--driver=devinput --device=/dev/input/by-id/usb-05a4_9881-event-kbd  --pidfile=/var/run/lirc1.pid --listen=9988"
LIRCD_OPTIONS_2="--driver=devinput --device=/dev/input/by-id/usb-05a4_9881-event-if01 --pidfile=/var/run/lirc2.pid --connect=localhost:9988"
Finally, edit the lircd init script and modify the start function so that two lircd daemons are started up with the options from /etc/sysconfig
daemon lircd $LIRCD_OPTIONS_1
daemon lircd $LIRCD_OPTIONS_2
All that's left is to set lircd to start at boot and start the service
[root@htpc ~]# chkconfig lircd on
[root@htpc ~]# service lircd start
And of course test
[root@htpc ~]# irw 
Pressing the buttons on the remote control should show up in the output of irw.

References:
http://www.gossamer-threads.com/lists/mythtv/users/430004
http://old-de.opensuse.org/Linux_Infrared_Remote_Control


The Capture Card

Getting the Hauppauge WinTV-HVR-2250 to work on CentOS 6 wasn't as painful as I thought it would be. The IR port doesn't work in Linux and the analog support is questionable, but those aren't showstoppers for me since I have a separate remote and analog TV is pretty much dead. The digital portion of the card works perfectly.

First install the Video4Linux drivers
[root@htpc ~]# yum install libv4l video4linux video4linux-kmdl-$(uname -r)
Next, install the firmware for the card

[root@htpc ~]# wget http://www.steventoth.net/linux/hvr22xx/22xxdrv_27086.zip
[root@htpc ~]# wget http://www.steventoth.net/linux/hvr22xx/HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip
[root@htpc ~]# wget http://www.steventoth.net/linux/hvr22xx/firmwares/4019072/NXP7164-2010-03-10.1.fw
[root@htpc ~]# wget http://www.steventoth.net/linux/hvr22xx/extract.sh
[root@htpc ~]# sh extract.sh
[root@htpc ~]# cp *.fw /lib/firmware
[root@htpc ~]# reboot
Finally, check dmesg to see if the kernel recognizes the card, uploads the firmware, and registers the mpeg and vbi devices.
[root@htpc ~]# dmesg
...
saa7164 driver loaded
saa7164 0000:05:00.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19
CORE saa7164[0]: subsystem: 0070:8851, board: Hauppauge WinTV-HVR2250 [card=7,autodetected]
saa7164[0]/0: found at 0000:05:00.0, rev: 129, irq: 19, latency: 0, mmio: 0xfe800000
saa7164 0000:05:00.0: setting latency timer to 64
IRQ 19/saa7164[0]: IRQF_DISABLED is not guaranteed on shared IRQs
saa7164_downloadfirmware() no first image
saa7164_downloadfirmware() Waiting for firmware upload (NXP7164-2010-03-10.1.fw)
saa7164 0000:05:00.0: firmware: requesting NXP7164-2010-03-10.1.fw
saa7164_downloadfirmware() firmware read 4019072 bytes.
saa7164_downloadfirmware() firmware loaded.
Firmware file header part 1:
 .FirmwareSize = 0x0
 .BSLSize = 0x0
 .Reserved = 0x3d538
 .Version = 0x3
saa7164_downloadfirmware() SecBootLoader.FileSize = 4019072
saa7164_downloadfirmware() FirmwareSize = 0x1fd6
saa7164_downloadfirmware() BSLSize = 0x0
saa7164_downloadfirmware() Reserved = 0x0
saa7164_downloadfirmware() Version = 0x1661c00
saa7164_downloadimage() Image downloaded, booting...
saa7164_downloadimage() Image booted successfully.
starting firmware download(2)
saa7164_downloadimage() Image downloaded, booting...
saa7164_downloadimage() Image booted successfully.
firmware download complete.
tveeprom 1-0000: Hauppauge model 88061, rev C4F2, serial# 7964330
tveeprom 1-0000: MAC address is 00:0d:fe:79:86:aa
tveeprom 1-0000: tuner model is NXP 18271C2_716x (idx 152, type 4)
tveeprom 1-0000: TV standards NTSC(M) ATSC/DVB Digital (eeprom 0x88)
tveeprom 1-0000: audio processor is SAA7164 (idx 43)
tveeprom 1-0000: decoder processor is SAA7164 (idx 40)
tveeprom 1-0000: has radio, has IR receiver, has no IR transmitter
saa7164[0]: Hauppauge eeprom: model=88061
tda18271 2-0060: creating new instance
TDA18271HD/C2 detected @ 2-0060
DVB: registering new adapter (saa7164)
DVB: registering adapter 0 frontend 0 (Samsung S5H1411 QAM/8VSB Frontend)...
tda18271 3-0060: creating new instance
TDA18271HD/C2 detected @ 3-0060
tda18271: performing RF tracking filter calibration
tda18271: RF tracking filter calibration complete
DVB: registering new adapter (saa7164)
DVB: registering adapter 1 frontend 0 (Samsung S5H1411 QAM/8VSB Frontend)...
saa7164[0]: registered device video0 [mpeg]
saa7164[0]: registered device video1 [mpeg]
saa7164[0]: registered device vbi0 [vbi]
saa7164[0]: registered device vbi1 [vbi]
...
That's about it really. I did need to do a bunch of research to get this to work. I've included some sources that I found useful below. 

Next up, the remote control.

References:
http://linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-2250
http://linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-2200
http://ubuntuforums.org/showthread.php?t=1567490

The OS Install

My goal here is to talk about doing a basic Operating System (OS) installation so that it's ready for the installation of subsequent drivers and packages.

Originally, I wanted to install the latest version of CentOS, which is 6.2 at this time, however I ran into some issues when running the 6.2 installer. As soon as the installer went into the pretty GUI portion of the installation, the computer would freeze up. I'm pretty sure it's a kernel panic and that the issue is with the 2.6.32-220 kernel not liking the nVidia graphics card. I decided to install 6.1 x86_64 and update to 6.2 later on, without updating to the 2.6.32-220.whatever kernel. This could be an issue specific to my setup so anyone else reading this might not run into the same problem. At some point in the near future I plan on revisiting this to see if there are any updated kernels that fix this issue, but then again, I might not bother. If it ain't broke, don't fix it.

I didn't do anything fancy during the installation. I performed a basic install with the following options:
  • Minimal Desktop
  • Enable NTP
  • Disable Kdump
  • Create a user for myself

The disk partitioning ultimately wound up looking like this
[root@htpc ~]# fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000845ca
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         131     1048576   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2             131        8486    67108864   83  Linux
/dev/sda3            8486        9530     8388608   82  Linux swap / Solaris
/dev/sda4            9530      121602   900214784   83  Linux

[root@htpc ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              63G  2.2G   58G   4% /
tmpfs                 2.0G   88K  2.0G   1% /dev/shm
/dev/sda1            1008M   59M  899M   7% /boot
/dev/sda4             846G  249M  802G   1% /var/lib
First thing I did was add the mythtv user. I may need to add additional groups to this user if I run into any permissions issues, but so far, the groups below seem to work out OK.
[root@htpc ~]# useradd -G audio,video,games,cdrom mythtv
[root@htpc ~]# passwd mythtv
I then disabled the firewall and SELinux. If you're not behind a router with a firewall, then you should probably leave the firewall enabled but you may need to do some research to figure out what, if any, ports need to be opened up for MythTV. Since everything is running on the same host, I don't think any ports will need to be opened, but I can't say for sure. SELinux is a totally different beast and I think disabling it will avoid headaches down the road. I like using vi and doing most stuff on the command line, but any text editor should work just fine.
[root@htpc ~]# vi /etc/selinux/config
(change SELINUX parameter from enabled to disabled)
[root@htpc ~]# system-config-firewall-tui
        (go through the menu to disable firewall)
Update to 6.2, without updating the kernel, due to the issue I described earlier.
[root@htpc ~]# vi /etc/yum.conf
     (put in "exclude=kernel*" under [main])
 
[root@htpc ~]# yum update
[root@htpc ~]# reboot
Setup the EPEL and ATrpms repositories
[root@htpc ~]# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
[root@htpc ~]# rpm -ivh epel-release-6-5.noarch.rpm
[root@htpc ~]# rpm --import http://packages.atrpms.net/RPM-GPG-KEY.atrpms
[root@htpc ~]# wget http://dl.atrpms.net/all/atrpms-repo-6-4.el6.x86_64.rpm
[root@htpc ~]# rpm -ivh atrpms-repo-6-4.el6.x86_64.rpm
[root@htpc ~]# vi /etc/yum.repos.d/atrpms-testing.repo
(change enabled from 0 to 1 under [atrpms-testing])
Update to the latest kernel in the 6.1 tree since ATrpms doesn't have modules for the stock 6.1 kernel
[root@htpc ~]# wget http://centos.vipernetworksystems.com/6.1/updates/x86_64/Packages/kernel-2.6.32-131.21.1.el6.x86_64.rpm
[root@htpc ~]# wget http://centos.vipernetworksystems.com/6.1/updates/x86_64/Packages/kernel-devel-2.6.32-131.21.1.el6.x86_64.rpm
[root@htpc ~]# wget http://centos.vipernetworksystems.com/6.1/updates/x86_64/Packages/kernel-firmware-2.6.32-131.21.1.el6.noarch.rpm
[root@htpc ~]# wget http://centos.vipernetworksystems.com/6.1/updates/x86_64/Packages/kernel-headers-2.6.32-131.21.1.el6.x86_64.rpm
[root@htpc ~]# vi /etc/yum.conf
(comment out exclude=kernel*)
[root@htpc ~]# yum install kernel*
[root@htpc ~]# vi /etc/yum.conf
(uncomment out exclude=kernel*)
[root@htpc ~]# reboot
[root@htpc ~]# yum remove kernel-2.6.32-131.0.15.el6.x86_64
And finally, install the nVidia driver. I wanted to do this as soon as possible because it slows down the speed of the GPU fan, which makes a lot of noise when it spins at full speed. I needed to blacklist the nouveau module in grub.conf since it conflicted with the nVidia driver.
[root@htpc ~]# yum install nvidia-graphics290.10 nvidia-graphics290.10-kmdl-$(uname -r)
[root@htpc ~]# vi /boot/grub/grub.conf
add "rdblacklist=nouveau vga=794" to the end of the kernel options
[root@htpc ~]# reboot
Next up, getting the capture card working in CentOS 6 ...

Hello World!

My first post, YEY!

I'm an Oracle Database Administrator that likes to tinker with home theater PC's (HTPC's) when I have some spare time. I know Linux pretty well when it comes to running Oracle databases but I've come to learn that Linux for an HTPC is a totally different beast. I created this blog so that I may share my experiences of building out a Linux HTPC with the rest of the world. My hope is that someone out there would find it useful and perhaps help them save some time and avoid some of the frustrations that I've gone through over the years with my HTPC. I may on occasion do a random Oracle related post, but I'll try to keep that to a minimum.

I built out my first and current HTPC system back in early 2006. It's running on a machine that I put together for the sole purpose of running MythTV. It has an Athlon 3200+ CPU, 1G of memory, an nVidia GeForce FX 5200 graphics card, a couple of Hauppauge analog capture cards, and a pcHDTV HD-5500 digital capture card. I don't use the analog capture cards anymore since everything is pretty much broadcast digitally nowadays, however, I do still use one of them for the remote control because it has an IR input. I use that machine for other things such as a backup server, a DNS server, and a DHCP server. Over time I've added other HTPC applications to it like Boxee, Subsonic, and Serviio, which I use to watch more demanding HD content like H.264 on my Playsation 3.

Surprisingly, the HTPC I built back in 2006 has held up pretty well over the years. It is able to play back HD MPEG recordings just fine due to the hardware acceleration of the nVidia card and I haven't really had any major issues other than a failed hard drive due to a power outage. Because it was able to play back recordings in HD, I haven't had a compelling reason to do a major overhaul of the hardware, so I just left it alone. I will admit though that the hardware has been showing its age for quite a while and it doesn't do too well with Flash (Boxee) or H.264 video (that's why I setup Serviio). The opportunity to do a hardware overhaul  presented itself when I upgraded my desktop PC, which left behind some fairly decent spare parts, so I figured now is a good time, plus it's the holidays and I have a bit more spare time than usual.

The Linux flavor that I chose for my first HTPC was Gentoo. I chose Gentoo because I found a good article on the Internet that detailed how to setup MythTV on it. I also thought that Gentoo would be a good challenge (which it was) that would allow me to learn up a thing or two about how Linux works (which it did).

At first I thought that Gentoo was really cool, and to some extent I still do, however, over the years, I just got tired of keeping up with the frequent updates, not to mention all the little details you have to pay attention to. Compiling most everything was time consuming (MythTV took about an hour), and sometimes I would have to do it twice because I was missing a use flag that was needed for a feature to work. The thing that really wore me down was the feeling that the next update, no matter how benign, had the potential to break something which would cause my delicate MythTV environment to crumble, forcing me to have to spend a lot of time researching and fixing stuff. I guess that just goes with the territory of  being on the bleeding edge of Linux updates. Eventually I got to the point where I just didn't have the interest or motivation to go through updates anymore so I stopped, which isn't good from a security perspective. After about a year, my Gentoo system was so out of date that I would probably have to rebuild it from scratch to make it current.

This time around I wanted to use a binary distribution where I didn't have to spend a lot of time compiling stuff and one that had a longer support lifetime so that I wouldn't be forced to update as frequently. Being an Oracle DBA, I feel most at home with the Red Hat distribution of Linux. I ultimately decided to go with  the latest version of CentOS, which is essentially a Red Hat clone without the Red Had branding and artwork. I considered using Scientific Linux but decided on CentOS because I was more familiar with it. With the packages from the good folks at EPEL and ATrmps the process of building up the HTPC was no where near as time consuming as doing it on Gentoo (at least not so far). I guess only time will tell.

Next up, the new(er) hardware...