dah85.com

*not* just another blog ;)

Quick Tip

Quick tips

Note to self: Only use LTS releases

- Posted in Quick Tip by with comments

I, for some reason, had a VM running Ubuntu 17.04 which is not an LTS release. To be honest, I never knew what all the fuss about LTS was anyway.

As it turns out, unsupported means apt doesn't work!

Upgrade to the next distro by doing:

do-release-upgrade

And let it rip. In my case, I was trying to install an FTP server on a VM that was running Ubuntu 17.04 and apt kept saying that there was no release file, also giving me an error about not being able to securely download a list when trying to update.

Setting up FTP backups for VestaCP

- Posted in Quick Tip by with comments

By default, VestaCP will do a daily backup and store it on the same file system that VestaCP is installed on, which isn't great if something happened to that and that was our reason for wanting to restore!

What we're going to do is set VestaCP to backup to the local storage and also an FTP server.

I've already set up my FTP server, so all I need to do next is change the VestaCP config. First, we need to create the config file:

sudo nano /usr/local/vesta/conf/ftp.backup.conf

And then paste the following into it, keeping in mind that you will need to change the options to match your FTP server:

HOST='backupserver.yourdomain.com'
PORT='21'
USERNAME='backupuser'
PASSWORD='[email protected]'
BPATH='/home/backupuser/vestabackup'

Once you've got that done, it's time to let VestaCP know about this, so we're going to edit the config file an add ftp to the list of backup targets:

sudo nano /usr/local/vesta/conf/vesta.conf

Find the line that looks like this:

BACKUP_SYSTEM='local'

And change it to this:

BACKUP_SYSTEM='local,ftp'

Now when VestaCP does its daily backup, it will save it to the FTP server too.

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 :)

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.