How to install Spotify on Fedora 17 64bit

Spotify only provides an installer for Ubuntu on their website but you can also run it on Fedora with these extra steps.

1. Download the Spotify rpm package from https://www.dropbox.com/s/4mi31ngl7v38iq6/spotify-client-0.8.3.278.g21c7566.632-2.x86_64.rpm. This file has been converted from Ubuntu’s deb format to Fedora’s rpm format. If you would like to convert the package yourself you can download the latest Spotify version from http://repository.spotify.com/pool/non-free/s/spotify/ and convert it with the alien -r command (easiest done on Ubuntu).

2, Install all needed libraries

sudo yum install qtwebkit libpng-compat

Spotify expects different file names for some libraries, so create all of the following symbolic links.

sudo ln -s /usr/lib64/libcrypto.so.10 /usr/lib64/libcrypto.so.0.9.8
sudo ln -s /usr/lib64/libssl.so.10 /usr/lib64/libssl.so.0.9.8
sudo ln -s /usr/lib64/libnss3.so /usr/lib64/libnss3.so.1d
sudo ln -s /usr/lib64/libnssutil3.so /usr/lib64/libnssutil3.so.1d
sudo ln -s /usr/lib64/libsmime3.so /usr/lib64/libsmime3.so.1d
sudo ln -s /usr/lib64/libplc4.so /usr/lib64/libplc4.so.0d
sudo ln -s /usr/lib64/libnspr4.so /usr/lib64/libnspr4.so.0d
sudo ln -s /usr/lib64/libpng15.so.15 /usr/lib64/libpng12.so.0

3. Install Spotify

sudo rpm -ivh --nodeps spotify-client-0.8.3.278.g21c7566.632-2.x86_64.rpm

4. You can now run Spotify by typing spotify in the command line or by going to Applications > Sound & Video > Spotify (The Spotify icon might only appear after you restarted the Gnome Shell (Press Alt-F2 then type restart and press return)).

 

suPHP and phpMyAdmin on Ubuntu 12.04

If you use suPHP you will notice that web applications like phpMyAdmin that are installed via the apt-get package manager won’t work anymore.

Thankfully this is easy to fix, you only need to edit the file /etc/apache2/mods-available/php5.conf and add a <Directory /usr/share></Directory> container around ifmodule so that the file looks like

<Directory /usr/share>
<IfModule mod_php5.c>
  <FilesMatch "\.ph(p3?|tml)$">
    SetHandler application/x-httpd-php
  </FilesMatch>
  <FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
  </FilesMatch>
  # To re-enable php in user directories comment the following lines
  # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
  # prevents .htaccess files from disabling it.
  <IfModule mod_userdir.c>
  <Directory /home/*/public_html>
    php_admin_value engine Off
  </Directory>
  </IfModule>
</IfModule>
</Directory>

Then enable php5 again (which was probably disabled when you installed suphp)

a2enmod php5

Restart apache and phpMyAdmin should work

/etc/init.d/apache2 restart

This will enable the php5 module for applications that are installed into /usr/share while websites in your webfolder will still be served by the suPHP module.
If the configuration does not work immediately also try to restart your web browser, most modern browsers just give you back a cached result instead of checking if something changed on the website. Personally I like to use Links2 for testing.

The idea for this came from http://serverfault.com/a/211942/65036, but most steps mentioned there are not necessary in the latest Ubuntu version.

 

RewriteEngine not allowed here

Changing configuration settings via htaccess files is disabled for security reasons on many hosts. So if your website shows you an Internal Server Error and you have the message “htaccess: RewriteEngine not allowed here” in your Apache error.log (ususally to be found at /var/log/apache2/error.log), you will need to first enable support for it.
This can be done by adding the line AllowOverride FileInfo to your Apache virtual host, the vhost configuration file should then look like

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride FileInfo
    Order allow,deny
    allow from all
</Directory>

There is no need to add Allowoverride All instead of FileInfo to your vhosts file. While it will also work it would decrease security.

 

Funny 404 pages

As seen on Reddit, here are some funny 404 error pages.

 

MySQL TYPE=MyISAM deprecated

The TYPE keyword does not work in the latest versions of MySQL any more (e.g. MySQL 5.5). If your application uses it you will receive a statement like

#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near TYPE=MyISAM

The solution is to replace TYPE=MyISAM by ENGINE=MyISAM (or TYPE=InnoDB by ENGINE=InnoDB).

Further information can be found at http://bugs.mysql.com/bug.php?id=17501

 

Speed up your KVM virtual machine

Disk speed

When you create a virtual machine (VM) with virt-manager it will by default create a raw image file with IDE as disk bus. In the configuration file this will look like

<disk type='file' device='disk'>
 <driver name='qemu' type='raw'/>
 <source file='/var/lib/libvirt/images/vm1.img'/>
 <target dev='hda' bus='ide'/>
 <address type='drive' controller='0' bus='0' unit='0'/>
</disk>

Switching the disk bus to virtio will greatly improve the performance and virt edit will show something like this:

<disk type='file' device='disk'>
 <driver name='qemu' type='raw'/>
 <source file='/var/lib/libvirt/images/vm1.img'/>
 <target dev='vda' bus='virtio'/>
 <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>

A simple test inside the virtual machine with

dd bs=1M count=1024 if=/dev/zero of=test conv=fdatasync

results in a speed of 208 MB/s with virtio on my test system, with the IDE setting it was only 32.3 MB/s (in comparison, the actual server performes around 224 MB/s).

To switch to virtio in virt-manager, shut down the VM, then double click on the virtual machine name and go to View -> Details. Select the virtual disk, open advanced options and set Disk Bus to Virtio. Then start the VM again.

Of course you can also edit the configuration file directly with virsh edit but the graphical interface of virt-manager makes a lot of things easier, especially when you are only starting with KVM virtualization.

Network throughput

Using virtio as virtual network interface also brings a huge speed improvement. Downloading a 100MB test file directly on my server and in a virtual machine with virtio as device model takes 10 seconds. With the default Realtek rtl8139 driver it took a whopping 25 seconds to download the same file.
To test the performance you can download a test file via the command line from any major hosting provider with a datacenter close to your server, for example from Softlayer (click on a data center at the bottom of the page) or Leaseweb (look further down the page for the 100MB and 1000MB test files). Use either wget (installed by default on most Linuxes):

wget -O /dev/null http://speedtest.dal01.softlayer.com/downloads/test.zip

or curl (might need to be installed first but has nicer output):

curl -o /dev/null http://speedtest.dal01.softlayer.com/downloads/test.zip