Archive

Archive for the ‘Ubuntu’ Category

Ubuntu 11.04 Installer Fail

August 24th, 2011 3 comments

So I decided to take a go at Ubuntu 11.04 in a virtual machine before taking the leap and installing it for real. As I understand it, the new Unity desktop is a pretty major departure from the Gnome 2.x desktop that I’m used to, and I want to see if it’s as bad as it looks in the screenshots.

Unfortunately, I’ve yet to make it to the desktop, as Ubuntu has decided that it will take 42 minutes to download some language packs that I neither want or need.

Didn’t I tell it what language I speak as the first step of the install process? Surely this can be done later.




On my Laptop, I am running Linux Mint 12.
On my home media server, I am running Ubuntu 12.04
Check out my profile for more information.
Categories: God Damnit Linux, Jon F, Ubuntu Tags:

Linux Multimedia Studio on Ubuntu 10.04

July 31st, 2011 1 comment

Recently, Tyler linked me to Linux Multimedia Studio, a Fruityloops-type application for Linux. Since I’m big into music recording and production, he figured that I’d be interested in trying it out, and he was right. Unfortunately, the developers of same were not as interested.

To start off, I installed the application from a PPA with the following terminal commands:

sudo apt-add-repository ppa:dns/sound
sudo aptitude update
sudo aptitude install lmms

After the install process finished, I tried to launch the application from the command line, only to see a bunch of nasty error messages:

jonf@THE-LINUX-EXPERIMENT:~$ sudo lmms
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
Segmentation fault

I dumped the errors into Google, and found a helpful thread on the Ubuntu forums that suggested that I uninstall Bluetooth Audio Services from my machine. Since I don’t use bluetooth audio in any capacity, I happily obliged. When finished, my list of installed items with Bluetooth in the name looked like this:

A list of installed software matching the search term "bluetooth" in Ubuntu Software Centre

Unfortunately, I didn't think ahead enough to note down the names of the packages that I uninstalled.

After ridding myself of Bluetooth audio support, I tried to launch the application again. Unfortunately, I got another Segmentation fault error:

jonf@THE-LINUX-EXPERIMENT:~$ sudo lmms
Segmentation fault

Reading on in the thread, I saw somebody suggest that I check the dmesg tail for messages pertaining to the crash:

jonf@THE-LINUX-EXPERIMENT:~$ dmesg | tail
[  233.302221] JFS: nTxBlock = 8192, nTxLock = 65536
[  233.314247] NTFS driver 2.1.29 [Flags: R/O MODULE].
[  233.343361] QNX4 filesystem 0.2.3 registered.
[  233.367738] Btrfs loaded
[ 2233.118020] __ratelimit: 33 callbacks suppressed
[ 2233.118026] lmms[10706]: segfault at 7f241c7fdd80 ip 00007f241c7fdd80 sp 00007f24187f8a38 error 14 in zm1_1428.so[7f241ca01000+1000]
[ 2523.015245] lmms[10808]: segfault at 7fd80e9bcd80 ip 00007fd80e9bcd80 sp 00007fd80a9b7a38 error 14 in zm1_1428.so[7fd80ebc0000+1000]
[ 2671.323363] lmms[10845]: segfault at 7fbe39a77d80 ip 00007fbe39a77d80 sp 00007fbe35a72a38 error 14 in zm1_1428.so[7fbe39c7b000+1000]
[ 2836.885480] lmms[11246]: segfault at 7f885b71ed80 ip 00007f885b71ed80 sp 00007f8857719a38 error 14 in zm1_1428.so[7f885b922000+1000]
[ 3039.773287] lmms[11413]: segfault at 7ff83056ed80 ip 00007ff83056ed80 sp 00007ff82c569a38 error 14 in zm1_1428.so[7ff830772000+1000]

On the last few lines, you can see that the error was thrown in a module called zml_1428.so. A bit of Googling turned up the fact that this module is a part of the LADSPA (Linux Audio Developers Simple Plugin API) stack, which provides developers with a standard, cross-platform API for dealing with audio filters and effects.

Scrolling down in the aforementioned thread, I found a post that suggested that I kill all PulseAudio activities on my system before attempting to run the application. PulseAudio is another part of the Linux audio layer that allows user-land applications to talk to your sound hardware via a simple API. It also provides some effects plugins and mixdown capabilities. I went ahead and killed the PulseAudio server on my machine with the following command:

jonf@THE-LINUX-EXPERIMENT:~$ killall pulseaudio

After executing this command, I still got a Segmentation fault when starting LMMS under my user account, but did actually get to a Settings panel when running it with Sudo:

jonf@THE-LINUX-EXPERIMENT:~$ sudo lmms
Home directory /home/jfritz not ours.
ALSA lib pcm_dmix.c:1010:(snd_pcm_dmix_open) unable to open slave
Playback open error: Device or resource busy
Expression 'snd_pcm_hw_params_set_buffer_size_near( self->pcm, hwParams, &bufSz )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1331
Expression 'PaAlsaStreamComponent_FinishConfigure( &self->playback, hwParamsPlayback, outParams, self->primeBuffers, realSr, outputLatency )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1889
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1994
Couldn't open PortAudio: Unanticipated host error
Home directory /home/jfritz not ours.
Home directory /home/jfritz not ours.

Although the output appeared to be riddled with audio layer errors, and the Audio Settings tab of the Setup panel gave me a clue as to why:

Notice how the Audio Interface setting in that image says “Pulse Audio (bad latency!)”. I would hazard a guess that the latency issues with PulseAudio have something to do with the fact that I killed it just prior to getting this damned thing to launch. When I hit the OK button, I was able to see the application, but there was no sound.

Figuring that sound was a necessary component of an audio production application, I booted back to the Setup menu, and told the app to funnel its audio through JACK instead of PulseAudio. The JACK Audio Connection Kit is another sound subsystem, kind of like PulseAudio, that provides an API that developers can use to interface with a machine’s audio hardware. Because of its low latency performance, JACK is often considered to be the standard API for high-quality audio recording and production apps. Unfortunately, it doesn’t work worth a damn in LMMS:

jonf@THE-LINUX-EXPERIMENT:~$ sudo lmms
jackd 0.118.0
Copyright 2001-2009 Paul Davis, Stephane Letz, Jack O'Quinn, Torben Hohn and others.
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details

no message buffer overruns
JACK compiled with System V SHM support.
loading driver ..
SSE2 detected
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
control device hw:0
SSE2 detected
all 32 bit float mono audio port buffers in use!
cannot assign buffer for port
cannot deliver port registration request
no more JACK-ports available!
No audio-driver working - falling back to dummy-audio-driver
You can render your songs and listen to the output files...
Home directory /home/jfritz not ours.
Home directory /home/jfritz not ours.
the playback device "hw:0" is already in use. Please stop the application using it and run JACK again
cannot load driver module alsa
Home directory /home/jfritz not ours.

Having dealt with JACK on a previous install, I had one more trick up my sleeve in my effort to get this bastard application to make a sound. I installed the JACK Control Panel from the Ubuntu Software Centre. It’s a QT app that interfaces with the JACK server and allows you to modify settings and stuff.


With it installed, I pressed the big green (or is it red – I’m colour blind, and hate when developers use these two colours for important status messages) Start button, only to encounter some nasty errors:


That might be a problem. I hit the messages button and found a message advising me to make a change to the /etc/security/limits.conf file so that JACK would be allowed to use realtime scheduling:

JACK is running in realtime mode, but you are not allowed to use realtime scheduling.
Please check your /etc/security/limits.conf for the following lines
and correct/add them:
@audio - rtprio 100
@audio - nice -10
After applying these changes, please re-login in order for them to take effect.
You don't appear to have a sane system configuration. It is very likely that you
encounter xruns. Please apply all the above mentioned changes and start jack again!

I figured that it was worth a shot, considering how far I’ve already gone just to try out a piece of software that I don’t really even need. I made the requested changes in the config file, restarted my machine and tried again… only to be greeted by the same damned error message.

At this point, I decided to give up on LMMS. It’s too damned complicated, and ultimately not worth my time. Perhaps when they release a version that I can install and start using without an hour of troubleshooting, I’ll come back and give it another shot. In the mean time, if you’re looking for a decent drum machine with more than a few tricks up its sleeve, check out Hydrogen Drum Machine. It works very well, and I’ve created some neat stuff in it.




On my Laptop, I am running Linux Mint 12.
On my home media server, I am running Ubuntu 12.04
Check out my profile for more information.

How to Compile Banshee 1.9.0 on Ubuntu 10.04

December 9th, 2010 1 comment

Regular readers of this site will know that I’m no fan of Rhythmbox. When I recently installed Ubuntu 10.04 on my desktop PC, I decided to give Gnome’s default media player a few days to win back my affection. Unfortunately, while Novell’s Banshee project appears to be moving ahead with lots of great new features, Rythmbox still suffers from the issues that I outlined in my now infamous lambasting of it, nearly 8 months ago. To be fair, the pre-installed version of Rythmbox is only 0.12.8 on Ubuntu 10.04 (the same one that I reviewed previously), while the project has forged ahead to version 0.13.2.

Regardless, I prefer to listen to my music with Banshee, and I’m itching to try the latest version. On November 10th, the project released Banshee 1.9.0, and it looks positively excellent. I decided to give it a go, and downloaded the source tarball from the project’s website. Following are the steps that were necessary to install it:

  1. Head over to a terminal and install intltool, libgtk2.0-dev, libgtk2.0-cil-dev, libmono-dev, mono-gmcs, libmono-addins-cil-dev, monodoc-base, boo, libboo-cil-dev, libmono-addins-gui-cil-dev, libndesk-dbus-glib1.0-cil-dev, libgdata-dev, libgdata-cil-dev, libtag1-dev, libtaglib-cil-dev, sqlite3, libsqlite3-dev, libgconf2.0-cil-dev, libmtp-dev, libmono-zeroconf1.0-cil, libmono-zeroconf1.0-cil-dev, libwebkit-dev, libwebkit-cil-dev, and libsoup-gnome2.4-dev with the following command:

    sudo apt-get install intltool libgtk2.0-dev libgtk2.0-cil-dev libmono-dev mono-gmcs libmono-addins-cil-dev libmono-addins-gui-cil-dev monodoc-base boo libboo-cil-dev libndesk-dbus-glib1.0-cil-dev libgdata-dev libgdata-cil-dev libtag1-dev libtaglib-cil-dev sqlite3 libsqlite3-dev libgconf2.0-cil-dev libmtp-dev libmono-zeroconf1.0-cil libmono-zeroconf1.0-cil-dev libwebkit-dev libwebkit-cil-dev libsoup-gnome2.4-dev

  2. Next, you’ll need GStreamer and a few of its base plugins package: libgstreamer0.10-dev and libgstreamer-plugins-base0.10-dev

    sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

  3. If you want to play music encoded in non-free formats like mp3, you’ll also need a few restricted GStreamer libraries like gstreamer-plugins-good, gstreamer-plugins-bad, gstreamer-plugins-bad-multiverse, gstreamer-plugins-ugly, and gstreamer-plugins-ugly-multiverse.

    sudo apt-get install gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-bad-multiverse gstreamer-plugins-ugly gstreamer-plugins-ugly-multiverse

  4. Since I don’t have an iPod or similar Apple device, I’ve configured my installation to disable Apple device support. If you have an iPod, you can lose the –disable-apple-device and –disable-ipod flags after the configure command, but you’ll also need to add a couple of extra libraries to your system. To compile and install Banshee, navigate to the folder where you unzipped the tarball, and type the following in your terminal:

    ./configure –disable-appledevice –disable-ipod
    sudo make
    sudo make install

Banshee should now be installed. From your terminal, type

banshee-1

as a sanity check. Once the application launches, select Help > About and ensure that the version number is 1.9.0. If so, you should be good to go.

I’ll try to post a full review of this latest version of Banshee within a couple of days. In the mean time, happy listening!




On my Laptop, I am running Linux Mint 12.
On my home media server, I am running Ubuntu 12.04
Check out my profile for more information.

Create a GTK+ application on Linux with Objective-C

December 8th, 2010 8 comments

As sort of follow-up-in-spirit to my older post I decided to share a really straight forward way to use Objective-C to build GTK+ applications.

Objective-what?

Objective-C is an improvement to the iconic C programming language that remains backwards compatible while adding many new and interesting features. Chief among these additions is syntax for real objects (and thus object-oriented programming). Popularized by NeXT and eventually Apple, Objective-C is most commonly seen in development for Apple OSX and iOS based platforms. It ships with or without a large standard library (sometimes referred to as the Foundation Kit library) that makes it very easy for developers to quickly create fast and efficient programs. The result is a language that compiles down to binary, requires no virtual machines (just a runtime library), and achieves performance comparable to C and C++.

Marrying Objective-C with GTK+

Normally when writing a GTK+ application the language (or a library) will supply you with bindings that let you create GUIs in a way native to that language. So for instance in C++ you would create GTK+ objects, whereas in C you would create structures or ask functions for pointers back to the objects. Unfortunately while there used to exist a couple of different Objective-C bindings for GTK+, all of them are quite out of date. So instead we are going to rely on the fact that Objective-C is backwards compatible with C to get our program to work.

What you need to start

I’m going to assume that Ubuntu will be our operating system for development. To ensure that we have what we need to compile the programs, just install the following packages:

  1. gnustep-core-devel
  2. libgtk2.0-dev

As you can see from the list above we will be using GNUstep as our Objective-C library of choice.

Setting it all up

In order to make this work we will be creating two Objective-C classes, one that will house our GTK+ window and another that will actually start our program. I’m going to call my GTK+ object MainWindow and create the two necessary files: MainWindow.h and MainWindow.m. Finally I will create a main.m that will start the program and clean it up after it is done.

Let me apologize here for the poor code formatting; apparently WordPress likes to destroy whatever I try and do to make it better. If you want properly indented code please see the download link below.

MainWindow.h

In the MainWindow.h file put the following code:

#import <gtk/gtk.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>

//A pointer to this object (set on init) so C functions can call
//Objective-C functions
id myMainWindow;

/*
* This class is responsible for initializing the GTK render loop
* as well as setting up the GUI for the user. It also handles all GTK
* callbacks for the winMain GtkWindow.
*/
@interface MainWindow : NSObject
{
//The main GtkWindow
GtkWidget *winMain;
GtkWidget *button;
}

/*
* Constructs the object and initializes GTK and the GUI for the
* application.
*
* *********************************************************************
* Input
* *********************************************************************
* argc (int *): A pointer to the arg count variable that was passed
* in at the application start. It will be returned
* with the count of the modified argv array.
* argv (char *[]): A pointer to the argument array that was passed in
* at the application start. It will be returned with
* the GTK arguments removed.
*
* *********************************************************************
* Returns
* *********************************************************************
* MainWindow (id): The constructed object or nil
* arc (int *): The modified input int as described above
* argv (char *[]): The modified input array modified as described above
*/
-(id)initWithArgCount:(int *)argc andArgVals:(char *[])argv;

/*
* Frees the Gtk widgets that we have control over
*/
-(void)destroyWidget;

/*
* Starts and hands off execution to the GTK main loop
*/
-(void)startGtkMainLoop;

/*
* Example Objective-C function that prints some output
*/
-(void)printSomething;

/*
********************************************************
* C callback functions
********************************************************
*/

/*
* Called when the user closes the window
*/
void on_MainWindow_destroy(GtkObject *object, gpointer user_data);

/*
* Called when the user presses the button
*/
void on_btnPushMe_clicked(GtkObject *object, gpointer user_data);

@end

MainWindow.m

For the class’ actual code file fill it in as show below. This class will create a GTK+ window with a single button and will react to both the user pressing the button, and closing the window.

#import “MainWindow.h”

/*
* For documentation see MainWindow.h
*/

@implementation MainWindow

-(id)initWithArgCount:(int *)argc andArgVals:(char *[])argv
{
//call parent class’ init
if (self = [super init]) {

//setup the window
winMain = gtk_window_new (GTK_WINDOW_TOPLEVEL);

gtk_window_set_title (GTK_WINDOW (winMain), “Hello World”);
gtk_window_set_default_size(GTK_WINDOW(winMain), 230, 150);

//setup the button
button = gtk_button_new_with_label (“Push me!”);

gtk_container_add (GTK_CONTAINER (winMain), button);

//connect the signals
g_signal_connect (winMain, “destroy”, G_CALLBACK (on_MainWindow_destroy), NULL);
g_signal_connect (button, “clicked”, G_CALLBACK (on_btnPushMe_clicked), NULL);

//force show all
gtk_widget_show_all(winMain);
}

//assign C-compatible pointer
myMainWindow = self;

//return pointer to this object
return self;
}

-(void)startGtkMainLoop
{
//start gtk loop
gtk_main();
}

-(void)printSomething{
NSLog(@”Printed from Objective-C’s NSLog function.”);
printf(“Also printed from standard printf function.\n”);
}

-(void)destroyWidget{

myMainWindow = NULL;

if(GTK_IS_WIDGET (button))
{
//clean up the button
gtk_widget_destroy(button);
}

if(GTK_IS_WIDGET (winMain))
{
//clean up the main window
gtk_widget_destroy(winMain);
}
}

-(void)dealloc{
[self destroyWidget];

[super dealloc];
}

void on_MainWindow_destroy(GtkObject *object, gpointer user_data)
{
//exit the main loop
gtk_main_quit();
}

void on_btnPushMe_clicked(GtkObject *object, gpointer user_data)
{
printf(“Button was clicked\n”);

//call Objective-C function from C function using global object pointer
[myMainWindow printSomething];
}

@end

main.m

To finish I will write a main file and function that creates the MainWindow object and eventually cleans it up. Objective-C (1.0) does not support automatic garbage collection so it is important that we don’t forget to clean up after ourselves.

#import “MainWindow.h”
#import <Foundation/NSAutoreleasePool.h>

int main(int argc, char *argv[]) {

//create an AutoreleasePool
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

//init gtk engine
gtk_init(&argc, &argv);

//set up GUI
MainWindow *mainWindow = [[MainWindow alloc] initWithArgCount:&argc andArgVals:argv];

//begin the GTK loop
[mainWindow startGtkMainLoop];

//free the GUI
[mainWindow release];

//drain the pool
[pool release];

//exit application
return 0;
}

Compiling it all together

Use the following command to compile the program. This will automatically include all .m files in the current directory so be careful when and where you run this.

gcc `pkg-config –cflags –libs gtk+-2.0` -lgnustep-base -fconstant-string-class=NSConstantString -o “./myprogram” $(find . -name ‘*.m’) -I /usr/include/GNUstep/ -L /usr/lib/GNUstep/ -std=c99 -O3

Once complete you will notice a new executable in the directory called myprogram. Start this program and you will see our GTK+ window in action.

If you run it from the command line you can see the output that we coded when the button is pushed.

Wrapping it up

There you have it. We now have a program that is written in Objective-C, using C’s native GTK+ ‘bindings’ for the GUI, that can call both regular C and Objective-C functions and code. In addition, thanks to the porting of both GTK+ and GNUstep to Windows, this same code will also produce a cross-platform application that works on both Mac OSX and Windows.

Source Code Downloads

Source Only Package
File name: objective_c_gtk_source.zip
File hashes: Download Here
File size: 2.4KB
File download: Download Here

Originally posted on my personal website here.




I am currently running a variety of distributions, primarily Linux Mint 17.
Previously I was running KDE 4.3.3 on top of Fedora 11 (for the first experiment) and KDE 4.6.5 on top of Gentoo (for the second experiment).
Check out my profile for more information.

Django Development on Ubuntu 10.04

December 8th, 2010 2 comments

When I’m not rocking out my ninja-like linux skillz here at The Linux Experiment, I like to spend my spare time working on SlightlySauced, a weekly round table podcast. When we started the show, we chose to host it on a simple Tumblr blog, because it offered a fast setup experience and didn’t require much additional configuration to work well enough for our purposes. In light of this week’s Tumblr outages, we’ve decided to move the show off of the cloud and onto the same hosting provider that this site resides on.

Since I find myself with a little bit of spare time recently, I’ve also decided to write a custom site for the show using Django, my new favourite web framework. If you’re interested in trying your hand at Django development (and honestly, if you’re doing web development of any kind, why haven’t you tried it yet?), you can follow along with my progress here.

Step 1: Installing MySql

Because Django is a Python-based web framework, it includes SQLite out of the box. My web host of choice provides solid MySQL support, so I’ve decided to swap out SQLite for MySql. This requires that I install a local MySQL server for development purposes. Ubuntu has posted some handy documentation that I followed loosely. I’ll repeat the relevant steps here for posterity and ease of use.

From your terminal, type:

sudo apt-get install mysql-server

During the installation process, you’ll be prompted to enter a password for MySql’s root user account. If your server is going to be public-facing, it’s a good idea to enter a strong password. If it’s just for development purposes, you can probably use something weaker and easier to type.

Once the installation has finished, check that your server is running by typing:

sudo netstat -tap | grep mysql

This command should output something like the following:

tcp     0     0     localhost:mysql     *:*     LISTEN 2556/mysqld

Note: This command didn’t actually work for me. I had to remove the pipe and type just

sudo netstat -tap

and then search the resulting list for the MySql entry. I found it easily enough, and was convinced that the daemon was running and waiting for clients.

Step 2: MySQL Workbench (Optional)

Once your MySql daemon is up and running, you could edit the /etc/mysql/my.cnf file to alter its configuration. Instead, I opted to use MySQL Workbench, a decent graphical management tool that is distributed by Oracle (the same folks who make MySql). I’ve used it extensively at work, so I’m familiar with it and comfortable with its quirks. If you care to use it, you’ll have to grab it from Oracle’s website, as it’s not in the Ubuntu repositories. Luckily, Oracle provides a Ubuntu 10.04 64-bit *.deb that can be easily installed with GDebi. For those who care about such things, MySQL Workbench is a fully OSS GPL-licensed product, so there’s no funny stuff going on with regards to licensing.

With MySQL Workbench up and running, you’ll be presented with a screen like this one:

Click on New Connection under the SQL Development column in the bottom left of the screen, and enter the connection details of your local MySql server. It should be available via the loopback IP 127.0.0.1 on port 3306. The default username is root, and the password is whatever you set during the installation process. Once you get access, you can create a new schema and fire a few commands at it to test your setup.

Head back over to the Home tab and click on New Server Instance under the Server Administration column at the bottom right of the screen. In the dialog that pops up, select Take Parameters from Existing Database Connection and hit Next a bunch of times. The resulting window is a full MySQL daemon monitoring window that details traffic, the number of connections to the server, etc. More importantly, it allows you to set up user accounts and change configuration variables from a handy graphical front end instead of wading through MySQL’s extensive configuration files.

I headed over to the Accounts tab and created a user account for Django. At this stage of development, you’ll want to give this account full root access to the database, as Django will automatically create and drop schemas and tables as you code your website. Once development is done, you can pare these down to only those that are necessary.

Step 3: Installing Django

Holy crap, that was a lot of work, and we haven’t even gotten our framework of choice installed yet! Let’s get on with that. The project has some excellent documentation on this issue. I’ll repeat the basic steps here for your convenience, but strongly suggest that you read through the full instruction set if you encounter any issues or want to perform a customized installation.

Since Django is a python-based framework, you’ll need to make sure that you have a compatible version of Python installed on your system. At the time of writing, Ubuntu 10.04 ships with Python version 2.6.5. Django only works with Python versions 2.4 through 2.7. If you’re not running Ubuntu 10.04, you can check which version you have installed by typing

python –version

in your terminal. Once you’ve ensured that you have a compatible Python version installed, type

sudo apt-get install python-django

in your terminal to install version 1.1.1 of the framework from your repositories. Once the installation has finished, you should check the installed version. Since Django lives inside of python, you’ll need to start a python terminal by typing

python

in your terminal. Once started, type

import django
print django.get_version()

If you don’t see any horrendous-looking error messages, you’re good to go. As a side note, if you type

apt-cache search django

you’ll see that the Ubuntu repositories include quite a few handy Django plugins and applications that you might want to use in your projects, including a URL shortener, a user-registration module, and a contact form. Each of these can be installed on your system and included in any Django project quite easily. I’ll probably end up using one or more in my project to save me some time.

Finally, you’ll need to install an extra database connector for python in order to use MySql from within Django. In Ubuntu 10.04, this package is called python-mysqldb.

Step 4: Write Some Code!

So you’re up and running. If you’re not familiar with Django, I suggest that you run through their online tutorial. It’s well-written and provides a great introduction to some of the stuff that the framework can do.

Whatever you do, have fun! In my experience, Django makes web development a pleasure because it takes care of a lot of the nitty-gritty crap for you and lets you get on with solving harder problems.

Let me know what you think in the comments.

Edit: Added an extra database connector package that’s necessary if you want to use MySql with Django.




On my Laptop, I am running Linux Mint 12.
On my home media server, I am running Ubuntu 12.04
Check out my profile for more information.

Setting up an Ubuntu-based ASP.NET Server with Mono

November 21st, 2010 5 comments

Introduction:

In my day job, I work as an infrastructure developer for a small company. While I wouldn’t call us a Microsoft shop by any stretch (we actually make web design tools), we do maintain a large code base in C#, which includes our website and a number of web-based administrative tools. In planning for a future project, I recently spent some time figuring out how to host our existing ASP.NET-based web site on a Linux server. After a great deal of research, and just a bit of trial and error, I came up with the following steps:

VirtualBox Setup:

The server is going to run in a virtual machine, primarily because I don’t have any available hardware to throw at the problem right now. This has the added benefit of being easily expandable, and our web hosting company will actually accept *.vdi files, which allows us to easily pick up the finished machine and put it live with no added hassle. In our case, the host machine was a Windows Server 2008 machine, but these steps would work just as well on a Linux host.

I started off with VirtualBox 3.2.10 r66523, although like I said, grabbing the OSE edition from your repositories will work just as well. The host machine that we’re using is a bit underpowered, so I only gave the virtual machine 512MB of RAM and 10GB of dynamically expanding storage. One important thing – because I’ll want this server to live on our LAN and interact with our other machines, I was careful to change the network card settings to Bridged Adapter and to make sure that the Ethernet adapter of the host machine is selected in the hardware drop down. This is important because we want the virtual machine to ask our office router for an IP address instead of using the host machine as a private subnet.

Installing the Operating System:

For the initial install, I went with the Ubuntu 10.10 Maverick Meerkat 32-bit Desktop Edition. Any server admins reading this will probably pull out their hair over the fact, but in our office, we have administrators who are very used to using Windows’ Remote Desktop utility to log into remote machines, and I don’t feel like training everybody on the intricacies of PuTTy and SSH. If you want to, you can install the Server version instead, and forgo all of the additional overhead of a windowing system on your server. Since all of my installation was done from the terminal, these instructions will work just as well with or without a GUI.

From VirtualBox, you’ll want to mount the Ubuntu ISO in the IDE CD-ROM drive, and start the machine. When prompted, click your way through Ubuntu’s slick new installer, and tell it to erase and use entire disk, since we don’t need any fancy partitioning for this setup. When I went through these steps, I opted to encrypt the home folder of the vm, mostly out of habit, but that’s up to you. Once you make it to a desktop, install VirtualBox Guest Additions.

From Terminal, type sudo apt-get upgrade to apply any patches that might be available.

Setting up a Static IP Address:

From a terminal, type ifconfig and find the HWaddr entry for your ethernet card, usually eth0. It will probably look something like 08:00:27:1c:17:6c. Next, you’ll need to log in to your router and set it up so that any device with this hardware address (also called a MAC address) is always given the same IP address. In my case, I chose to assign the virtual server an IP address of 192.168.1.10 because it was easy to remember. There are other ways that you can go about setting up a static IP, but I find this to be the easiest.

Getting Remote Desktop support up and running:

As I mentioned above, the guys in our office are used to administering remote machines by logging in via Windows’ remote desktop client. In order to provide this functionality, I chose to set up the xrdp project on my little server. Installing this is as easy as typing sudo apt-get install xrdp in your terminal. The installation process will also require the vnc4server and xbase-clients packages.

When the installation has completed, the xrdp service will run on startup and will provide an encrypted remote desktop server that runs on port 3389. From Windows, you can now connect to 192.168.1.10 with the standard rdp client. When prompted for login, make sure that sesman-Xvnc is selected as the protocol, and you should be able to log in with the username and password combination that you chose above.

Installing a Graphical Firewall Utility:

Ubuntu ships with a firewall baked into the kernel that can be accessed from the terminal with the ufw tool. Because some of our administrators are afraid of the command line, I also chose to install a graphical firewall manager. In the terminal, type sudo apt-get install gufw to install an easy to use gui for the firewall. Once complete, it will show up in the standard Gnome menu system under System > Administration > Firewall Configuration.
Let’s do a bit of setup. Open up the Firewall Configuration utility, and check off the box to enable the firewall. Below that box, make sure that all incoming traffic is automatically denied while all outgoing is allowed. These rules can be tightened up later, but are a good starting point for now. To allow incoming remote desktop connections, you’ll need to create a new rule to allow all TCP connections on port 3389. If this server is to be used on the live Internet, you may also consider limiting the IP addresses that these connections can come from so that not just anybody can log in to your server. Remember, defense in depth is your best friend.

Adding SSH Support:

Unlike my coworkers, I prefer to manage my server machines via command line. As such, an SSH server is necessary. Later, the SSH connection can be used for SFTP or a secure tunnel over which we can communicate with our source control and database servers. In terminal, type sudo apt-get install openssh-server to start the OpenSSH installation process. Once it’s done, you’ll want to back up its default configuration file with the command cp /etc/ssh/sshd_config /etc/ssh/sshd_config_old. Next, open up the config file your text editor of choice (mine is nano) and change a couple of the default options:

  • Change the Port to 5000, or some other easy to remember port. Running an SSH server on port 22 can lead to high discoverability, and is regarded by some as a security no-no.
  • Change PermitRootLogin to no. This will ensure that only normal user accounts can log in.
  • At the end of the file, add the line AllowUsers <your-username> to limit the user accounts that can log in to the machine. It is good practice to create a user account with limited privileges and only allow it to log in via SSH. This way, if an attacker does get in, they are limited in the amount of damage that they can do.

Back in your terminal, type sudo /etc/init.d/ssh restart to load the new settings. Using the instructions above, open up your firewall utility and create a new rule to allow all TCP connections on port 5000. Once again, if this server is to be used on the live Internet, it’s a good idea to limit the IP addresses that this traffic can originate from.

With this done, you can log in to the server from any other Linux-based machine using the ssh command in your terminal. From Windows, you’ll need a third-party utility like PuTTy.

Installing Apache and ModMono:

For simplicity’s sake, we’ll install both Apache (the web server) and mod_mono (a module responsible for processing ASP.NET requests) from Ubuntu’s repositories. The downside is that the code base is a bit older, but the upside is that everything should just work, and the code is stable. These instructions are a modified version of the ones found on the HBY Consultancy blog. Credit where credit is due, after all. From your terminal, enter the following:

$ sudo apt-get install monodevelop mono-devel monodevelop-database mono-debugger mono-xsp2 libapache2-mod-mono mono-apache-server2 apache2

$ sudo a2dismod mod_mono

$ sudo a2enmod mod_mono_auto

With this done, Apache and mod_mono are installed. WE’ll need to do a bit of configuration before they’re ready to go. Open up mod_mono’s configuration file in your text editor of choice with something like sudo nano /etc/apache2/mods-available/mod_mono_auto.conf. Scroll down to the bottom and append the following text to the file:

MonoPath default “/usr/lib/mono/3.5″

MonoServerPath default /usr/bin/mod-mono-server2

AddMonoApplications default “/:/var/www”

Finally, restart the Apache web server so that the changes take effect with the command sudo /etc/init.d/apache2 restart. This configuration will allow us to run aspx files out of our /var/www/ directory, just like html or php files that you may have seen hosted in the past.

Having a Beer:

That was a fair bit of work, but I think that it was worth it. If everything went well, you’ve now got a fully functional Apache web server that’s reasonably secure, and can run any ASP.NET code that you throw at it.

The one hiccup that I encountered with this setup was that Mono doesn’t yet have support for .NET’s Entity Framework, which is the object-relational mapping framework that we use as a part of our database stack on the application that we wanted to host. This means that if I want to host the existing code on Linux, I’ll have to modify it so that it uses a different database back end. Its kind of a pain, but not the end of the world, and certainly a situation that can be avoided if you’re coding up a website from scratch. You can read more about the status of Mono’s ASP.NET implementation on their website.

Hopefully this helped somebody. Let me know in the comments if there’s anything that isn’t quite clear or if you encounter any snags with the process.




On my Laptop, I am running Linux Mint 12.
On my home media server, I am running Ubuntu 12.04
Check out my profile for more information.

VOIP with Linode, Ubuntu, Asterisk and FreePBX

October 29th, 2010 1 comment

Overview and Introduction

I’ve been dabbling with managing a VOIP server for the past year or so, using CentOS, Asterisk and FreePBX on a co-located server. Recently Dave and I needed to move to our own machine, and decided to use TEH CLOUD to reduce management and get a fresh start. There are hundreds of hosts out there offering virtual private servers (VPS’s). We’ve standardized on Linode for our small business for a few reasons. While I don’t want to sound like a complete advertisement, I’ve been incredibly impressed with them:

  • Performance. The host systems at Linode run at least 4-way 2GHz Xeon dual-core CPUs (I’ve seen higher as well) and you’re guaranteed the RAM you pay for. Pricing is generally based on how much memory you need.
  • Pricing. For a 512MB Linode, you pay $19.95 US per month. Slicehost (a part of Rackspace, and a Linode competitor) charges the same amount for a 256MB slice. Generally you want at least 512MB RAM for a Linux machine that’s not a test/development box.
  • Features. If you have multiple VMs in the same datacenter, you can assign them private IPs and internal traffic doesn’t count toward your bandwidth allowance. Likewise, bandwidth is pooled among all your VMs; so buying two VMs with 200GB bandwidth each gives 400GB for all your systems.

With full root access and the Linux distribution of your choice, it’s very easy to set up and tear down VMs.

Why VOIP?
When people hear VOIP, they generally assume either a flaky enterprise system with echoing calls or something like Skype. Properly configured, a VOIP system offers a number of really interesting features:

  • Low-cost long distance and international calling. The provider we use, voip.ms, offers outgoing calls for $0.0052 per minute to Canada and $0.0105/minute to the US on their value route.
  • Cheap phone numbers – direct inward dialing – are available for $0.99 per month in your region. These phone numbers are virtual and can be configured to do nearly anything you want. Incoming calls are $0.01/minute, and calls between voip.ms numbers are free.
  • Want to take advantage of cheap long distance from your cell phone? Set up a Direct Inward System Access path, which gives you a dial tone for making outgoing calls when you call a local number. Put your DID number on your My5 list, and you’re set to reduce bill overages.
  • Voicemail becomes much more useful when the VOIP server sends you an email with a WAV attachment and caller ID information.
  • Want to set up an interactive voice response menu, time conditions, blacklist telemarketers, manage group conferences or have witty hold music? All available with FreePBX and Asterisk.

Continue reading for server setup details and security best practices…

Read more…




I am currently running Ubuntu 14.04 LTS for a home server, with a mix of Windows, OS X and Linux clients for both work and personal use.
I prefer Ubuntu LTS releases without Unity - XFCE is much more my style of desktop interface.
Check out my profile for more information.
Categories: Asterisk, FreePBX, Jake B, Ubuntu Tags:

One week, three distributions (Day 7: Conclusions)

October 24th, 2010 No comments

Well it’s been an interesting week. I’ve gotten to try out three new distributions and share my thoughts with everyone here. My original goal was to see which one of these distributions offered the best first impression and declare that one as the ‘winner’. However in actually working my way through these great releases I have changed my mind somewhat.

What makes a great distribution great?

This is a very interesting question that I’m sure would generate a wide array of unique and passionate responses. Some prefer ease of use, while others demand nothing less than complete control over what they can tweak. There are people who swear by using nothing but open source solutions, while others are happy to add proprietary code into the mix as well. This is the great thing about Linux, we get so many choices which means we get to decided what we want.

Unfortunately this has also resulted in a bit of distribution zealotry; like choosing Ubuntu over Fedora, or Arch over OpenSUSE is somehow taking a side in some giant war. Instead of all of the infighting we should be celebrating the fact that when Ubuntu comes out with a new piece of user-friendly software, or Fedora introduces a new awesome technology, we can share and integrate it right into all distributions.

So what makes a great distribution great? A distribution is great because it works for you, it suites your needs, fits your personality and lets you do what you want to do. At the end of the day isn’t that what open source is about?

Final thoughts

OK enough of the preachy writing. I think that all of the distributions I have tested this week were very good. They each embody the spirit of open source in their own little ways.

Kubuntu 10.10

Awards: The most improved release. Most likely to recover lost KDE fans.

I was extremely impressed with this release. The folks over at the Kubuntu project deserve a huge round of applause for their continued work on this often forgotten Ubuntu sibling. This release is unlike any other that I’ve tried from Kubuntu, and I hope it marks a turning point in the distribution’s history. If the next release sees anywhere close to the improvement that this release did it may even unseat Ubuntu as the go to Linux release. If you haven’t tried out this release I urge you to give it a shot.

Ubuntu 10.0

Awards: The most refined. Most likely to be installed on a new Linux user’s computer.

Ubuntu makes a return from its last long-term support (LTS) release with this stellar offering. For a release that is meant to experiment with changes, which might eventually be incorporated into a future LTS release, this version feels as polished as ever. The new theme, font, store and integration features make this an absolutely solid release. If you’re an Ubuntu user I’m sure you have already upgraded. If you develop for a different distribution, this might still be worth looking into if only to steal the good parts for your release of choice. Either way I think this release of Ubuntu marks a whole new level of application integration on the Linux desktop and I am excited to see where they go next with it.

Linux Mint Debian Edition

Awards: The most advanced. Most likely to see the fastest improvement.

For people who have been using Debian for a while now this release will feel right at home. It combines the best parts of Debian testing, modern software, stability and thousands of packages, with the Linux Mint team’s renown ability to iron out the kinks in any Linux distribution. I think that this release will see so much improvement in the next couple of months that it has the potential to steal users away from other rolling release distributions with its easy to use desktop. While this current iteration does have some issues I hardly think that they are anything to run away from. For technical users looking for the newest stuff, while hoping avoiding the vast majority of headaches other distributions can cause, this one is for you.

My Choice

For me personally I have been very happy with Linux Mint 9 and look forward to version 10 when it ships later this year. Until then however I think I will be sticking with the one that most closely resembles my current set up. No not Linux Mint Debian Edition, but Ubuntu 10.10. That being said I do look forward to giving Fedora 14 and Linux Mint 10 a ride soon.




I am currently running a variety of distributions, primarily Linux Mint 17.
Previously I was running KDE 4.3.3 on top of Fedora 11 (for the first experiment) and KDE 4.6.5 on top of Gentoo (for the second experiment).
Check out my profile for more information.

One week, three distributions (Day 4: Ubuntu 10.10)

October 20th, 2010 3 comments

Continuing where we left off I am now ready to report my first impressions of Ubuntu 10.10. I should start by apologizing a little bit, this post is going up one day late (even though I had already finished writing most of it). With that out of the way let’s begin.

Install

The install, as one would expect, is exactly the same as the one featured in Kubuntu. As noted before I have nothing but praise for this installer and still think it is one of the best, if not the best, installer on any Linux distribution.

‘New’ Theme

The new theme found in this release of Ubuntu is beautiful. It’s hard to place exactly what makes this theme so nice but Canonical has done a wonderful job iterating the old theme from 10.04 and making some subtle changes that have an incredible overall effect.

This level of polish even extends to the new sound menu. Canonical has implemented new sound APIs which allow media players to integrated natively with the sound menu in a way that is just awesome.

Image Shamelessly Stolen Last Minute from Another Website

Heck even the calculator looks better with the new theme!

Software

As with my previous post, I decided to take a look through the default installed software and see how it presents Ubuntu as an all-in-one desktop experience.

Empathy (2.32.0)

The instant messaging client of champions… or at least those who thought Pidgin was too complicated. My understanding for why this client replaced Pidgin was that it was set to offer features (like audio and video calling) that Pidgin was simply too slow at incorporating. Up until this release that reasoning has been nothing more than a pipe dream in my experience. Yes some people have had better luck than others but I have never had it really work all that well. This time however I did get it to work and, after installing the Ubuntu Restricted Extras package, also got it to successfully negotiate a full video call with the proper Windows Live Messenger client.

Evolution (2.30.3)

First off I have to just say “wow”. The first time I used Evolution was back on Ubuntu 8.04 and I absolutely hated it. Now however I’m starting to sing a different tune. Evolution not only looks better but also performs better as well. It includes many features, like calendar and PGP integration, that my favourite e-mail client Thunderbird requires add ons to accomplish.

Furthermore it integrates completely into the Ubuntu message centre which is a nice touch. I can’t even get Thunderbird to minimize to the system tray on Linux. All told I must say that I’m very impressed with with this version of Evolution.

Gwibber (2.32.0.1)

Gwibber is Ubuntu’s answer to all of your social media sources. It has the ability to combine all of your feeds, from Twitter to Facebook, in one convenient location. From there you can easily catch up on what your friends are doing and interact with them, all from one easy to use centralized location.

Unfortunately this universal nature is exactly where the Gwibber experience starts to fail. Because it works with everything it often fails to excel at anything in particular. Because of that I just don’t see myself using this application all that often. It is nice that it integrates into the Ubuntu message centre though.

Firefox (3.6.10)

Ubuntu’s default web browser is Firefox which, let’s be honest, I’m sure you know all about. I will say one thing about this browser though; I hope Firefox 4 improves the speed significantly or I think it will continue to lose users to Chrome.

Transmission (2.04)

For downloading torrents Ubuntu 10.10 continues to ship with the Transmission BitTorrent client. It is a more or less unremarkable client that places a large emphasis on simplicity. It is also the only BitTorrent client I know that warns you not to pirate things.

It also might just be me but for some reason this version of Transmission seems to have more features than I remember.

Rhythmbox (0.13.1)

This version of Rhythmbox contains the Ubuntu One music store which I decided to poke around in for a bit. It seems to be a full capable store with many popular artists.

Unfortunately I did manage to make it crash in a rather hilarious way…

Yes that’s right, the Ubuntu One music store is being run off of a Microsoft IIS web server.

Rythmbox the program also suffers from some annoying issues which were well covered by Jon on one of his previous post. One that particularly annoys me is the encoding options. As long as you stick to the defaults the application is very easy to use, but the second you want to adjust the settings you get stuck trying to decipher GStreamer command line options.

Totem Movie Player (2.32.0)

For video playback we get stuck with Totem. Its not that I think it’s the worst video player in the world, it’s just that it doesn’t do anything particularly well. Back when I was using Kubuntu’s Dragon Player I felt the same way but at least Dragon Player was able to provide video playback devoid of various vsync issues. To be fair though this might be an issue with Compiz vs KWin and not directly related to the video software.

PiTiVi (0.14.5)

PiTiVi, besides having a horrible name, is actually a very good piece of software. It is essentially a Windows Movie Maker clone and makes no excuses for it, which in this case is probably a good thing. Within just a couple of minutes of never using the program before I was able to import the two free clips that come with Ubuntu, one movie and one song, strip the audio from the movie clip and replace it with the song’s audio. One button click later my movie was rendered in glorious 1080p. That’s a lot of p’s!

For those wanting a bit more power, the software also seems capable of rendering to any (logical) combination of containers and codecs you might have installed on your system.

Ubuntu Software Centre (3.0.4)

And finally the big one. This release brings with it the first paid application to the new app store. This has already  been written about quite a lot, and while I think its a good thing, I do have some issues with it. The biggest issue that I have is that with only one application in the store people will probably never check it out again, even if new applications are added later. In my opinion what they should have done was created a beta program that people could opt into and test the store out. That would have given Canonical the feedback they need while still not spoiling the store for potential future users.

Conclusion

This release of Ubuntu is a solid one and deserves much praise. While I could give or take on some of the default included software, but then again who couldn’t, I do think that this release has an overall polish that simply hasn’t been as strong in previous releases. This is what Ubuntu 10.04 should have been from the start and makes me look forward to what is still yet to come.

Pros:

  • An unparalleled polish and sheen that no other distribution has
  • An updated software roster that is showcases some of the best Linux application-desktop integration I have ever seen

Cons:

  • While the polish is nice there really isn’t that much difference from 10.04
  • The Ubuntu Software Centre store release may have been a bit premature



I am currently running a variety of distributions, primarily Linux Mint 17.
Previously I was running KDE 4.3.3 on top of Fedora 11 (for the first experiment) and KDE 4.6.5 on top of Gentoo (for the second experiment).
Check out my profile for more information.
Categories: GNOME, Tyler B, Ubuntu Tags: ,

One week, three distributions (Day 0)

October 15th, 2010 No comments

With the recent releases of Linux Mint Debian Edition, Ubuntu and Kubuntu 10.10 I am once again starting to feel that need to hop around and try something new out. That’s not to say that my current distribution of choice (Linux Mint 9) is a bad one, quite the opposite in fact. I am however curious to see what these new releases do, well, new. That being said I’ve set myself up a little experiment of sorts: try each distribution for two days each and on the 7th day choose the best from among the three. Now obviously this isn’t a very fair test, 48 hours is hardly enough to definitely test which of these distributions is truly the best. What it will, hopefully, show though is which distribution gives off the best first impression.

So buckle up and stay tuned, this week should hopefully be an interesting one.




I am currently running a variety of distributions, primarily Linux Mint 17.
Previously I was running KDE 4.3.3 on top of Fedora 11 (for the first experiment) and KDE 4.6.5 on top of Gentoo (for the second experiment).
Check out my profile for more information.