Archive for the ‘Linux’ Category
Screenshots of SmudgeVMM alpha
Posted on April 16th, 2010 in Cakephp, Linux, PHP | 4 Comments »
Thank you to all the people who have enquired about Smudge Virtual Machine Manager
The software is coming along nicely. We hope to have the new website and the beta, available by the end of next month.
Here are a few teaser screen shots.
SmudgeVMM – Svmm – Smudgeit Virtual Machine Manager
Posted on February 15th, 2010 in Cakephp, Linux, PHP | No Comments »
I’m currently involved in a a new php project that will allow users to manager Xen virtual containers, through a simple web interface or robust API.
SmudgeVMM is being written in CakePHP and will run as a stand alone webservice, on any Centos Xen server.
Features include: Multiple interfaces (WAN and LAN), SAS storage (iscsi and NAS), package templates, support for most flavors of linux, integration with most hosting shopping carts, reseller and multi user level permissions along with complete Xen VPS container management.
Reducing an ext3 Logical Volume’s Size
Posted on January 14th, 2010 in Linux | No Comments »
Here are the commands to reduce an ext3 file system and also the Logical Volume that holds it.
Warning please make sure you leave enough space for the files inside, or data may be lost.
First make sure the files system isn’t mounted then.
e2fsck -f /dev/VolGroup00/disk1_rootimg
resize2fs -p /dev/VolGroup00/disk1_rootimg 15G
lvreduce –size 15G /dev/VolGroup00/disk1_rootimg
resize2fs /dev/VolGroup00/disk1_rootimg
This should reduce the file system to 15G
Generating a file list, for a Joomla Component XML info file
Posted on December 8th, 2009 in Apple OSX, Linux, PHP | 1 Comment »
I’ve had to do some work for a company recently.
It involved me creating Joomla components and those annoying XML files, listing all the files and folders to install.
If you want a quick command to generate the xml, you can cd to the directory then run
find * -type f -exec echo ‘<filename>’{}’</filename>’ \;
find * -type d -exec echo ‘<folder>’{}’</folder>’ \;
Then you can copy the output from the terminal and paste between the files tags.
<files folder=”components/com_test”>
<filename>controller.php</filename>
<filename>css/test.css</filename>
<filename>views/test/tmpl/index.html</filename>
<filename>test.php</filename>
<folder>css</folder>
<folder>images</folder>
<folder>install_sql</folder>
<folder>models</folder>
<folder>player</folder>
<folder>views</folder>
<folder>views/user</folder>
<folder>views/user/tmpl</folder>
<folder>views/test</folder>
<folder>views/test/tmpl</folder>
</files>
I repeated this for the administrator/components/com_test and components/com_test folders
New VPS Server
Posted on July 6th, 2009 in Apache, Linux | No Comments »
I’m now running the site on a new Xen VPS server with Smudgeit. The site is running smoothly and no issues to report.
I chose to go with a UK Centos Xen VPS Server.
HyperVM Manual Alternative for creating Xen Domu using LVM
Posted on June 26th, 2009 in Linux | 2 Comments »
After the sad death of K T Ligesh I decided, like many people, to move away from HyperVM.
I searched and tried many control panels.
Openqrm – I found this over kill
karesansui – This is very nice looking and polished but seemed quite slow.
VDS Manager – Still in beta for Xen
I’ve now decided to create the VM’s by hand. I then hope to make a PHP control panel of my own. Here are my steps for creating Xen VPS’s using the command line and Centos 5.
I’m going to create a vm called testvm
First I needed to find out what Volume groups exist on my system and what the VG Name was
lvdisplay
VG Name VolGroup00
Create the disks for the VM and format
lvcreate -L8.5G -n testvm_rootimg VolGroup00
lvcreate -L 384M -n testvm_vmswap VolGroup00
mke2fs /dev/VolGroup00/testvm_rootimg
tune2fs -j /dev/VolGroup00/testvm_rootimg
mkswap /dev/VolGroup00/testvm_vmswap
mkdir /mnt/img
mkdir /mnt/vm
Now mount your disk image. I’ve created a custom hardened Centos distro, but you could use Jailtime Images
mount -o loop centos.5-3.64-smudge.img /mnt/img
mount /dev/VolGroup00/looop_rootimg /mnt/vm
Copy the image onto your new partition
cp -a /mnt/img/* /mnt/vm/
Now all you need to do is configure the hostname, ip etc on the VM.
vi /mnt/vm/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=87.xxx.xxx.xxx
NETMASK=255.255.255.xxx
ONBOOT=yes
Change the hostname
vi /mnt/vm/etc/sysconfig/network
If your using Jailtime images people have advised to change this line to the following:
vi /mnt/vm/etc/inittab
1:2345:respawn:/sbin/mingetty console
vi /mnt/vm/etc/ssh/sshd_config
PermitRootLogin yes
vi /mnt/vm/etc/fstab
Add the line:
/dev/sda2 swap swap defaults 0 0
umount /mnt/img /mnt/vm
You will need a ram disk to boot from. This can be created by running:
mkinitrd /boot/xen-guest-initrd `uname -r` –with xenblk –with xennet –preload xenblk –preload xennet –omit-scsi-modules
Now all you need to do is create the config file and give it an IP/ Mac address.Please check which kernel you are using first and change – kernel = “/boot/vmlinuz-2.6.18-128.1.14.el5xen”…
kernel = “/boot/vmlinuz-2.6.18-128.1.14.el5xen”
ramdisk = ‘/boot/xen-guest-initrd’
maxmem = 192
memory = 192
vcpus = 1
name = “testvm”
vif = [ 'ip=87.xxx.xxx.xxx,bridge=xenbr0, rate = 1000KB/s, mac=aa:00:23:b0:de:34' ]
serial = ‘pty’
disk = ['phy:/dev/VolGroup00/testvm_rootimg,sda1,w', 'phy:/dev/VolGroup00/testvm_vmswap,sda2,w']
root = ‘/dev/sda1 ro’
on_poweroff = ‘destroy’
on_reboot = ‘restart’
on_crash = ‘restart’
All is ready to go.
Just run:
xm create testvm
And you VPS should be now running:
check with
xm console testvm
Hope this helps.
Smudge IT will be lauching a new site and Xen Vps systems soon. Watch this space..
Usefull Ffmpeg commands for creating FLV files
Posted on March 18th, 2009 in Linux | No Comments »
Converting to flv
ffmpeg -i Head Office Version.ts -ar 22050 -ab 128 -f flv -s 448×252 – | flvtool2 -U stdin video.flv
or with better bitrate
ffmpeg -i happy_feet_h.i480.mov -ar 22050 -ab 128 -b 800 -f flv -s 480×204 – | flvtool2 -U stdin happyfeet.flv
Generate thumbnail
This creates a thumb of 12 seconds into the video
ffmpeg -y -i head_office.flv -f image2 -ss 12 -vframes 1 -an head_office.jpg
Generating a thumbnail preview, of a video using PHP
Posted on March 16th, 2009 in Linux, PHP | No Comments »
This is just a one liner as my class uses lots of method etc that you probably don’t need.
The money shot is this:
if (! file_exists ( $thumb_dir . $thumbname )) {
$draw_thumb = shell_exec ( $this->ffmpeg . ' -y -i ' . $video_file . ' -f image2 -ss 10 -vframes 1 -an ' . $thumb_dir . $thumbname );
}
($this->ffmpeg = the location of the ffmpeg binary)
This will generate a thumbnail of the video at 10 seconds.
Detecting a videos dimensions using PHP and FFMPEG
Posted on March 16th, 2009 in Linux, PHP | 7 Comments »
Here is a method, that I pulled out of one of my video conversion classes.
All you need to do is set the location of ffmpeg ($this->ffmpeg)
It will then parse and return the video dimensions. More video methods to follow
/**
* Get the dimensions of a video file
*
* @param unknown_type $video
* @return array(width,height)
* @author Jamie Scott
*/
function __get_video_dimensions($video = false) {
if (file_exists ( $video )) {
$command = $this->ffmpeg . ' -i ' . $video . ' -vstats 2>&1';
$output = shell_exec ( $command );
$result = ereg ( '[0-9]?[0-9][0-9][0-9]x[0-9][0-9][0-9][0-9]?', $output, $regs );
if (isset ( $regs [0] )) {
$vals = (explode ( 'x', $regs [0] ));
$width = $vals [0] ? $vals [0] : null;
$height = $vals [1] ? $vals [1] : null;
return array ('width' => $width, 'height' => $height );
} else {
return false;
}
} else {
return false;
}
}

