Showing posts with label OpenVZ. Show all posts
Showing posts with label OpenVZ. Show all posts

9 Jul 2008

Installing Java 6 in a Centos 5 VE

Download Java installation package from:
http://java.sun.com/javase/downloads/index.jsp

Select the version you want and click download.
Then you'll have to select the platform where java will be installed (Linux x64, for me) and check the licence agreement.

In the next page I select to download the "Linux x64 RPM in self-extracting file" and then the download starts using SUN's Download Manager.

With the package copied to the VE in which we want to install Java we must make it executable:

# chmod a+x jdk-6u3-linux-amd64-rpm.bin

And install it:

# ./jdk-6u3-linux-amd64-rpm.bin

Check that the right version is available now:

# java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-b05, mixed mode)
#

27 Jun 2008

Problem resolving names in VEs

All I got when trying to resolve a name inside any of my virtual machines was
ping: unknown host google.com

So I used tcpdump to debug the problem.

In the Hardware Node (HN) I executed:
# tcpdump -i venet0

And then tried to reach Google from a VE, getting this on the tcpdump output:

20:49:15.876485 IP 192.168.0.131.32943 > router.lan.domain: 36989+ A? google.com. (27)
20:49:16.207800 IP OpenVZ.lan > 192.168.0.131: ICMP host router.lan unreachable - admin prohibited, length 63
20:49:16.213804 IP 192.168.0.131.32943 > router.lan.domain: 36989+ A? google.com. (27)
20:49:16.215820 IP OpenVZ.lan > 192.168.0.131: ICMP host router.lan unreachable - admin prohibited, length 63


So it seemed to indicate that there was a problem with iptables.
Executing:
# iptables --list

I found that the cause of the problem was this last rule:
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

So I commented the corresponding line in /etc/sysconfig/iptables

#-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited

I restarted iptables
# /etc/init.d/iptables restart

And now it works.

For further information on iptables look at:
Quick HOWTO : Ch14 : Linux Firewalls Using iptables

3 Jun 2008

Creating a Minimal CentOS 5.1 VE in OpenVZ

These steps are for those with OpenVZ already installed and running.

Move to the templates directory:

# cd /vz/template/cache

Download CentOS 5.1 template:

# wget http://download.openvz.org/template/precreated/contrib/centos-5-i386-minimal.tar.gz

Create the VE:

# vzctl create --ostemplate centos-5-i386-minimal


Set VE's IP address:

# vzctl set --ipadd --save

Set VE's hostname:

# vzctl set --hostname --save

Set root's password:

# vzctl set --userpasswd root:password

Start the VE:

# vzctl start

Trying to enter the VE now I got an error:

# vzctl enter
enter into VE failed
Unable to open pty: No such file or directory


We can solve this with:

# vzctl exec /sbin/MAKEDEV tty
# vzctl exec /sbin/MAKEDEV pty
# vzctl exec /sbin/MAKEDEV ptmx
# vzctl exec /sbin/MAKEDEV random
# vzctl enter

Then we remove udev package like this:

# rpm -qf /etc/udev/makedev.d/50-udev.nodes
udev-095-14.9.el5
# rpm -e udev-095-14.9.el5 –nodeps


Now we can restart the VE and we are ready to go.