Making clang default compiler in Ubuntu

I recently upgraded my Ubuntu 16.04 LTS to a pre-release of Ubuntu 17.10 since it comes with recent compilers. The clang compilers currently create faster binaries than gcc does. Also I wanted to use latest C++ features since I started playing around with libint (electronic integrals library) again.

With a new compiler, I want to be able to easily switch back. Here’s what worked for me:

sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-5.0 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-5.0 100

Boosting OwnCloud’s Performance with APCU on Ubuntu with Plesk

Memcaching boosts the performance of OwnCloud dramatically. Read about this here. My server is running Ubuntu 12.04 LTS. PHP 5.6 and 7.0 is handled by Plesk. In my experience 5.6 is the most stable running with OwnCloud. APCU is supported by OwnCloud but was not present as a module in PHP (Only on the Sytem providing PHP 5.4). So here’s how you install it.

This is a follow up to my previous post on installing custom modules for PHP handled by Plesk. So I assume that all required software to build the modules is installed.

No ACPU module available
No ACPU module available

For PHP 7.0 simply run:

$ /opt/plesk/php/7.0/bin/pecl install apcu

PHP 5.6 is a bit more stable for running OwnCloud. However you will get an error that you need at least PHP 7.0 for installing ACPU. This is true for the current release (>5.0). So simply install the stable 4.x release:

$ /opt/plesk/php/5.6/bin/pecl install apcu-4.0.10

Register the module with PHP:

For PHP 7.0.x:

$ echo "" > /opt/plesk/php/7.0/etc/php.d/apcu.ini

For PHP 5.6.x:

$ echo "" > /opt/plesk/php/5.6/etc/php.d/apcu.ini

Reread the config:

$ plesk bin php_handler --reread
ACPU module available
ACPU module available

Now the only thing left is to add

'memcache.local' => '\OC\Memcache\APCu',

to your configuration file of OwnCloud (e.g. /var/www/owncloud/config/config.php).


Building a Custom Kernel (3.14) on Ubuntu (Raring, Saucy, Trusty)

Kernel 3.14 was released yesterday. I use this as an opportunity to show you how to build a custom Linux kernel on debian based distributions. It should not really matter which version or distribution one you are running as long as it is based on Debian (I am running the beta version of Ubuntu Trusty Tahr).
The important point is that you use a method that directly creates .deb packages, so that you do not have to worry about uninstalling manually.
But why should you upgrade the kernel anyway you might ask. Well, maybe you shouldn’t, except if you really need one of the new features (like the new scheduler in this release). Or just because you can.
You have to do all steps as root or you can just type “sudo bash” or “sudo zsh” to open a bash or zshell with superuser privileges.
First you need to install the dependencies. Please let me know in the comment section if I forgot something. This step is not shown in the screenshot since I have all the stuff on my system anyway.
apt-get install wget bzip2 kernel-package build-essential
Then go to the system source directory, download and extract the latest release. The wget link in the example refers to version 3.14, but you can simply replace the link to any desired version. Then change into the directory that was created.


cd /usr/src
wget --no-check-certificate
tar xf linux-3.14.tar.xz
cd linux-3.14


Take over the configuration from the kernel which is currently installed on your system.

make oldconfig


The new features and settings have to be adjusted manually. So you will be asked about them. If you have no idea what it is about it is just safe to take the default by pressing enter.


You can adjust the settings afterwards by typing “make menuconfig”. This will bring you to a ncurses based menu where you can change all kernel settings. The default for almost all modules of the kernel is to build them, but load only the necessary modules.  I recommend disabling kernel modules that you do not use at all. This will speed up the compilation. For example I do not use a remote control (IrDA module) on my desktop or amateur radio, so I just disable the building of the modules (changing <M> to < >).

Then it is time to build the kernel and create deb packages for the image itself, the headers and the source.

make-kpkg --initrd --append-to-version=-custom 
kernel_image kernel_headers kernel_source


This will take some time. After the compilation is finished .deb files are automatically created (located at /usr/src). Install them and you’re done 🙂


cd ..
dpkg -i *.deb


On the next boot Linux automatically uses that kernel image as default. You can always check for the kernel version by typing “uname -a”.
Cheers, Michael