Setting Hostname in CentOS

June 23rd, 2008 No comments

CentOS/RHEL hostnames are specified in /etc/sysconfig/network with a HOSTNAME entry:

HOSTNAME=name.domain.com
Categories: Uncategorized Tags:

Java on CentOS 5 VPS

June 22nd, 2008 No comments

A  couple of tips to installing Sun Java under CentOS 5:

Use the EPEL repository – this makes life much easier if you want to install Sun Java, otherwise the default Java installation is GCJ.

If Java won’t start, check and adjust vps conf values according to /proc/user_beancounters failcnt.

Categories: Uncategorized Tags:

Ubuntu Locale

June 21st, 2008 No comments

Connected to a remote VPS via SSH, I ran into problems installing Java with apt-get – error included stuff like the following:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"

The solution was to regenerate the locale with “locale-gen ” as follows:

locale-gen en_US.UTF-8
dpkg-reconfigure locales
Categories: Uncategorized Tags:

Ubuntu Codecs

June 16th, 2008 No comments

I really like Ubuntu and Hardy Heron is the best so far but the continual nonsense with codecs is a real pain. From here I stole the following:

Install Mplayer in Ubuntu Hardy Heron

You need to add the following lines to /etc/apt/sources.list file or you need to make sure you have enabled Universe and multiverse repositories in /etc/apt/sources.list file

sudo gedit /etc/apt/sources.list

Make sure you have the following two lines save and exit your file

deb https://archive.ubuntu.com/ubuntu hardy universe multiverse
deb-src https://archive.ubuntu.com/ubuntu hardy universe multiverse

Now you need to run the following command to update the source list

sudo apt-get update

Install mplayer using the following command

sudo apt-get install mplayer

if you want to open mplayer just type

gmplayer

or

You can Open from Applications—>Sound&Video—> Mplayer Movie Player

Install libdvdcss2 and w32 video codecs in Ubuntu 8.04 (Hardy Heron)

Support for WMV, RealMedia and other formats has been bundled into the w32codecs package. This package is not available from the Ubuntu repositories due to licensing and legal restrictions.

For Ubuntu 8.04 (Hardy Heron) Users run the following command

sudo wget https://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list

Then, add the GPG Key using the following commands

sudo apt-get update
sudo apt-get install medibuntu-keyring
sudo apt-get update

For i386 Users install Codecs using the following command

sudo apt-get install w32codecs libdvdcss2

For amd64 Users install Codecs using the following command

sudo apt-get install w64codecs libdvdcss2

Using above download locations you can install most of the mutimedia codecs for ubuntu.

Mplayer Plugin for Firefox

If you want to install Mplayer with plug-in for Mozilla Firefox run the following command

sudo apt-get install mozilla-mplayer
Categories: Uncategorized Tags:

Programming Language Popularity

May 24th, 2008 No comments

From the site:

“The TIOBE Programming Community index gives an indication of the popularity of programming languages. The index is updated once a month. The ratings are based on the number of skilled engineers world-wide, courses and third party vendors. The popular search engines Google, MSN, Yahoo!, and YouTube are used to calculate the ratings. Observe that the TIOBE index is not about the best programming language or the language in which most lines of code have been written.”

https://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

Categories: Uncategorized Tags:

Cooperative Linux (coLinux)

May 7th, 2008 No comments

While helping a friend port his application from Windows to Linux, I quickly grew tired of switching my dual-boot Vista & Hardy Heron Thinkpad from one system to the other. While Cygwin helps, compiling hundreds of files and several hundred K lines of C++ is just too painful. The answer: Cooperative Linux.

An excellent installation guide can be found here. Running coLinux as a Windows service is described here.

A few notes:

XML config files are no longer supported and most references/examples are obsolete.

Winpcap networking is the simplest, most flexible and, if you use Wireshark, likely already installed. Possible drawbacks: must be connected to a network (even to bridge between host and guest OS); may not work with your wireless adapter (although a wireless version was recently introduced).

When installing as a Windows service, remember to add NPF (Winpcap) as a dependency in the registry at key HKLMSYSTEMCurrentControlSetServicesCooperative Linux (or whatever you called the service). The colinux-daemon –install-service command won’t do this for you.

The default “colinux-daemon –install-service –config @colinux.conf” without a service name works for me. By default the service name is “Cooperative Linux”. To start the service, either enter ‘net start “cooperative linux”‘ on a command line or use the Windows services applet. For additional images, use different service names. Make sure you never use the same image with two services! For some idea of what would happen, try to imagine two computers sharing a single hard drive.

I use Putty to ssh to the colinux guest, launched by a desktop shortcut to an appropriately configured putty profile, including ssh key.

Since I use Vi (a lot), I’m using a stable snapshot from here. Until quite recently a colinux bug prevented Vi from saving files under coFs. (Some nonsense about Fsync missing or not supported).

Since it already had coFs configured more or less the way I like, I’m using this image of Ubuntu 7.10 (gutsy). The current installer offers Ubuntu 6.06 (dapper) while 8.04 (hardy) is available somewhere (though I seem to have lost the link).

Categories: Uncategorized Tags:

Add “Take Ownership” to right-click menu in Vista

April 27th, 2008 No comments
Categories: Uncategorized Tags:

More OpenVZ and CentOS 5

April 22nd, 2008 No comments

This was much more difficult, annoying really, than it should have been. While the OpenVZ wiki is generally excellent, with clear, easy-to-follow instructions describing how to install VPSes based on a variety of operating systems, there are none specifically for CentOS 5.

I have a CentOS 5 host (HN) and need to install several CentOS 5 containers (VPS). First problem: there is no official prebuilt CentOS 5 template cache or metadata. While the community contributed CentOS 5 template cache is okay, it’s missing the metadata necessary to use vzyum.

Eventually I found this discussion which produced to this working CentOS template RPM. To install:

rpm -ivh vztmpl-centos-5-2.0-3.i386.rpm

Build the template cache:

vzpkgcache -f centos-5-minimal

Template building is much faster with a local yum repository, enabled in /etc/yum.repos.d/CentOS-Media.repo. To loop mount the CentOS 5 installation DVD iso:

mount -o loop  /downloads/CentOS-5.1-i386-bin-DVD.iso /media/CentOS

Create the VPS:

vzctl create 101 --ostemplate centos-5-i386-minimal
vzctl set 101 --ipadd 123.123.123.123 --save
vzctl set 101 --nameserver 121.121.121.121 --save
vzctl start 101

To enter, stop or destroy the container:

vzctl enter 101
vzctl stop 101
vzctl destroy 101

To add packages to the container using vzyum:

vzyum 101 install package-name

**NB** The above still didn’t work until I initialized the container’s rpm database:

vzctl exec 101 rpm -vv --initdb

Hope this helps – enjoy.

Categories: Uncategorized Tags:

OpenVZ and CentOS 5.0

April 22nd, 2008 No comments

After installing OpenVZ on CentOS 5.0, I created a couple of CentOS 5.0 VEs using the minimal template available on the OpenVZ wiki but when I “entered” the VE I noticed a “cp” operation consuming 100% of the CPU. Checking back on the host system, I saw the same “cp” consuming 100% CPU there too.

According to OpenVZ, the problem is due to FC5 bug #190601 (ovz bug #297) which remains unfixed in CentOS 5.0. The /etc/vz/dists/scripts/functions file contains a workaround for Fedora but not CentOS or Redhat. To fix, duplicate line 24, and replace “fedora” with “redhat”. When done, it should look like this:

CP='/bin/cp -fp'
# overwrite copy arguments as a workaround for FC5 bug #190601 (ovz bug #297)
[ -f /etc/fedora-release ] && CP='/bin/cp -f --preserve=mode,ownership'
[ -f /etc/redhat-release ] && CP='/bin/cp -f --preserve=mode,ownership'
Categories: Uncategorized Tags:

Textmate links, Firefox and Linux

March 22nd, 2008 No comments

Various Ruby frameworks, including Ramaze and Merb, display error pages with TextMate links. While TextMate is Mac-only, Linux users can still use the links to launch Vim with the following steps.

1. Create /usr/local/bin/firefox-txmt with the following:

#!/usr/bin/env ruby

unless ARGV[0] =~ /^txmt://open?url=/ then
	puts "You probably want this called from firefox with a txmt url."
	exit 1
end

args = ARGV[0].split("://")

file = args[2].split("&")[0]
line = args[2].split("line=")[1]
line = "1" if line == "?"

`x-terminal-emulator -e vim #{file} +#{line}`

2. Create a key in about:config called network.protocol-handler.app.txmt, and set it’s value to firefox-txmt.

This tip came from Lindsay Holmwood’s blog. He also suggests these changes to .vimrc:

se cursorline
hi CursorLine term=none cterm=none ctermbg=1

Some more Vim stuff here.

Categories: Uncategorized Tags: