Installing latest NodeJS on Ubuntu 16.04

Getting the latest NodeJS (14.x) is fairly straightforward for Ubuntu/Debian 16.04

$ sudo apt-get install software-properties-common
$ curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

References:

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

https://github.com/nodesource/distributions/blob/master/README.md

vnstat – Error: Unable to read database

Error: Unable to read database "/var/lib/vnstat/eth0": No such file or directory

This error will appear when vnstat is not configured to the correct netwrork interface. You can check what interface your device is using with ifconfig:

$ ifconfig
enp3s0: flags=4163 mtu 1500
...

And to make sure your vnstat is monitoring your identified network interface you can check for the database files located in: /var/lib/vnstat/

$ ls /var/lib/vnstat
enp3s0 wlp2s0

Now you just need to add it to your vnstat config. You could simply edit the default config file located at /etc/vnstat.conf which would apply globally. However it is recommended to create a local config for your user. Copy the global config into your home directory like so:

$ cp /etc/vnstat.conf ~/.vnstatrc

And update the default database to your selected network interface:

# default interface
Interface "enp3s0"

Save and you should be able to run vnstat and check your bandwidth stats.

$ vnstat -d
enp3s0 / daily

     day         rx      |     tx      |    total    |   avg. rate
 ------------------------+-------------+-------------+---------------
 07/08/2019    61.04 MiB |    6.05 MiB |   67.09 MiB |    6.51 kbit/s
 07/09/2019    25.36 MiB |  152.33 MiB |  177.69 MiB |   17.25 kbit/s
 07/10/2019    10.38 MiB |    2.12 MiB |   12.51 MiB |    2.38 kbit/s
 ------------------------+-------------+-------------+---------------
 estimated        19 MiB |       3 MiB |      22 MiB |

Resources

Ubuntu 16.04 LTS UI and/or Windows freezes with mouse and keyboard working

Ever since upgrading my PC hardware (graphics card) to Nvidia 970 and 1070 GTX I have been plagued with Ubuntu’s Display Manager constantly (and seemingly) randomly freezing. It was also occurring with Ubuntu 14.04 LTS.
The only solution I could find to combat this was to restart LightDM.

I would hit Ctrl + Alt + F1 to open up the shell and login. Then restart the lightdm service:

$ sudo service lightdm restart

This would restart the display manager and would stop the freezes occurring, for a while at least. The most annoying this was having to do this literally every time I booted or logged in.

After trying fresh installs, Unity tweaking and other ‘fixes‘ I finally made the transition to Debian 9 and the default Gnome 3 window manager. And to my delight it appears the problem has gone away!

I will be sticking with Debian from now on (at least until I upgrade hardware again).

WordPress plugins page error – X-Frame-Options does not permit framing

firefox
Firefox console error message showing: Load denied by X-Frame-Options

Have you ever had an issue embedding a frame or iframe on your website? Problems like the content not being loaded or displayed at all?

In my case I came across this problem when trying to preview plugins in my WordPress panel.
If you checked the browser console log, you might have seen similar message to:

Load denied by X-Frame-Options: https://yourwebsite.here does not permit framing.

This error message is caused by the web server (in my case Nginx) sending a HTTP header ( X-Frame-Options ) that is telling your browser to not allow loading of embedded frame content. This is security measure to prevent attacks known as clickjacking.

A quick way to see which config file(s) might be setting this header option for Nginx is:

sudo grep -R "X-Frame-Options" /etc/nginx/

which will output the offending files if they exist.

In my case the solution was to simply modify a single value in one of my configs. I changed:

add_header X-Frame-Options DENY

to:

add_header X-Frame-Options SAMEORIGIN

Saving the config edit and restarting Nginx was enough to resolve this issue for me. “SAMEORIGIN” tells the browser to allow loading content in frames as long as the source content is from the same origin as the parent page (current website).

Resources: