dah85.com

*not* just another blog ;)

Installing youtube-dl on Linux

- Posted in Quick Tip by with comments

I want to install the latest version of youtube-dl for Linux, the one that comes in the apt repository is horribly outdated and often doesn't work, so here's how you do it:

This will download the files needed..

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl

And this will set it up so it can be executed..

sudo chmod a+rx /usr/local/bin/youtube-dl

Now we can run it:

youtube-dl

We can update it also if there are some videos that give errors, which is a pretty common cause for an update:

youtube-dl -U

And we're done :)

I'm setting up my elementary OS 0.4 installation, and I am trying to use the terminal, which is very nice by the way - however there are no options available. I can't change the font sizes or colours, etc. What I need to do is install something called elementary tweaks.

First, we need to install the things we need to add a ppa repository:

sudo apt update && sudo apt install software-properties-common -y

Now, we can add the PPA for elementary tweaks:

sudo add-apt-repository ppa:philip.scott/elementary-tweaks && sudo apt-get update

Then finally, we can install elementary tweaks:

sudo apt install elementary-tweaks

And if you go into the System Settings (Applications -> System Settings) you will see "Tweaks" installed.

And we're done :) Now I can change the terminal font plus a lot more!

I've just installed a fresh copy of elementary OS and I have noticed that out of the box, the AppCenter is empty - says there is nothing to display, which isn't right!

I opened the terminal and did an apt update:

sudo apt update

And then rebooted:

sudo reboot

And now when I open AppCenter everything shows up :) It's a nice simple fix for what could have otherwise been a headache.

This is how you install VirtualBox 5.2 in Ubuntu 17.10

First, we'll add the repository to /etc/apt/sources.list

sudo nano /etc/apt/sources.list

Then at the bottom, we need to add the following line for Ubuntu 17.10 - Note that if you're using a different distro, replace "artful" with whatever the other entries in your sources.list say.

deb https://download.virtualbox.org/virtualbox/debian artful contrib

Once you've done that, control-x to exit, y and then to save.

We need to add the security key for that repository, we do that in one line:

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -

Once that's done, we need to update the apt lists:

sudo apt update

Now we need to install dkms which is some kernel drivers that let VirtualBox do what it does best, it's important we install this first as there can be some issues otherwise:

sudo apt-get install dkms

Once that's installed, we can install VirtualBox:

sudo apt-get install virtualbox-5.2

And now it's ready to use!

Just open virtualbox from the terminal to make sure it's all fine, it will let you know if you need to download an update or extra files at this stage:

virtualbox

And we're done!

Let's face it, knowing system stats is an extremely geeky thing. Now we have that out the way, I want to show you neofetch:

neofetch in action on my laptop

Looks pretty, eh?

I'll show you how to install it and also how to make it run every time you open a new terminal, like shown in the screenshot above.

First, let's install neofetch:

sudo apt update && sudo apt install -y neofetch

If that didn't work, try adding the PPA:

sudo add-apt-repository ppa:dawidd0811/neofetch

Then install:

sudo apt update && sudo apt install -y neofetch

Test that it's working by running neofetch:

neofetch

You should see something similar to the screenshot, but if your distro happens to be Debian or something else, the logo will change - neat!

Let's make it start every time we open a terminal:

nano ~/.bashrc

Page-down right to the bottom, and add the following line:

neofetch

Control-X to save, press y to confirm and enter to save the file.

Open a new terminal and you'll be greeted with pretty stats :)

Hi everyone,

I have something awesome to share with you guys! You can get a 25% discount from SerweryDedyKowane.pl by using the coupon code:

E3D7-C20D-0EDE

That brings the price of an i5 with 8GB RAM and either 1TB of HDD or 240GB of SSD with unlimited 100mbit in Poland for only $25/month. These servers mine at 200h/sec and at current rates will mean you're only paying about $10/month :)

Check out my list of Dedicated Servers for more

Setting up Transmission for "stealth"

- Posted in Quick Tip by with comments

If you've got a computer or server running Transmission, then you will probably at some stage get an email suggesting you've probably downloaded something you shouldn't have. This can happen in cases where you have clicked the wrong link, instead of a Linux ISO you downloaded a latest release movie - oops!

No worries, here's what I've found is the best approach to handling this. The key is to make sure that Transmission can not send any data, or seed. This will not work well if you need to seed for your tracker, for example.

What we need to do first is stop transmission-daemon so we can modify the settings:

systemctl stop transmission-daemon

Let's move along, so the file we're interested in editing is settings.json which can usually be edited like this:

nano /etc/transmission-daemon/settings.json

There are a lot of settings in this file, but we'll focus only on the ones that matter here. Make sure your settings look like this:

"encryption": 1,
"speed-limit-up": 0,
"speed-limit-up-enabled": true,

This makes it prefer encryption, and makes sure that it will NEVER send any data. Sending data is what gets you in trouble, if you're not sharing anything you're not doing anything wrong.

Once you've changed those settings, save the file and make sure you start transmission-daemon again:

systemctl start transmission-daemon

It's always a good idea to test this, so make sure when you download a file there is no uploaded data - if not, you're all good to go!

I have recently installed Matomo (formerly Piwik) on a test server for collecting analytics, and I have noticed that there is this annoying error message that shows up 3-4 times on the main page:

WARNING: /var/www/public_html/matomo/libs/Zend/Db/Statement/Mysqli.php(105): Warning - Error while sending STMT_CLOSE packet. PID=18123 - Matomo 3.3.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)

I'm going to try to fix that here. I found that the problem is that MySQL times out waiting for it to complete the task, so let's change some settings in MySQL.

wait_timeout = 60
max_allowed_packet = 128MB

I did this on VestaCP, by going into the "Server" tab, then MySQL -> Configure. Once changed, click save and then refresh Piwik/Matomo and it is fixed!

Please let me know if this has helped you, in the comments :)

Installing PHP 7.1 on Ubuntu 16.04

- Posted in Quick Tip by with comments

I am trying to install Laravel on my web server running VestaCP on Ubuntu 16.04 through softaculous and it's telling me that it requires PHP 7.1 to be installed and I only have PHP 7.0. Trying to install it via apt-get quickly shows that it's not available in Ubuntu 16.04's repository.

Here's how I got it up and running:

First, we need to make sure we have what we need installed:

sudo apt-get install software-properties-common

Now we can use the tool to add a repository, in this case, the one for PHP:

sudo add-apt-repository ppa:ondrej/php

Of course, we need to update apt so it knows about the new packages:

sudo apt-get --allow-unauthenticated update

In my case, it's telling me that the package or PPA can't be signed, so I've used the allow-unathenticated flag.

Now we can install PHP 7.1 from the repository:

sudo apt-get install php7.1

It's warning me that I'm about to install something that isn't signed, I'm going to proceed anyway.

Now I will install a few extra things for PHP7.1 that I've found that nextCloud in particular needs, but installing these now will also mean I don't need to do it again in future :)

sudo apt install php7.1-gd php7.1-json php7.1-mysql php7.1-curl php7.1-mbstring php7.1-intl php7.1-mcrypt php-imagick php7.1-xml php7.1-zip php7.1 libapache2-mod-php7.1 php7.1-mysql php7.1-curl php7.1-gd php7.1-intl php-pear php-imagick php7.1-imap php7.1-mcrypt php-memcache  php7.1-pspell php7.1-recode php7.1-sqlite3 php7.1-tidy php7.1-xmlrpc php7.1-xsl php7.1-mbstring php-gettext

Great, it's installed.. let's see if it's working..

Success!!

Now I can continue on my way :)

I am installing Laravel because I'd like to learn PHP and a framework at the same time, and from what I can tell, Laravel is the most recommended for newbies, so when I start on that I will start blogging about it.

I recently needed to find a quick, simple way to download some files from my seedbox - a server that simply downloads torrents and then I can either watch them in Plex (for example new episodes of an Open Source TV show) or download them to my computer over HTTP.

The simplest way I could find is by using Python! Let's say we want to open up port 12345 for this purpose, what we would do then is open a terminal in the directory where the files live (let's say it's /var/media) and run the command to start a HTTP server on port 12345 listing the files in /var/media:

cd /var/media
python -m SimpleHTTPServer 12345

You'll now see something like this:

Serving HTTP on 0.0.0.0 port 12345 ...

All you need to do then is go to your server, for example http://yourserver.com:12345/ and you can easily download your files from there.