Skip to content

How to virtualize Ubuntu in a Dom0 Debian

June 30, 2012

1. First than all create and format a swap unit and a disk unit.
mkdir /home/xen/domains/SERVER
cd /home/xen/domains/SERVER/
dd if=/dev/zero of=disk.img oflag=direct bs=1M seek=32768 count=1
dd if=/dev/zero of=swap.img oflag=direct bs=1M seek=1024 count=1
mkfs.ext3 disk.img
mkswap swap.img

2. Second, download the template and the kernel from here

3. We need to mount, uncompress and preconfigure the template.
mkdir /mnt/so_testmount -o loop disk.img /mnt/so_testtar -zxvf [**system**].tar.gz -C /mnt/so_test/tar -zxvf [**kernel**].tar.gz -C /mnt/so_test/chroot /mnt/so_test/ /bin/bashpasswd # change the passwordvi /etc/resolv.conf # modify DNSvi /etc/network/interfaces # Change DHCP for staticumount /mnt/so_xen/

4. Create a config file with the following estructure.
kernel = "/home/xen/domains/SERVER/vmlinuz-"
ramdisk = "/home/xen/domains/SERVER/"
root = "/dev/xvda ro"
name = "SERVER" #domU name
memory = "1024" # 1Gb ram
disk = [ 'file:/home/xen/domains/SERVER/disk.img,xvda,w', 'file:/home/xen/domains/SERVER/swap.img,xvdb,w'] #
vif = [ 'ip=XXX.XXX.XXX.XXX,mac=XX:XX:XX:XX:XX:XX', ]
on_reboot = 'restart'
on_crash = 'restart'

5. At last we start the machine and confirme that all works fine.
xm create /etx/xen/SERVER.cfg
xm console SERVER


Stats of Apache connections with cacti

June 30, 2012
tags: ,

I have created a template for monitoring apache connections with cacti. It very simple to use and also with a small modification can be used to monitoring any port of the server.
Here is a graph image:

To download th files click here.

PHP 5.3 on Debian without compiling

June 30, 2012
tags: , ,

Ok, lets explain this. I’m a big fan of RedHat/Centos linux and in moments like this I know why. My boss asked me to install a debian lenny server with php 5.3.x on it. I spent a lot of time on the installation but at the end it was done.

Searching on the web I found the same on every site, add some repositories to my sources.list file. I done that but when i try to install php5 I finaly got installed php5.2.

How I fix this?, here we go:
I take the repositories and download one by one all the php5.3 binaries files with a wget command.

Then I installed all the binaries:
dpkg -i libapache2-mod-php5_5.3.6-6~dotdeb.0_amd64.deb php5*
And restarted the apache service.
When I check the php version with php -v it shows me some libraries errors. To fix those errors I run
apt-get -f install
Then I restarted again the apache service and finaly got correctly installed php5.3

Partition a tar.gz file

June 30, 2012

Sometimes I get what can be consider an usually problem. Some backups generates tar.gz files to big to been manipulated. The way I found to fix this it’s use the next command:
split -b 10G file.tar.gz file

In these case every partition will be a 10Gb file.
To undo those changes:
cat file* > newfile.tar.gz

Multiple gateways on Linux

June 30, 2012

In my work i had to configure a linux server to respond requests from 2 internet interfaces. In other words I have to indicate the server to respond every request from the interface where it comes
After a few minutes on google I found the link that I share with you.

Click here

How to mount Windows shares on Debian

June 30, 2012

1. First than all, we have to install samba file system:
sudo apt-get install smbfs

2. At the users home directory create a file with the domain credentials:
cd /home/username
echo username=domainuser> .smbpasswdecho password=domainpassword» .smbpasswdchmod 600 .smbpasswd

3. Create the directories for the shared directories:
cd /mntmkdir directoy1

4. Check the uid and the gid from the linux user:
sudo cat /etc/passwd |grep username

That line will return us something like:
username:x:1000:1000:User Names „,:/home/username:/bin/bash

In these case the uid and the gid code is 1000.

5. Edit the fstab file and add the commands to mount the shares
sudo nano /etc/fstab

Inside the file we have to add a line by every shared directory that we want to mount:
// /mnt/directory1 smbfs credentials=/home/username/.smbcredentials,uid=1000,gid=1000 0 0

6. Finally we check the configuration and we mount the shares:
mount -a

How to install old Java versions on Debian

June 30, 2012
tags: , ,

1. Select the version that you want from here.

2. As root install fakeroot and java-package for compilation.
apt-get install fakeroot java-package

3. As a simple user, compile the bin file that you downlaod before:
fakeroot make-jpkg jre-1_5_0_11-linux-i586.bin

4. As root install the deb file that we create in the last step:
dpkg -i sun-j2re1.5_1.5.0+update11_i386.deb