How to: Replace with LibreOffice on Ubuntu

Here are a few easy steps to replace with libreoffice on ubuntu:

CLI instructions (these will take care of removing and installing LibreOffice):

Add the PPA and install LibreOffice:

sudo add-apt-repository ppa:libreoffice/ppa
sudo apt-get update
sudo apt-get install libreoffice 

For GNOME integration (for people running default Ubuntu):

sudo apt-get install libreoffice-gnome

or for KDE Integration (for people running Kubuntu):

sudo apt-get install libreoffice-kde

As of Ubuntu 11.04, LibreOffice will replace by default OpenOffice.

Fix gitk ugly fonts in Ubuntu

I’ve recently started playing around with git and found out the power of gitk. Gitk is a small tool built using tcl/tk that helps the user visualize the changes he’s done in a graphical, easy to follow manner. By default Ubuntu 10.10 ships with tk8.4 installed by default and that makes gitk look really ugly, as tk8.4 doesn’t support antialiased fonts. To fix this problem simply install tk8.5 and make it default on your machine:

sudo apt-get install tk8.5
sudo update-alternatives --config wish
# a list will show up and you need to type in the number that corresponds to tk8.5 (in my case was 3) then hit enter.

That’s it. You can now reopen gitk and see the difference.

Setup VPN server and client using OpenVPN

The good thing during the last years is that net access is almost everywhere, and is pretty cheap or even free. A lot of bars, hotels, restaurants offer a free wifi connection, but most of the times that connection is not secured. The biggest security risk with unencrypted connections is the man-in-the-middle type of attack. You are sitting on a bar, checking email, browsing and all your traffic is not encrypted. That means that an attacker can tap into your connection and “listen”, intercept everything you are typing. Like that the attacker can get sensitive data (accounts, passwords, credit card numbers etc.)

Since you don’t have any control over the connection, what one can do to protect himself is to use a VPN. With a VPN, you are creating a secure (encrypted) point-to-point connection between your PC and the VPN server. Translated, that means that all the Internet traffic you are doing, is going through that secure channel, which can’t be hacked that easily.

Here us how to setup a vpn server using openVPN

The server

1. Install openvpn and openssl

sudo apt-get install openvpn libssl-dev openssl

2. Configurations

cd /etc/openvpn/
cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0/* /etc/openvpn/easy-rsa/

3. Create server certificates

cd /etc/openvpn/easy-rsa/
source vars
./pkitool --initca
./pkitool --server server
cd keys
openvpn --genkey --secret ta.key
cp server.crt server.key ca.crt dh1024.pem ta.key /etc/openvpn/

4. Create client certificates

cd /etc/openvpn/easy-rsa/
source vars
./pkitool hostname

For each new client that connects to the VPN you’ll need to create new client certificates using step 4

5. Create server configuration file:

cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/
gzip -d /etc/openvpn/server.conf.gz

After editing your file should look like this:

dev tun
proto tcp
port 1194

ca ca.crt
cert server.crt
key server.key
dh dh1024.pem

user nobody
group nogroup



push "redirect-gateway def1"
push "dhcp-option DNS"
push "dhcp-option DNS"

6. Enable routing and MASQUERADE for your VPN by placing the following in your /etc/rc.local

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE

7. Start the server

/etc/init.d/openvpn restart

The Client

1. Ubuntu (all modern linux?)
I’m using an Ubuntu machine as a client. To use openvpn in Ubuntu just install the openvpn plugin for NetworkManager:

sudo apt-get install network-manager-openvpn

A reboot is recommended.

You can now go and add your connection in Network Manager

2. Windows – to come
3. Mac OS X – to come

Install Adobe® Flash® Player “Square” on Linux

Adobe® Flash® Player “Square” is a preview release that enables native 64-bit support on Linux, Mac OS, and Windows operating systems, as well as enhanced support for Microsoft Internet Explorer 9 beta.

I’m glad to see Adobe has is finally embracing the way it should the 64 bit Platform. This release is a milestone as far as i know, as is the first one that’s released in the same time for win, mac and linux. I’ve put together a small tutorial on
how to install adobe flash player square on linux:

# Script  created by
# Romeo-Adrian Cioaba [email protected]

echo "Stopping any Firefox that might be running"
sudo killall -9 firefox

echo "Removing any other flash plugin previously installed:"
sudo apt-get remove -y --purge flashplugin-nonfree gnash gnash-common mozilla-plugin-gnash swfdec-mozilla libflashsupport nspluginwrapper
sudo rm -f /usr/lib/mozilla/plugins/*flash*
sudo rm -f ~/.mozilla/plugins/*flash*
sudo rm -f /usr/lib/firefox/plugins/*flash*
sudo rm -f /usr/lib/firefox-addons/plugins/*flash*
sudo rm -rfd /usr/lib/nspluginwrapper

echo "Installing Flash Player Square"
cd ~
# 64 bit
tar zxvf flashplayer_square_p1_64bit_linux_091510.tar.gz
# 32 bit
# wget
# tar zxvf flashplayer_square_p1_32bit_linux_091510.tar.gz
sudo cp /usr/lib/mozilla/plugins/

echo "Linking the libraries so Firefox and apps depending on XULRunner (vuze, liferea, rsswol) can find it."
sudo ln -sf /usr/lib/mozilla/plugins/ /usr/lib/firefox-addons/plugins/
sudo ln -sf /usr/lib/mozilla/plugins/  /usr/lib/xulrunner-addons/plugins/

# now doing some cleaning up:
sudo rm -rf
sudo rm -rf flashplayer_square_p1_64bit_linux_091510.tar.gz

To check if the install did it’s job, you need to check about:plugins in your address bar. It should show you this for flash player:

Shockwave Flash

Shockwave Flash 10.2 d161
MIME Type Description Suffixes Enabled
application/x-shockwave-flash Shockwave Flash swf Yes
application/futuresplash FutureSplash Player spl Yes

As usual, I’ve wrapped everything mentioned before into a script to easily install flash player square on Linux

If this version doesn’t work out that well for you, you can still check my other tutorial on how to install native 64bit flash player on Linux
Happy browsing!

CLI Disk Usage

Modern Linux systems have plenty of tools for both Gnome and Kde to analyze the disk space. But if you log into a server via SSH or similar, you’re out of luck. You need a tool for Cli Disk Usage analytics. That tool is ncdu.

You can install it easy:

sudo apt-get install ncdu

Issuing ncdu inside the folder you want to check will open a cool ncurses interface, really easy to use 🙂

Converting disc images to another format on Linux

While this information is available all over the net, i find myself losing enough time now and again trying to figure out how to convert a disk image to iso or something useful for that matter. So i decided to put together a small tutorial on converting disk images to another format on Linux, so i can easily access it whenever i need it.

The most popular disk image formats i’ve had to deal with are: iso (which Ubuntu handles by default perfectly), CloneCD/IMG (used by CloneCD), CUE/BIN, MDF (created by Alcohol 120%), NRG (Nero images) and last but not least DMG (format used mainly by Apple).

Since Linux handles very well .iso files, the idea is to convert any of the image types listed into iso and then the job is easy. For all of the formats there are tools to do just that. You can install them as follows:

sudo apt-get install ccd2iso bchunk mdf2iso nrg2iso dmg2img

Example usage:

# ccd
ccd2iso /path/to/example.img /path/to/example.iso
# bin/cue
bchunk /path/to/example.bin /path/to/example.cue /path/to/example.iso 
# mdf
mdf2iso /path/to/example.mdf /path/to/example.iso 
# nrg
nrg2iso /path/to/example.nrg /path/to/example.iso 
# dmg
dmg2img filename.dmg

Some of those formats can be also mounted using the CLI:

# ccd/img
sudo mount -o loop example.img /media/example 
# nrg 
sudo mount -o loop,offset=307200 /path/to/example.nrg /media/example 
# dmg
dmg2img /path/to/example.dmg /path/to/example.img 
sudo modprobe hfsplus
sudo mount -t hfsplus -o loop example.img /media/example

Setting up Xdebug with Zend Server on Linux

Since our team work on different operating system, we switched for custom apache/php/mysql installs to Zend Server. Before everyone was using something different (the guys on windows were using XAMP, WAMP, on ubuntu i was using the packages in the repo and on the server we’re using apache from cPanel) and applications were behaving a differently according to the default settings for all those platforms.

So we decided to install Zend Server CE as it has more or less the same settings over different platforms. I’ve had some bad experiences installing ZSCE on a system that already had apache installed via apt, but after a clear install of Karmic, ZF was running like a charm. The install process described in the online documentation works great.

After install is done, make sure to symlink php, pecl, pear and phpize so you can access them system wide:

sudo ln -s /usr/local/zend/bin/ /usr/sbin/zendctl
sudo ln -s /usr/local/zend/bin/pear /usr/sbin/pear
sudo ln -s /usr/local/zend/bin/pecl /usr/sbin/pecl
sudo ln -s /usr/local/zend/bin/php /usr/sbin/php
sudo ln -s /usr/local/zend/bin/phpize /usr/sbin/phpize

At this point you should be able to run php -i in terminal and the phpinfo will be displayed.

Next step is to install xdebug via pecl by running:

sudo pecl install xdebug

If all went well you should have the xdebug library located at /usr/local/zend/lib/php_extensions/ . If you don’t have it there, then something went wrong and you should NOT continue reading. This issue must be sorted first.

Next you need to comment out the 1st line of /usr/local/zend/etc/conf.d/debugger.ini so it looks like this:

#open editor
gksu gedit /usr/local/zend/etc/conf.d/debugger.ini

# this is how the 1st two lines should look afterwards
; register the extension to be loaded by Zend Extension Manager

Xdebug needs to be loaded before Zend Extension Manager, that’s why you need to add the following line just on top of the /usr/local/zend/etc/ext.d/extension_manager.ini

#open the editor
gksu gedit /usr/local/zend/etc/ext.d/extension_manager.ini

#add this line on 1st line: 

#save the file

Restart zend server by running:

sudo /etc/init.d/zend-server restart

You can check if xdebug is working like so:

php -i |grep xdebug

The output should be something similar to this:

xdebug support => enabled
xdebug.auto_trace => Off => Off
xdebug.collect_includes => On => On
xdebug.collect_params => 0 => 0
xdebug.collect_return => Off => Off
xdebug.collect_vars => Off => Off
xdebug.default_enable => On => On
xdebug.dump.COOKIE => no value => no value
xdebug.dump.ENV => no value => no value
xdebug.dump.FILES => no value => no value
xdebug.dump.GET => no value => no value
xdebug.dump.POST => no value => no value
xdebug.dump.REQUEST => no value => no value
xdebug.dump.SERVER => no value => no value
xdebug.dump.SESSION => no value => no value
xdebug.dump_globals => On => On
xdebug.dump_once => On => On
xdebug.dump_undefined => Off => Off
xdebug.extended_info => On => On
xdebug.idekey => mimir => no value
xdebug.manual_url => =>
xdebug.max_nesting_level => 100 => 100
xdebug.profiler_aggregate => Off => Off
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => Off => Off
xdebug.profiler_output_dir => /tmp => /tmp
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_autostart => Off => Off
xdebug.remote_enable => Off => Off
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => localhost => localhost
xdebug.remote_log => no value => no value
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.show_exception_trace => Off => Off
xdebug.show_local_vars => Off => Off
xdebug.show_mem_delta => Off => Off
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => /tmp => /tmp
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 3 => 3

Note the xdebug support => enabled on line 2.

Hope that helps 🙂

Remove .svn folders recursively

I know that you have to use svn export in order to get a copy of the repo without the .svn folders inside, but sometimes you have to work with what you have, a checkout of a repo with .svn folders. And you want them removed.

After googling a bit i found a great way to recursively remove .svn folders. Just type the following while in the root of your checkout:

rm -rf `find . -type d -name .svn`

This tip was found on

Enable ls color support

By default i like to use the Green on Black color scheme with my terminals. When i enable the theme though, ls loses somehow the ability to show files in colors. The trick to enable the feature is simple. One just has to run ls like this:

ls --color=auto

Unfortunately this won’t stick, and it’a a bit of a drag to always add the –color=auto part. To solve this, one has to create an alias to ls to point to ls –color=auto. You can do this by adding the following to ~/.bashrc

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'