The One with the Thoughts of Frans

Archive for Ubuntu

Lighttpd and PHP on Ubuntu

I prefer Lighttpd over Apache on my personal computers because of its phenomenal speed and reduced memory usage. It’s surprisingly easy to get Lighttpd and PHP running on Ubuntu. For an extensive guide, including how to enable MySQL, Ubuntu Geek is the place to be.

This entry only deals with the basics of getting Lighttpd up and running with PHP. To get started, use:

sudo apt-get install lighttpd php5-cgi

Then run lighty-enable-mod and enter fastcgi.

Then you can edit /etc/lighttpd/lighttpd.conf. Stick the following at the end:

fastcgi.server = ( “.php” => ((
“bin-path” => “/usr/bin/php5-cgi”,
“socket” => “/tmp/php.socket”
)))

Recommended: sudo apt-get install php5-curl php5-tidy to be able to run Tubes with all functionality, and of course any other modules you might like. There’s nothing to it; you don’t even have to edit php.ini.

When you’re done customizing things to your liking, use sudo /etc/init.d/lighttpd restart to see the changes.

Comments

How to Add Keyboard Shortcuts to Ubuntu/Gnome

Someone asked me how to find a shortcut key to call something like Task Manager to terminate a program.

In Ubuntu 9.04 and 9.10, the following applies:

  1. The easiest option in this particular instance:

    Alt + F2, gnome-system-monitor, Enter

  2. The slightly more complicated (though still easy), always applicable option:

    System > Preferences > Keyboard Shortcuts

    Click Add

    Type whatever you like in name. “System Monitor”, “Task Manager” or anything you like. It doesn’t really matter, just so you can identify it yourself.

    Type gnome-system-monitor in Command.

    Click Apply.

    Scroll down to the bottom (Custom Shortcuts)

    Click on where it says “Disabled”

    Press Ctrl + Alt + Del (by default this keybinding gives you the logout/shutdown screen, so you’ll probably get a warning about reassigning this particular combination).

For more information on keybindings in Ubuntu, I’d advise you to read the community documentation. If you’re interested, you can also check out the original context of what I wrote in this post.

Comments

Mounting Remote Filesystems With sshfs

This is a condensed and edited version of the Ubuntu Blog guide regarding how to mount a remote ssh filesystem using sshfs, based on my personal experience.

Before you can use sshfs, you’ll need an SSH server. This is useful for all kinds of things, but that’s not important here. To set up an SSH server in Ubuntu, all you need to do is sudo apt-get install openssh-server. Setting it up in Cygwin (like I did to access my Windows box, and to tunnel VNC through it) is a bit trickier, but there are decent tutorials out there. Once that’s taken care of, you can set up sshsf.

sudo apt-get install sshfs
sudo mkdir /media/dir-name
sudo chown `whoami` /media/dir-name
sudo adduser `whoami` fuse

Log out and log back in again so that you’re a proper part of the group.

Mount using sshfs [user@]host.ext:/remote-dir /media/dir-name; unmount using fusermount -u /media/dir-name.

It all worked perfectly for me, but if not, there’s apparently a solution.

If you get the following error:

fusermount: fuse device not found, try ‘modprobe fuse’ first

You will have to load the fuse module by doing:
$sudo modprobe fuse

You can add fuse to the modules that are loaded on startup by editing the file /etc/modules and adding a line with only the word “fuse” in it, at the end.

and then issue the sshfs command above again.

If you’re on Windows, don’t panick. Dokan SSHFS will perform the same task.

It should be noted that this is even easier within KDE applications, where you can simply use fish://your-server.com, but sshfs cooperates better with the rest of my system. Trying the same with Dolphin in KDE on Windows results in a KIOslave going crazy using all the CPU it can, however.

Aside from easy editing of files directly on my Windows box, this finally enabled me to stream videos from my Windows box, although right now only lower quality ones since it’s also connected through WLAN. With Samba things just weren’t working out, and the same applied to FTP (though it was better for file transfers than Samba, I have to say). Admittedly, this still actually uses FTP under the hood, but it just works better. Besides it will also be more secure to use remotely thanks to SSH.

Comments

Grub2 Brilliance

This is what update-grub outputs (I keep typing grub-update because it just seems more logical):

$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-16-generic
[…]
Found Windows 7 (loader) on /dev/sda1
[…]
done

This is what /etc/default/grub wants to set the default boot entry:

GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda1)"

Thanks. That really made things so much simpler.

Comments (2)

Using exiv2 to Help Manage Your Pictures

Installation

As always, in Ubuntu it’s a piece of cake with sudo apt-get install exiv2.

Adjusting Exif Date/Time

With exiv2, exiv2 ad -a [-]HH[:MM[:SS]] file does the job.

For example, my camera was still on DST when I shot my new year’s fireworks pictures, which made them appear as if they were shot at 1 AM. Thus, I ran the command exiv2 ad -a -1 *.JPG to fix it.

Using a Command File

I use a file named exif-copyright-2010.txt (and another one for 2009 etc.) with just two lines in it, which I apply instantly when grabbing pictures from my camera. This file contains the following lines.

add Exif.Image.Artist	Ascii	"My name"
add Exif.Image.Copyright	Ascii	"Copyright © 2010 My name"

This can be applied using exiv2 -m /somewhere/exif-copyright-2010.txt file. I used to mess about with batch processing in graphical applications — which worked fine — but this is much faster.

Read More

You can read more about all of this on the official website.

Comments (2)

Updates on Twitter

I don’t care much for Twitter. The maximum message length of 140 characters is extremely limiting and, unless you resort to chatspeak, it’s hard to say anything meaningful in such a limited space. If you do resort to chatspeak, it won’t look meaningful even if it is. Catch 22! I imagine the best way to say something meaningful is to link to a blog post offering more explanation, or maybe I’m just prejudiced against chatspeak. Regardless, since most people comment on blog posts using Twitter, and everybody and their grandparents is using it, I figured I should look into a way to utilize it in a more meaningful way than logging in about once a year.

microblog-purple offers convenient integration into Pidgin, which I already use for chatting.

That’s what it is, after all: a chat service with a 140-character limit — most chat services offer at least 500 characters or so. At least it has better offline and history support than most. You also need to enable the plugin named Twitgin so you get a character count on the window where you communicate with Twitter.

Since, like I said, almost everybody uses it, I figured it might also be a good idea to announce new blog posts on Twitter automatically. I searched around a bit in the forest of Twitter plugins and WP to Twitter sounds like it best meets my needs. This post is a test of the plugin, and it announces my partial submission to the crowd — not submission in the sense of Islam, but submission in the sense of realism.

Comments

Quick, Unsecured Backup Over FTP

I wanted something that I could easily set as a cron job, and
the following works quite decently. For some reason the same construct does not seem to work with sftp, so if you’ve got any kind of sensitive data you probably shouldn’t use this.

wget -r ftp://user:pass@domain[/folder]

Comments

Ubuntu/Linux Tips That I Can’t Do Without

This post is more of a reference for myself than for other people to read, but some of it might be useful. I’m currently using Ubuntu 9.10.

Audio

My #1 biggest problem with Linux is still audio-related issues. Luckily they are mostly fairly trivial to fix – at least on my laptop. I haven’t figured out how to make my desktop output 5.1 audio through optical out, so I’m still using Windows there.

Crackling Sound

If I boot into KDE4 instead of Gnome then my audio is messed up afterward. I have no idea why, but to fix it I can run alsamixer -Dhw and turn the PCM volume all the way up (or at least higher than 0). Source.

Another issue I’ve noticed is that after adjusting the volume in Gnome or KDE, I can never quite get the volume back up to what was previously 100% (i.e. the same max as in Windows). Starting alsamixer shows that the front and headphone volumes get stuck at about 70%.

Audio input/output

Apparently the Ubuntu System > Preferences > Sound doesn’t properly set the default inputs and outputs for PulseAudio. To use different inputs or outputs for audio for programs you can use pavucontrol. It makes the latest betas of Skype usable on Linux.

Last.FM submission (in Quod Libet and Perhaps Other Applications)

You need to install the Last.FM submission daemon (sudo apt-get install lastfmsubmitd). Also see this bug report.

Browsers

Chromium

I like having a bunch of browsers at my disposal and Chromium comes right after Opera, Links2, Firefox, Epiphany, and Konqueror in my list of favorite browsers. That puts it ahead of most notably Safari and IE. 😉

deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu karmic main

Install using sudo apt-get install chromium-browser. If you forget about the browser suffix then you’ll end up with some kind of Space Invaders clone. It’s quite nice actually, but I keep forgetting about its existence.

Links 2

Always nice to have. sudo apt-get install links2.

Opera

No OS is fully functional if it doesn’t have Opera. Download the latest Qt4 build from FTP because the repository, which is primarily aimed at Debian, doesn’t seem to be working properly right now—and if it did, it would install the Qt3 rather than the Qt4 version. I find that Tango CL does a pretty good job of blending my Opera in with various types of Gnome and KDE looks, although there may be more specialized skins available to take this even further. I use the purple color scheme because it seems to fit in better with the blue looks of my system than the blue color scheme does.

If Flash doesn’t want to work on YouTube in Opera, get rid of all the flashplugin-alternative.so files (or at least make sure that Opera doesn’t see them).

Miscellaneous

AmarokAudio Player

Rhythmbox is some kind of iTunes clone full of bugs. Utterly useless unless you want to listen to one of the predefined Internet radio channels while Ubuntu is installing. Get Amarok with sudo apt-get install amarok. First things first, go to Settings > Configure Amarok and uncheck Show splash screen on startup. While very self-explanatory, still very annoying. I mostly use Amarok for playing internet sources, such as Librivox, Last.FM and various internet radio channels. For my local music I prefer something like foobar2000, which probably translates best to Quod Libet in a Linux context. I would not use Amarok. Goggles Music Manager is my current audio player of choice in Linux, though it leaves much to be desired compared to foobar2000.

Background

I like to use a touch of red as my background on Ubuntu. Source.

Circular scrolling

Install GSynaptics using sudo apt-get install gsynaptics. Go to System > Preferences > Touchpad. Go to the tab Scrolling. Enable circular scrolling. Much better use of the touchpad.

Compositing

I haven’t yet figured out what window manager I want to use. I do like Compiz, but its application switching capabilities are pure bile. Metacity has compositing, but it feels slower than with compositing turned off and you can’t seem to configure anything. I don’t want shadows and all that junk; I just don’t want my windows to take half a second to appear when I switch desktops. I could try to use Metacity compositing in combination with superswitcher, but it just lacks some of that nice 3D accelerated flair. If only the Compiz plugins were properly annotated, perhaps I could take a stab at writing a SmartTab.org clone myself. It’s a pity that with all of Ubuntu’s usability improvements over Windows, application switching isn’t one of them. Perhaps I’ll have to use Kwin, which is much better but feels somewhat out of place.

Compiling Software

Don’t forget that when a ./autogen.sh or a ./configure is complaining about missing a package it’s talking about package-dev. Gave me a headache a couple of times, but I don’t suppose I’ll break my head over it again.

exiv2

Very useful command line utility for taking care of the metadata of your photos. Find out more with man exiv2, my post highlighting some of my favorite options, and at exiv2’s official website.

Glipper

xclipboard forgets what you copied if you close the application from which you were copying; luckily the situation is easy to rectify. sudo apt-get install glipper, right-click on a panel, click “Add to Panel,” select the entry named “Clipboard manager” and click “Add.”

Grub2

Ubuntu 9.10 comes with Grub2. The relevant command to make it dance and sing is update-grub. Things like default boot entry can be set in /etc/default/grub. Don’t forget to add parentheses. Recovering is horribly complicated >compared to ye olde grub.

Keyboard Disabling for External USB Keyboard

It depends on the specific hardware and drivers, but the generic principle may still apply.

To disable internal laptop keyboard: sudo sh -c 'echo -n "i8042" > /sys/bus/platform/drivers/i8042/unbind'

To enable it again: sudo sh -c 'echo -n "i8042" > /sys/bus/platform/drivers/i8042/bind'

If it disables more than intended, at worst you’ll have to reboot.

Keyboard Settings

In System > Preferences > Keyboard go to the tab Layouts. I tend to use USA International (AltGR dead keys), but these settings would probably yield real usability improvements in any layout (most notably the plain USA one). In Layout Options, check the following boxes. I’ve also made a screenshot of my settings.

  • Adding EuroSign to certain keys: 5
  • Compose key position: Right Ctrl
  • Key to choose 3rd level: Right Alt

Now you can type the € sign using Right Alt + 5, type various accents like é using either Right Alt + e or Right Ctrl > ' > e and do other fun things like typing the en dash using Right Ctrl > --. and the em dash using Right Ctrl > ---. There’s an extensive compose key reference available for the characters that you can produce with the compose key; the characters that you can type with the Right Alt modifier depend on your keyboard setup. This can be viewed by utilizing the Add Keyboard interface, but there has got to be an easy way to view the current keyboard layout.

In KDE the same can be achieved in by going to the KDE System Settings > Regional & Language > Keyboard Layout configuration. Under the Layout tab, select Enable keyboard layouts. Then go to Advanced and there you can put the same as outlined above.

MS Core Fonts

Don’t forget about them. They make browsing more pleasant because many websites use MS fonts like Verdana. Install using sudo apt-get install msttcorefonts.

SciTE

Gedit is insufficient and Kate is too slow. Grab the latest version because Ubuntu 9.10 comes with the ancient 1.71. I do like to sudo apt-get install scite it first because it fixes up the icons, menu entries and such—although it fails to properly register it for all the file types that it automatically registers Gedit and Kate for. Note that after make install it results in a /usr/bin/SciTE binary. I simply delete the remaining scite and then rename the SciTE binary to scite, but there are probably some good reasons not to do it like that—too bad.

Some settings that I like for my .SciTEUser.properties.

position.width=700
position.height=800
# Indentation
tabsize=2
indent.size=2
use.tabs=1
#indent.auto=1
indent.automatic=1
indent.opening=0
indent.closing=0
#tab.indents=0
#backspace.unindents=0
statusbar.visible=1

# Sizes and visibility in edit pane
line.margin.visible=1
line.margin.width=4
margin.width=16

# Wrapping of long lines
wrap=1

Screen Capture

You can make videos of applications, regions on your screen, or your entire screen with recordMyDesktop. Install with sudo apt-get install gtk-recordmydesktop.

Temperature sensors

Install sensors-applet to be able to monitor temperatures of various hardware components in a Gnome panel. This depends on lm-sensors, which is of course installed automatically. To make it actually detect all available sensors run sudo sensors-detect. Without doing that, I can’t monitor the temperature of my CPU cores.

Network

Enter Password to Unlock Keyring

To get rid of this annoying behavior, check Available to all users in the settings for the respective network. I prefer to have my network available ASAP, as do many others.

Internet Connection Sharing

I don’t know what the guys at the Ubuntu documentation are smoking, but all you need to do is right click on the NetworkManager icon, Edit Connections, pick the one you want to share through, and pick Shared to other computers in the Method drop-down. They really scared me with that when I wanted to share my laptop’s wireless connection with my desktop to download some updates (not that they got the Linksys wireless USB to work properly).

CommentsTags: ,

« Newer Entries