Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Friday, June 26, 2009

NFS Shares

Modifying both mine and my wife's ubuntu Desktop machines (both running 9.04 at the time of this writing) to mount our music folder (on the MythTV box on the lounge room) locally.

The music is on the media box (called mythty) in the lounge room, at /media/ourmusic

Using NFS, to mount manually it's:

sudo mount mythty:/media/ourmusic /media/ourmusic

(That's servername:serverpath localpath)

Edited /etc/fstab to add:

mythty:/media/ourmusic /media/ourmusic nfs rw rsize=8192,wsize=8192

Sunday, April 19, 2009

Using True Type Fonts with Ubuntu

My wife does a fair bit of crafty stuff, and often finds weird and wonderful fonts to use with her creations. Often they're Windows TTF font files, which aren't linux native.

I simply get her to copy the fonts into a particular directory, and then run the following script.

sudo cp *.ttf /usr/share/fonts/truetype/username/
sudo cp *.TTF /usr/share/fonts/truetype/username/
mv *.ttf /home/username/Fonts/installed/
mv *.TTF /home/username/Fonts/installed/
sudo fc-cache -f -v
You can get all the bacground and other information you'll need in this article on the Ubuntu Wiki, which is where I got a lot of the info for this post.

It simply copies the files into a folder I created to hold installed TTF fonts, (/usr/share/fonts/truetype/username/) which will work for everyone, and then move the filed from the "todo" folder into a backup folder for reference. ( /home/username/Fonts/installed/ )

You'll have to restart any apps (Such as open office) to see the new fonts, but there's no need to log out or reboot.

Note, I commented on this issue a while back, here's the previous post.

Sunday, October 12, 2008

Resizing the swap partition size after install

I just increased the amount of RAM in an Ubuntu web server from 256 MB to 1 GB. I wanted to increase the size of the swap file accordingly. There are various schools of thought as to how big the swap file should be, I went with 2 GB which is almost certainly overkill, but there you go.

My procedure was as follows:
  • Boot to using the Ubuntu8.04 live CD.
  • Use the partition editor to shrink the primary partition, and grow the the swap file partition and volume.
  • Write the changes to the disk.
  • Reboot to the server command line.
  • Determine the swap volume's new UUID using:
ls -l /dev/disk/by-uuid
  • Edit /etc/fstab and change the UUID for the swap partition to the correct value
  • reboot
  • Check that the partition is correctly mounted with the "free" command. Don't mind that you may not be using any of the swap at present, but you can at least tell that it's there for when you do need it.

Text editing with multiple files on the command line

To make my life easier, and considering that my web server doesn't have a GUI I first saved the output of the ls command to a text file, and edited that so that it contained just a single line containing the UUID
I then opened fstab
sudo vim /etc/fstab
and then, at the end of fstab, I inserted the file I'd created with the command:
:r /home/john/uuid.txt
I copied the UUID to the appropriate spot, deleted the line at the end and saved the file.

There are plenty of good tutorials and command summaries for vi / vim around on the web if you need them. (here's one, and another). I admit I'm somewhat conditioned to using graphical editors, but one doesn't always have a choice.

Wednesday, August 6, 2008

VMWare server on Ubuntu

I recently allowed my Ubuntu 8.04 desktop machine to do some upgrades, including some kernel updates. Everything went fine, except that my VMWare server would no longer run, it would start, I'd see the "Starting VMWare Server" block on the panel, but then it'd disappear.

It turns out that VMWare server installations are coupled quite closely with a particular kernel. This sounds sensible, after the fact, but all it really does is point out how shallow my *nix knowledge is in some areas.

Anyway, this fixed things just right, accepting all of the default options along the way:

sudo vmware-config.pl


Edited to fix spelling, and add that I had to repeat this exercise again after another Kernel upgrade 15/08/2008. Trivial after the last time, although still somewhat annoying.

Monday, May 12, 2008

Ripping Audio from a DVD

I was recently asked to get the audio from a DVD and place it on a portable media player. Here's how I did it, using Ubuntu 7.04.

1. Installed mplayer from the repositories

2. played the various chapter until I found the one I was looking for. This can be a bit of a hit and miss process, as DVD's often have rather strange title/chapter builds. The command is:
mplayer dvd://4
Where the "4" refers to the title number. This particular DVD has 6 titles. Apart from playing the chapter, you'll see a bunch of stuff in the console window. click "x" to stop playing. The output includes the following:
Playing dvd://4.
There are 6 titles on this DVD.
There are 2 chapters in this DVD title.
There are 1 angles in this DVD title.
audio stream: 0 format: ac3 (stereo) language: en aid: 128.
audio stream: 1 format: ac3 (stereo) language: zh aid: 129.
number of audio channels on disk: 2.
number of subtitles on disk: 0
MPEG-PS file format detected.
VIDEO: MPEG2 720x480 (aspect 2) 29.970 fps 7500.0 kbps (937.5 kbyte/s)
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
3. The red text above shows the information I needed. There were two audio tracks for this title, I was after the english (en) version. The command to extract the audio is: (This is meant to be all on one line)
mplayer -vc null -vo null -aid 128 -ao pcm:fast:waveheader:file=output.wav dvd://4 -chapter 1-2
The "128" refers to the audio track found in step 2.
"Output.wav" is the output file name.
chapter 1-2 means I want the audio from both chapters. "2-2" would have taken only the second.

4. Import the wav file into audacity, a superb audio editor.

5. I then used audacity to crop and normalize the audio I wanted, including adding nice fade ins and outs.

6. I Again in audacity, export the audio to mp3.

All Done.

References:

Most of this is derived from this post on the Ubuntu forums.

Thursday, February 28, 2008

Audio format conversion

I recorded some audio (my daughter singing), and wanted to send the audio to someone in a generic and friendly format, namely mp3. The Nokia handset records as an amr (Adaptive Multi Rate) file. A good player, like VLC will play this quite happily as-is, but a lot of people wouldn't know what to do with an amr file.

Ubuntu talks happily to my phone, so getting files off is easy. I have a USB data cable (CA-53) for the phone (Nokia 6234). Ubuntu mounts the micro SD card automatically, if you choose "Data mode" from the phone menu once plugged in. "Default mode" doesn't work. Depending on how your handset is setup, you may have to use the handset interface to copy stuff from the phone's built-in memory to the memory card.

I found a program called Mobile Media Converter, which does a great job. I simply downloaded the archive, extracted it somewhere and ran the executable from there. The interface is straightforward, and even supports drag'n'drop if you're into that sort of thing. No settings to tweak, it just works. It's based on ffmpeg, which you may or may not already have installed, but comes with it's own version, so should work regardless.

Tuesday, February 26, 2008

Fixing Microsoft Fonts

I needed to use fonts from documents from Microsoft office, as well as make available some other specialist fonts.

Essentially it's matter of copying the font files to an appropriate directory. I put them in:

/usr/share/fonts/truetype/subfolder


After getting them there it's just a matter of reloading the font cache:

sudo fc-cache -fv


This link on another (far superior to this one) Ubuntu blog had all the info I needed.

Sunday, February 17, 2008

What's in a name?

Renaming a batch of files.

I needed to rename a bunch of images before uploading to flickr. The following worked well enough:

To preview: (Specified by the -n)

rename -n 's/Image/Saturday_/' Image*.jpg
Image000.jpg renamed as Saturday_000.jpg
Image001.jpg renamed as Saturday_001.jpg
Image003.jpg renamed as Saturday_003.jpg


To perform the task, delte the -n. or swap the -n for -v, verbose, which tells you what it's done.

rename 's/Image/Saturday_/' Image*.jpg


Essentially it's:

rename 's/old/new/' SearchFilter


Reference here.

Thursday, February 7, 2008

Roaming Multi-OS Thunderbird

Happy days.

I just managed to setup a relatively painless way to use Thunderbird as my mail client on both my Ubuntu machine, and a Windows XP laptop.

Background:

Late in 2007 my laptop had a coronary. It's had a long and fruitful life, but was suffering from a cracked mainboard, which caused the occasional instant shutdown if it was flexed at all. The LCD screen backlight was also dead, and I'd been using it with an external monitor (or KVM switch in most cases) for 6 months or more. Oh yeah, it also had a missing1 "Y" keycap. Since this time I've been using my Gmail account to check my main email address, and a handful of others.

To be honest, I didn't miss application based email all that much, the Gmail interface is pretty good. However, the ability to work off-line is nice, and I'd like to be able to randomly access archived business stuff, and a few other niceties, so I'd always intended to go back to Thunderbird at some point.

Back to the setup...

So firstly I installed Thunderbird onto a functional XP laptop I've been using, and setup Thunderbird to synch with Gmail in IMAP configuration. Gmail checks my other accounts, so I only need one account in Thunderbird. This also means if I'm at some other PC, I can still get to everything using the Gmail web interface. Good instructions for setting up Thunderbird/gmail IMAP can be found at bother lifehacker and google.

Once I was happy with the IMAP synchronisation I took the laptop home. It's worth making sure that you get all the settings just right, so that if you delete something in Thunderbird, it's available in the Gmail web trash bin, and that sort of thing. All the instructions are in the previous 2 links.

On my Ubuntu machine, I installed Thunderbird using Synaptic, and setup a default mail profile with the bare minimum to get it running. I didn't download any mail. Then I:
1. Copied everything from the Windows Thunderbird profile directory into the Ubuntu profile directory under a sensible name. (Here is where to find these directories)
2. Modified the profile.ini file to point to this directory.
3. Started Thunderbird and started using it on Ubuntu.

Actually, I did the transfer via a portable hard disk, and intend to keep doing tis, so that at any given time, there are at least 3 versions of my profile. You can never have too many backups. And, because I'm using Unison to automate all the synchronisation at the Ubuntu end, I've only got to manually copy stuff on the XP machine. I'll probably automate that using SyncBack, now that I come to think of it.

Still todo:

Settle on a contact management tool. I'm considering using my Gmail address book, I believe there are plugins to access it from Thunderbird. I'm not sure about this, I'm more inclined to do something more flexible to solve this problem. Maybe a home Zimbra server is in order.

Footnotes:
1: Not truly missing, it's in a glassine bag in my laptop bag, somewhere.