Today I finally replaced my out-of-date streaming music server with something a little more recent.  I had long been using gnump3d, and even wrote up a tutorial on it some time ago.  Development on the project has pretty much died off completely and even though it has worked great for nearly three years I felt it was time for a change.

I replaced the gnump3d service with Ampache, a PHP/MySQL based audio file manager and streaming server.  It looks like it has a lot more features than gnump3d had, but then again its also getting a lot more attention.  So, without further ado here is how I setup Ampache to allow me access to my .ogg collection via the web.

Installing Ampache via PPA

First I’ll outline how to install Ampache via the Launchpad PPA.  This will make the process much simpler, if you’re the type that is willing to use a PPA.  If not, read below for the manual installation method.

To install Ampache via the Launchpad PPA you can run the following command that matches your release, which will auto-add the PPA to your sources list.

Ubuntu 7.10 “Gutsy”

sudo wget http://zelut.org/projects/sources.list.d/ampache-gutsy.list -O /etc/apt/sources.list.d/ampache-gutsy.list

Ubuntu 8.04 “Hardy”

sudo wget http://zelut.org/projects/sources.list.d/ampache-hardy.list -O /etc/apt/sources.list.d/ampache-hardy.list

Next you can install the package and a few of its dependencies using the command:

sudo aptitude install ampache mysql-server-5.0 phpmyadmin

Once these packages are installed you should be able to access the Ampache server via http://your-webserver.com/ampache

The first time you connect it will walk you through an installer.  I think the installer could be a tad simpler, but basically you’ll need to know your mysql-server username and password (the password you set when the mysql-server-5.0 package installed).  There is a graphical walkthrough of the installer along with a few more tips here.

Install Ampache Manually

The manual installation method will take a few more steps, but its not anything you can’t handle I’m sure.  The first thing we’ll need to do is make sure Ampache has the dependent services installed, so we’ll install our webserver (in this case Apache2) and our MySQL server.

sudo aptitude install apache2-mpm-prefork mysql-server-5.0 php5 php5-gd

Next we’ll download and unpack the latest release into /var/www/.

cd /var/www/
wget -c http://ampache.org/downloads/stable.tar.gz
sudo tar xf stable.tar.gz
sudo mv ampache-* ampache

You should be able to access the Ampache server and initial installer via http://your-webserver.com/ampache

Check out the Ampache website and Wiki for more details on features and support.

I post tutorials very regularly on this site. You may want to consider subscribing to the RSS feed. Or if you'd prefer these tips sent to your inbox you can use Email Subscriptions.

I do apologize again for some of the recent downtime on the blog. I’ve been researching tuning options all evening to try to bring the memory consumption lower. I did also add an additionl 256M RAM to the machine hoping that will help. Thanks for the patience during this bumpy ride.

I wanted to put down some of my notes concerning configuring Apache2 with virtual hosts for hosting multiple sites. This is something I have done quite a bit before but had a little trouble on this last setup. So in an attempt to better document my steps here is what I did.

Installing Apache 2

I’ll be discussing name based virtual hosting with Apache (Apache 2 to be specific). We’ll need to install that before we dive in:

sudo aptitude install apache2

Once these are setup you should be able to connect to localhost in your browser and see a test page.

NameVirtualHost

With the default configuration you are only serving up one site, and that site is based on your IP address. What I’m setting up is name-based virtual hosting, meaning the Apache server will serve specific content based on the domain name requested. In this way a single server can host multiple sites, and serve up unique content based on the domain requested.

My preferred method of using name based virtual hosting is creating a seperate file for each domain. These can all be done within one file, but I’ll be creating a new file for each site.

First we need to define to Apache that we’re using name based virtual hosting instead of IP based. You can append the following line to your /etc/apache2/apache2.conf to define this:

NameVirtualHost ip.address:port

The above should be your public facing IP address (assuming you’re creating a public site), and port is generally port 80 by default. After this we’ll create the base configuration for your virtual hosts. Debian and Ubuntu use /etc/apache2/sites-available/ and /etc/apache2/sites-enabled/ directories for defining virtual hosting. One nice thing about this is that you can have more sites “available” than you have “enabled”, meaning not everything configured is actually live and listening. This is nice to quickly disable a site for whatever reason.

I like to create unique files for each of my domains within the /etc/apache2/sites-available/ folder. For example I have a file called “ubuntu-tutorials.com” in that directory, with the following contents:

<VirtualHost 67.207.131.28:80>
ServerName ubuntu-tutorials.com
ServerAlias www.ubuntu-tutorials.com
ServerAdmin christer.edwards@ubuntu.com
DocumentRoot /var/www/ubuntu-tutorials.com/html
</VirtualHost>

What these settings do is as follows:

  • ServerName listens for requests asking for a certain domain
  • ServerAlias defines any additional domains that should match
  • ServerAdmin is the contact for the site
  • DocumentRoot is the path to the content for that site

Now that this file is created in the /etc/apache2/sites-available/ folder we’re just about ready to start, but we need to enable it. We can do that by creating a symbolic link from one folder to the next.

cd /etc/apache2/sites-enabled/
ln -s ../sites-available/ubuntu-tutorials.com .

This site is now available (as in configured) and enabled (as in listening) once we restart the apache service:

sudo /etc/init.d/apache2 restart

Testing

To test your configuration you can, temporarily, configure your /etc/hosts file to point the domain to your IP address and see if your server loads up the correct site. This is only needed if the hostname or domain name does not already resolve to your IP address. Editing the /etc/hosts by adding the following line:

ip.address domain.tld

Open your browser, try to access domain.tld and see if it loads the contents from your local DocumentRoot (from the configuration above). You might want to drop a file in the DocumentRoot to verify its pulling your local content.

cd /var/www/ubuntu-tutorials.com/html
echo "Hello World" > index.html

Conclusion

I hope I didn’t miss anything here. One of the main purposes of this writeup is to document what I did to setup my server. I do it so rarely I don’t always remember all the steps when I need to. If this helps you setup name based virtual hosting, great. Leave a comment and let me know. If I forgot anything critical please also let me know so I can update the contents.

It was recently pointed out to me on one of our local mailing lists that my previous tutorial on installing Adobe’s Acrobat reader for Firefox no longer worked. It seems that those packages have been pulled from the repository since that writing. I wanted to take a few minutes and give an update on a different method of installing Adobe’s Acrobat reader.

Installing Adobe Acrobat

It appears now that the simplest way to install the Adobe Acrobat Reader is to get the package directly from Adobe’s website. Try following these steps to find the .deb package and install that.

  1. Visit the Adobe Reader download page.
  2. Select “Linux”, Select “Linux - x86 .deb”, Select your language.
  3. Click the “Continue” button.
  4. Click “Download Adobe Reader” to begin the download.
  5. You can then “Open with…” to open it with the package installer directly, or “Save as” to be distributed to your other machines and installed manually via double-click on the package.

If you’re going to call the reader directly you’ll also need to configure two more items within the Adobe Reader preferences.  Open the reader via “Applications > Office > Adobe Reader 8″ and it should give you a message concerning a libgtkembedmoz.so.  After you click OK it’ll give you a blank window with no options.  Switch back to the previous window and select “Edit > Preferences > Internet” as suggested by the previous notification window.

In the “Select Browser” area near the bottom put in the following two paths to pacify the Adobe Reader:

/usr/bin/firefox

/usr/lib/firefox

At this point you can save and close your changes and restart the application.  This time you shouln’t see any errors and it should work as planned.  I have noticed that no errors are reported when directly opening a .pdf from the web–everything just opens.  This seems to only happen when launching the reader directly.
Personally I prefer the installed .pdf reader, Evince that already comes with my installation. I haven’t personally had any need to run the non-free Adobe version, but apparently some do. I hope these steps work for you and thanks again for reminding me that my previous steps don’t work.

So I’ve decided that Konqueror is just not the web browser that some people want it to be. Call me spoiled / ruined for having spent so much time on Firefox, but I just can’t use it to be as productive as I want to be so I’ve installed Firefox on my Kubuntu installation. For those of you that are in similar situations keep reading and find out how to manually install Firefox within KDE.

Now, I am perfectly aware that I can download and install the Firefox package simply and easily using Adept or aptitude. I have one very key reason why I don’t want to do it this way. I don’t want the pile of gnome dependencies that come with it. If I’m going to run KDE I want to run a clean KDE, and adding GTK clutter is not on my agenda. So, manually installing Firefox is nearly as easy and makes for a much cleaner installation in my mind.

Installing Firefox Manually

Update: I found in some additional testing that using the following command *just* installed Firefox and none of the other packages so.. you take your pick: (I normally use aptitude to install which installed optional packages as well).

sudo apt-get install firefox

OR

  1. Download the latest version of Firefox from the Mozilla web page. Save this file to disk.
  2. sudo tar -C /opt/ -zxvf firefox-*.tar.gz
  3. sudo aptitude install libstdc++5
  4. sudo ln -s /opt/firefox/firefox /usr/local/bin/firefox
  5. sudo vim ~/.local/share/applications/firefox.desktop

Put the following content into the newly created file:

[Desktop Entry]
Comment=Firefox Web Browser
Exec=firefox
GenericName=Web Browser
Icon=/opt/firefox/icons/mozicon128.png
Name=Firefox
Path=
StartupNotify=true
Terminal=0
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=

Done. You should now be able to launch Firefox either from the command line (firefox) or from your KDE menu within the Internet section. When a new release of Firefox comes out you should simply be able to repeat steps #1 and #2 and you’re done. I will be running Firefox as my default browser on Kubuntu and using this method I don’t have to deal with the gnome dependencies cluttering things up!

This post is not so much a tutorial as my own notes on restricting access with .htaccess files and apache. As has been the case with many of my previous tutorials, the basis is writing the steps down so I can refer to them later. Turns out making notes public on a blog is a good idea. In any event, this will outline restricting access to directories on a user-level with .htaccess.

Create the .htaccess file

To limit access to a directory we need to create a .htaccess file where we will outline the restrictions for the location. Any folder within your publicly accessible web page can have its own custom .htaccess file. note: some shared hosting companies do not allow custom .htaccess restrictions for individual sites. You may need to check with your host on this.

Within your .htaccess file you would include something along these lines:

# sample .htaccess file
AuthName "Private Website"
AuthType basic
AuthUserFile /path/to/.htpasswd
require user username (optional)

In the above sample config “Private Website” can be any message you want displayed to the user when trying to authenticate to that page. /path/to/.htpasswd is what we will work on next in generating usernames and hashed passwords for authentication. require user username can limit access to only those users listed.

Create the .htpasswd file

In the .htaccess file we’ve outlined a path/to/.htpasswd file which we need to also create. It is a good idea to keep this file in a non web-accessible location. For example, if your web root is /var/www/html/ you might put the .htpasswd file in /var/www/.htpasswd. This way it is not accessible publicly and limits the chances of someone being able to get a hold of and attempt to break your hashed passwords for access.

To populate the .htpasswd file we’ll use the command htpasswd. To initially create the file we’d use:

htpasswd -cm /var/www/.htpasswd user-one

The -c will initially create the file. The -m will md5 encrypt the passwords for additional security. The htpasswd command will prompt you for a password.

To add additional users to your .htpasswd access list use:

htpasswd -m /var/www/.htpasswd user-two

Be careful not to use the -c option when adding additional users as this will recreate the file and overwrite previous entries.

Once these two files are in place access to the folder containing the .htaccess file will be limited to only those users listed within the .htpasswd file and require authentication via a password. This is great for sharing web accessible files with only certain users, creating private folders, etc.

If your host allows custom .htaccess file creation but does not provide you access to the htpasswd command you can try to generate your .htpasswd file using an apache installation on a local machine and copying the resulting files over.

This post is in response Aaron Toponce’s “Ultimate Firefox Extension List“.  I thought I would take a few minutes and make a list of the extensions I use and find that I’d prefer not to live without.  On the one hand I do think they make me more productive.  On the other hand I feel I’m less productive on any machine but my own because I have grown so accustomed to the extensions.  In any event, here is my list (it’s short):

Vimperator - if you love vi you’ll like the vimperator extension for Firefox.  vi keybindings for navigating the interweb.  From gt/gT for navigating tabs, to hjkl for navigating the pages themselves.  There is a long list of key bindings available in the :help.  Again, if you love vi you will enjoy this extension, but be warned.  It has a similar learning curve to the initial vi.

Greasemonkey - I use greasemonkey for a single script.  I use it with my Google Secure script that I posted previously.  I’m sure there may be some other scripts that are worthwhile but I haven’t spent a lot of time searching for them.

FireGPG - This allows you to sign / encrypt text or emails from within your browser.  I prefer to use the more mature Enigmail within Thunderbird, but if I’m shooting something quick out of the browser I still want to see my emails digitally signed.

Again, I have a really short list.  I like minimalist settings and features.  Between these three I can keep my hands on the keyboard during browsing, make sure that all Google Apps that I use are https restricted and sign or encrypt (or both) any of my emails.  Beyond that and you’re just getting greedy ;)
(I should note that the #1 cause of problems with the Firefox browser are 1) too many extensions or 2) conflicting extensions, which is often caused by the first.  If your browser crashes, is terribly slow, eats up all of your system memory, etc try to disable some extensions.  I almost guarantee you’ll find a difference in performance with some of the guilty parties removed.)

So this morning I started looking into greasemonkey based on recommendations of a few friends. I found a few useful scripts and I think I may actually keep it around. I did actually take one script that seemed pretty limited and improved upon it.

If you use greasemonkey you might want to check this out. (I don’t know if this already exists–it certainly may–but here it is anyhow).

Ever notice how Google supports https but doesn’t require it on more than the login page? This script will require any available Google App that supports https to actually use https. Currently this supports:

Gmail

Google Docs

Google Reader

Google Calendar

if you know of any other Google Apps that support https for the session let me know and I’ll improve this. Enjoy. I also have an idea of maintaining a growing list of other sites that support but do not require https.

Download : GoogleSecure - GreaseMonkey

You might remember a recent tutorial I did on securing VNC via SSH with the -via option of vncviewer.  Today I started looking into it more with one of my students and we wanted to make the -via option use compression.  By default it just creates a basic tunnel with SSH and doesn’t let you get much more specific.  We figured out how to make it follow more specific instructions!

update: the environment variable is valid in vncviewer version 4.1.2, but apparently not in Feisty’s current version, 3.3.7.  Solution 1 applies to Ubuntu, Solution 2 does not apply to Ubuntu (successful on RHEL5 and most likely recent Fedora series)

Solution 1:

vncviewer will look to client-side configuration files for its settings.  You can create a ~/.ssh/config file for any of your ssh connections and, which might look like this:

Host alias

HostName hostname

Compression yes

User username

…you get the idea.  This will connect to the HostName value when you “ssh alias”, using Compression and the User specified.  You can use any valid ssh value in this config (see man ssh).  Using client-side configuration like this can cut a long ssh configuration down to a much shorter one.  ie;

The vncviewer will look for this file when used in combination with the -via switch and use compression if set to on, as above.  Test it with and without the Compression value and see if you find a difference in performance.

Solution 2:

vncviewer uses an environment variable to start an ssh connection.  By default it looks like:

VNC_VIA_CMD=/usr/bin/ssh -f -L “$L”:”$H”:”$R” “$G” sleep 20

You can find this using one of the following:

env | grep VNC_VIA_CMD

or

strings /usr/bin/vncviewer | grep ssh

The second method of altering it’s connection settings are to update this environment value and tell it to use Compression.  This would be done using the following:

export VNC_VIA_CMD=’/usr/bin/ssh -C -f -L “$L”:”$H”:”$R” “$G” sleep 20′

(that uses single quotes around the entire value and double quotes on the embedded values.  This is important.)

So, if you do a lot of work with VNC I hope you’re using the -via option for SSH tunneling.  Now you can also compress your connection for better performance on slower networks.  What are your results here?  Do you notice much of a difference?  I have only tested this on a LAN so the speeds are fast in the first place.  Anyone want to share their results out over the public interweb?

Due to the many requests for details that I’ve recieved concerning the Firefox extension bounty I wanted to take a minute and outline the details.  It seems everyone thinks I’m being too secretive about the whole thing.  I didn’t mean for that to be the case I was just being brief with my post.  Here are the details.

I would like an extension that simply checks whether or not the current page is indexed on Google.  I know there are extensions that check for PageRank, which I suppose would be similar, but with this tool the important part is simply the indexing.  A page may be indexed but not have a PR value, and that is what I would like to find. Is the page I’m currently visiting indexed on Google?

To check whether or not a site or specific page is indexed in Google you can use the site: prefix to any URL.  An example would be site:http://ubuntu-tutorials.com/user-sitemap/ (results here).

I imagined a simple statusbar icon that would report a green color for a positive result or a red for negative.  Nothing more is needed but a small visual report based on a yes / no indexed result.

In theory it sounds fairly simple, I simply don’t have the time or experience with xul to build it myself.  I hope that satisfies all you curious cats out there.  I do have a few people that have shown some interest, which I’m grateful for.  At this stage I mainly want to get it done so whoever can throw somethingtogether first becomes my new best friend.

UPDATE: Jeremy pointed out that what I need is not a plugin but an extension (and there is a difference!).  If that changes anyone’s mind just drop me a note.

I’ve been sitting on the idea for a Firefox extension for a while now and I realize I just don’t have the time to do it. If you’re interested in helping me realize this extension I’ve set aside a nice shiny $50 for someone who wants to jump on it. Please email me for details if you’re interested (see contact page).

Next Page →

    Subscribe to the RSS feed!


    subscribe to the ubuntu tutorials RSS feed

    Get Ubuntu!



  • Blogroll

  • Ads by Google