Enable NumLock on startup

To enable the numeric keypad on startup in Ubuntu, there are two solutions.

1 – With the numlockx package (Starting from version 14.04 64-bit):
sudo apt-get install numlockx

Do not create a file at /etc/lightdm/lightdm.conf, otherwise lightdm will not start!
In /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf Add the following in the [SeatDefaults] section

greeter-setup-script=/usr/bin/numlockx on

2 – For all versions of Linux:
Edit the file /etc/rc.local and add this:
# Turn Numlock on for the TTYs:
for tty in /dev/tty[1-6]; do
/usr/bin/setleds -D +num < $tty
done