image_alt_text

Archive for the 'Linux' Category

1

Mar/10

PDF Printer In Ubuntu

Monday, March 1st, 2010

It is really simple to add a PDF printer in Ubuntu 9.10. A PDF printer prints a page and writes to a file in PDF format. To install this feature typer in the terminal:
sudo apt-get install cups-pdf

That’s it. It should install and even add the printer automatically.

13

Feb/10

Mount ISO File In Linux

Saturday, February 13th, 2010

A neat trick in Linux is the ability to mount an .iso file as if it was a CDROM.

The command to do this is:
sudo mount -t iso9660 -o loop /home/danny/filename.iso /media/cdrom

where “/home/danny/filename.iso” is the path to the ISO file and the latter “/media/cdrom” is the mount point. In this case it will mount it where the CDROM would normally be mounted on.

Mount ISO as CD-rom not as a folder

12

Feb/10

NFS Server

Friday, February 12th, 2010

Overview

Network File Share (NFS) is a protocol for sharing storage. It is quite common in Network Attached Storage (NAS) devices and is a standard compared to Samba which is Microsoft specific but has been ported to Linux.

Install NFS Server

Install the relevant software:
sudo apt-get install nfs-kernel-server nfs-common portmap

Configure NFS Server

Configuring NFS server is relatively simply. Edit the file /etc/exports file and add all the directories available as a share. The format should be as follows

/media/cdrom 192.168.0.1/24(rw,async)

  • mount point on local system.
  • host
  • permissions
  • Using the above string this would share the CDROM to any computer with the IP range 192.168.0.1-192.168.0.254 that has read and write permissions and requests can be process asynchronously.

    Specific IPs can be given to each share like this:

    /media/cdrom 192.168.0.1(rw,async) 192.168.0.1(ro,async)

    Computer 192.168.0.1 has the permissions described in the above example and the computer with 192.168.0.2 only has asynchronous requests and read only access to files for that share.

    When specifying mount points note where the spaces are and are not because spaces are read by the system so

    /media/cdrom 192.168.0.1 (rw,async)

    is invalid because there is a space between the IP address and the parenthesis.

    Once all the shares have been configured it is necessary to restart NFS to see the changes:
    sudo /etc/init.d/nfs-kernel-server restart

    Mount NFS Share On Linux

    Install the NFS client if the computer does not have a NFS server itself:
    sudo apt-get install portmap nfs-common

    To mount the share manually from the terminal type the following:
    sudo mount 192.168.0.1:/media/cdrom /media/share
    First is super user command sudo then mount command, IP address of NFS server followed by the path to share. The last parameter is the local mount point so in the above example it will mount the CDROM drive from the server onto /media/share directory of the client computer.

    To make the mount more permanent edit the /etc/fstab file and the following line, one for each NFS share.

    192.168.0.1:/media/cdrom /media/share nfs rsize=8192,wsize=8192,timeo=14,intr

    The only part that needs to be changed is the IP address, NFS share point and the mount point. This is highlighted in bold in the example above. The rest should be fine left as is. This change should mount the share when the computer is started.

    Mount NFS Share On Windows 7 Ultimate Edition

    NFS support does not come as standard with Windows so it has to be installed. Also I only found the feature in Windows 7 Ultimate Edition and not the Professional. I believe there is a Business Edition in between but do not know if it has the support for NFS.

    Go to the Control Panel and on the left hand side click on Turn Windows features on or off hyper link. It will load a list of software in a tree / node structure. Find Services for NFS and tick Client for NFS as a minimum.

    On the start menu right click on Network and select Map network drive. If this option is not in the start menu go to Computer and right click on Network from the left hand panel. A wizard will start for mapping a network drive.

    Select the drive letter to be assigned to the NFS share and for the Folder enter the address [server]:[path] for example 192.168.0.1:/media/cdrom
    Tick Reconnect at logon if you want it to connect on start up and click Finish to end the wizard.

    The only problem with mounting the NFS on Windows is every time Computer it takes a longer to scan and load the drives because it scans the NFS to get the size and amount used on the NFS.

    Summary

    NFS between Linux machines is perfect and a good way to share files. Mounting a NFS makes the local share look as if it was it was local drive.

    For Windows I’d stick to using Samba because it doesn’t take a while to scan the shared drive every time the drive is highlighted to get the drive information such as amount of space available. It’s not a nice to administer two services doing the same thing but it works.

    NFS Server and Client Configuration in Ubuntu

    8

    Feb/10

    MediaTomb DLNA To Playstation 3

    Monday, February 8th, 2010

    Overview

    I found the Video plugin for MythTV 0.21 to be inadequate for streaming to the Sony Playstation 3. It didn’t update fast enough when you dropped a video into the UPnP directory and also there was no external way of telling it to refresh it’s list of files without starting up Myth Frontend.

    MediaTomb

    MediaTomb is a UPnP server which can run as a standalone or as a daemon. It uses an XML configuration file for it’s settings (pretty neat stuff) and is pretty small in size. The software comes with it’s own web server so you don’t have to install a full apache install to get to the control panel and it uses SQLite by default so no big database backend to be installed.

    Install & Configure MediaTomb

    Install MediaTomb and ffmeg thumbnailer
    sudo apt-get install mediatomb ffmpegthumbnailer
    That’s it for the install!

    edit the file config file in /etc/mediatomb/config.xml and change the following settings:

    Enable PS3 support change this:

    <protocolInfo extend=”no”/><!– For PS3 support change to “yes” –>

    to

    <protocolInfo extend=”yes”/><!– For PS3 support change to “yes” –>

    and also

    <!– <map from=”avi” to=”video/divx”/> –>

    to

    <map from=”avi” to=”video/divx”/>

    Add the line
    <pc-directory upnp-hide="yes"/>
    below
    <webroot>/usr/share/mediatomb/web</webroot>
    so that it looks like this
    <webroot>/usr/share/mediatomb/web</webroot>
    <pc-directory upnp-hide="yes"/>

    This hides the full directory path from the Playstation so it can only view the directories added and not the full system.

    Add the following to enable thumbnail previews. I have found this does not work 100% of the time.

    Enable transcoding
    <transcoding enabled="no">
    to
    <transcoding enabled="yes">

    Add the following transcode mappings under <mimetype-profile-mappings> tag:

    <transcode mimetype=”video/divx” using=”video-thumbnail”/>
    <transcode mimetype=”video/mpeg” using=”video-thumbnail”/>
    <transcode mimetype=”video/mp4″ using=”video-thumbnail”/>
    <transcode mimetype=”video/x-ms-wmv” using=”video-thumbnail”/>

    Add the following settings between the <profiles></profiles> elements. Not the parent is plural and each profile is singular.

    <profile name=”video-thumbnail” enabled=”yes” type=”external”>
    <mimetype>image/jpeg</mimetype>
    <accept-url>yes</accept-url>
    <thumbnail>yes</thumbnail>
    <resolution>128×128</resolution>
    <agent command=”/usr/bin/ffmpegthumbnailer” arguments=”-i %in -o %out -s 128″/>
    <buffer size=”524288″ chunk-size=”512″ fill-size=”1024″/>
    </profile>

    Restart MediaTomb service sudo /etc/init.d/mediatomb restart If it fails to restart then double check the config file for errors.

    Go to the machine in a web browser on port 49152 e.g http://localhost:49152

    On this web page configures the directories available over UPnP. The Database section shows what directories are visible / registered to MediaTomb and Filesystem shows the computer directories that can be added for DLNA / UPnP visibility. When a directory is added MediaTomb scans the directory and register them so they show up on the Playstation. These can include music, videos and pictures.

    In the top right hand corner there is a plus “+” with two arrows around it. Clicking on it loads a new page in the main window, replacing the file lists in the directory. This is the page for setting how often it scans for changes.

    Go to the Playstation, turn it on and go to the relevant category e.g photo in the menu. There should be a MediaTomb server in the list. If it does not appear go towards the top and scan for more media servers to look for MediaTomb.

    Summary

    The software is pretty self contained but I would have liked the option to use Apache and MySQL because those are already installed on my system.

    MediaTomb does the job for now and whilst I cannot get the thumbnails to work on all the media it still does a brillant job of streaming the media to the Playstation. Unfortunately it’s not integrated into MythTV so records will still have to be done via MythTV but this is not a problem because all recorded TV shows are registered in the database.

    A problem I did encounter was that I added multiple directories but reguardless of where they reside on the computer, all videos appear in one directory on the Playstation. I’m not sure if this is a bug or how it’s suppose to work.

    [HOWTO]:Stream DivX/XviD to a PS3 with firmware 2.10 using MediaTomb and Ubuntu 7

    31

    Jan/10

    Enable SFTP On VSFTPD In Ubuntu

    Sunday, January 31st, 2010

    Enabling SFTP is very easy and makes FTP protocol a lot more secure than traditional FTP because passwords are not sent in plain text which is susceptible to a lot of things such as packet sniffers, man-in-the-middle, etc.

    Assuming VSFTPD has been installed (in the default location) edit the file /etc/vsftpd.conf and check there are security certificates installed and configured.

    There are two entries which start with either:
    dsa_cert_file
    dsa_private_key_file

    or
    rsa_cert_file
    rsa_private_key_file

    Each specifying a file path to where the key and certificates are located.

    The last step is to enable SFTP by adding the following line:
    ssl_enable=YES
    Save and exit the file and restart the FTP server sudo /etc/init.d/vsftpd restart