bookmark_borderPrevent / Block package updates under Ubuntu / Debian

Did you know that you can block package updates under Ubuntu and Debian? Let’s say you have a lot of packages installed on your Ubuntu / Debian system and (for whatever reason) you want that specific packages aren’t getting updated whenever you do a system upgrade. This short article is going to show you how to prevent this packages from being updated.

APT or Aptitude: Both can block package updates

Debian / Ubuntu basically has two ways to manage packages. To be more specific there are two package managers which can be used on the console for updating, installing and removing packages / software under your Ubuntu / Debian systems. These two solutions are APT and Aptitude. This article describes how to prevent packages from being updated with both solutions. If you don’t know which of those two you should go with: Simply go with the APT tools (apt-get, apt-mark, apt-cache, …).

How to prevent packages from being updated.

You can always prevent packages from being updated with the help of APT. APT comes with every Ubuntu / Debian installation, so the following command should definitely work on any Debian / Ubuntu based system:

user@system:~$ sudo apt-mark hold <name of the package>

You have to change <name of the package> with the package you want to hold of course. So for e.g. if you want to prevent vlc from getting updated, the command would look like this:

user@system:~$ sudo apt-mark hold vlc

If you’re and Aptitude user instead, the command (with the exact same result) looks like this:

user@system:~$ sudo aptitude hold vlc

If you now update your system with the classical apt-get upgrade command for e.g., the package vlc isn’t going to be upgraded. APT, as well as Aptitude, will echo a notice which is saying that the package has been prevented from being updated.

How to unhold the package?

So, to hold a package is rather easy. But what to do when you want to unhold this package in order to get it updated again? If we use our vlc package from the example above again, the command to unhold and make a package available for an update with APT looks like this:

user@system:~$ sudo apt-mark unhold vlc

Again, the same command with the exact same result in Aptitude does look like this:

user@system:~$ sudo aptitude unhold vlc

But why to hold a package anyway?

You may ask yourself why you should hold a package anyway. Well, there are several reasons to do this. For e.g. sometimes you update a package and after this update the software doesn’t work as expected. So if you encounter a problem after an update on a test system, you could hold / block the specific package which causes you trouble on a production system before updating that system. Another example would be that you might have to check the configuration files first before updating a specific software. However, you want to install the latest security updates for the other installed packages. With holding the package you can update the other packages without touching the once you block.
Of course there are many other reasons why holding a package is a useful and a needed feature. You can also do this with a graphical solution like Synaptics. However, the console way of block package updates is much more easier and faster (IMHO) 😉

Further links

bookmark_borderHow to watch Twitch, YouTube and others with VLC

If you’re a person like me, you may have also a problem with Flash based streams. Flash is and always has been a resource hungry monster with a lot of security issues. The problem is that a lot of streaming platforms still requiring Flash in order to let you watch their streamers, shows or programs. One of this streaming portals for e.g. is Twitch. But luckily there is a solution for a problem like this. The software Streamlink.

About Streamlink

Streamlink is a fork from Livestreamer. The fork happened because the main developer of Livestreamer decided to drop the development for it. Since then, a lot of work has been made in Streamlink, including additional plugins for a lot of video on demand services or streaming platforms. Streamlink is written in Python and uses different libraries to allow users to watch video streams like Twitch with their favorite video viewers (like VLC, MPlayer and so on).

How to install Streamlink on Ubuntu

Steamlink can be easily installed under almost every Linux distrubution. On Ubuntu the latest and greatest Streamlink version can be downloaded through a so called PPA. A PPA is an addition to the already existing package repositories. This PPA is maintained by the official Streamlink developers and can be added to your system like this:

user@machine:~$ sudo add-apt-repository ppa:nilarimogard/webupd

The following two commands are installing Streamlink:

user@machine:~$ sudo apt-get update
user@machine:~$ sudo apt-get install streamlink

That’s it. With these three simple commands you’ve installed Streamlink under your Ubuntu box. There are several other Linux distrubtions supported and there are also Windows and OS X binaries which can be used. You see the full list of supported operating system on the official download page of Streamlink here: Streamlink installation.

How to use Streamlink?

Now that you’ve installed Streamlink, we can start using it. Just simply open a terminal window and enter streamlink, followed by the URL to the stream / video you want to open with your personal video player of your choice (the stream will be shown with the best possible quality, due to the option best):

user@machine:~$ streamlink https://www.twitch.tv/rocketbeanstv best

Platforms like Twitch and YouTube are already supported of course. But there are plenty of other TV stations and Video-on-demand platforms, which are supported and can be used with streamlink, including the Itlian TV station RAI or the german ARD channel. A complete list of built-in plugins can be found here: Streamlink built-in plugins

Tune your Streamlink

Streamlink has a configuration file which is located in your home directory as a hidden file under Linux machines. This file is called .streamlinkrc. You can basically set every option you can also pass to Streamlink through command line in the configuration file. A full set of available options is listed here: Streamlink options.
An important option here however is to set the desired player you want to use with Streamlink. For e.g. if you set the following line in your .streamlinkrc, you are using VLC as the default player whenever you open a stream with Streamlink:

player=vlc

You can change vlc with mplayer any other video play of course. You can also add options which should be passed to the video player. For e.g. starting a stream in full screen with VLC:

player=vlc --fullscreen

Conclusion

Streamlink (or the former livestreamer) is a very needed and loved piece of software. It literally brings back the fun in watching live streams on Twitch or similar platforms. You don’t need to use flash in order to watch your favorite streams. Besides this, streamlink in combination with your video player of choice is way lesser resource hungry than the old flash technology. Give it a try. You will not regret it 😉
However, one downside: There will be no ads shown. While this sounds like a good thing in the first place, please keep in mind that the streamer you’re watching doesn’t get any money. So please, if you enjoy the stream you’re watching, consider subscribing to them for a few bucks per month. The incoming helps the streamer to go on with his / her work and helps Twitch to let the servers running in the future.
 

bookmark_borderSSH as a proxy on Windows, Mac or Linux

You can do a lot of things with SSH besides working securely remote on machines. I’ve already covered at another article how to tunnel (port forwarding) through SSH. This time we’re looking at a way to use SSH as a proxy.

SSH: A tool not only to do remote work

SSH (Secure Shell) is mostly used to do maintenance on your Linux machines. However, over the years the capabilities of SSH has been extended from a simple secure „remote maintenance protocol“ to a utility which is capable of doing things like X-Forwarding (for forwarding graphical application), port forwarding or providing a SOCKS proxy.

Why do you even want to use an proxy server?

Proxy servers are helpful in a lot of ways. For e.g. if you’re staying some nights in a hotel or you’re in any other public Wireless LAN which blocks a specific website you want to visit a proxy will help you to surpass the filter. Or if you are forced to use techniques like DSLight, were you have to share a single IPv4 address with other users. Or to unblock videos on Netflix which are blocked in your country. You see, the situations where a proxy server is helping you are almost countless.
But why would you want to „setup“ an proxy server on your own? The simple answer is, that a lot of the public proxy servers are simply overloaded. They have to handle so much traffic that you sometime barely be able to get 50% of your normal internet speed while using one of these public proxy servers. Besides this, using SSH as a proxy is really easy.

How start a SOCKS proxy server by using SSH

In order to establish a SSH connection to your server which will then be an SOCKS proxy, you have to have the SSH server installed on the server side and the client software on the client side of course.

Using SSH as a proxy on Linux or Mac

For Linux or Mac you can use the SSH client command which is integrated in both systems. The following command would start an SSH connection, where your SOCKS proxy would then be locally reachable on port 19999 (19999 is just an suggestion and can be changed to almost everything starting from 1024 to 49151 (so called „user ports“)) :

user@client:~$ ssh -D 19999 user@server

After the connection has been successfully established, configure your browser to use the proxy server (follow the instructions below).

Using SSH as a proxy on Windows

Windows doesn’t comes with an SSH command integrated. This means we need an additional software in order to get connected and use the SSH server as a proxy. My recommendation here is PuTTY. PuTTY is a lightweight SSH client for Windows, which is the counterpart of the SSH command on Linux / Mac. You can download it here. After the download is finished, start PuTTY and enter the server you want to connect to like this:

Hostname you want to connect to

Navigate to Connection –> SSH –> Tunnels and enter the port 19999 in the Source port field (19999 is just an suggestion and can be almost everything starting from 1024 to 49151 (so called „user ports“)). After you’ve entered the desired port number, ensure that you’ve selected Dynamic instead of Local:
Settings to tell SSH to create a SOCKS proxy

Click on the button Add in order to tell PuTTY to actually use the given information for the next connection. If you clicked on Add, you should see the port number you have chosen with the letter D in the upper box. If you’ve done this as well, you’re ready to connect to your server. After the connection is successfully established, go on and configure your browser (follow the instructions below).

Configure Firefox / Google Chrome to use the SOCKS proxy

Now that we’ve connected successfully to our server via SSH, we can actually use the SOCKS proxy which has been provided with the actual SSH connection.

Configuring Firefox to use the SOCKS proxy

Click on the upper right options Symbol (represented as three horizontal lines) and click on Preferences. On the upcoming window, select General and scroll down until you see the context Network proxy. Click on Settings and enter your SOCKS proxy details like this:

Firefox proxy settings

Ensure that you’ve checked the box Use this proxy server for all protocols. After you’ve clicked on OK you’re ready to go. Use portals like BearsMyIp to check if you’re actually surfing through your SSH SOCKS proxy tunnel.
Configuring Google Chrome (or Chromium) to use the SOCKS proxy
For Googles Chrome browser you have to use the command line in order to set your SOCKS proxy. This includes Windows users as well. To start Googles Chrome using your SSH SOCKS proxy start the browser like this:

google-chrome --socks-proxy="socks5://localhost:19999"

The windows command line may look like this:

google-chrome.exe --socks-proxy="socks5://localhost:19999"

Of course you can change google-chrome to chromium if you’re an Chromium user instead.

Final words

An proxy server does have it’s advantages. However, public proxies are sometimes overloaded and you will recognize that as a significantly slow down of your internet connection when you start using them. As an alternative you can use SSH as a simple and fast way to make yourself an SOCKS proxy. Using SSH as a SOCKS proxy is a lot easier than configuring an Apache with Squid for e.g.. If you have a server and you need a proxy, I highly recommend you to use SSH in order to get a safe, fast and stable proxy server with a single command or a few clicks.

Further links

 

bookmark_borderHow to easily merge PDF documents under Linux

It’s a well known problem. You have two PDF documents and you want to merge both into one. For e.g. you want to bring your application and your personal data sheet together. This short an easy tutorial shows you how to merge PDF documents under Linux on a graphical way or with the help of the command line.

First option: commando line

Of course there is a way to use the console to do this. The command line tool pdfunite is an easy way to do this. You can use APT on Ubuntu or Debian to easily install pdfunite:

user@client:~$ sudo apt-get update
user@client:~$ sudo apt-get install poppler-utils

pdfunite is part of the poppler-utils package, which basically means that when you install poppler-utils you will also get the desired pdfunite. After the installation is finished, you can just go ahead and merge some PDF files!
To merge start merging, you have to enter the command pdfunite followed by the PDFs you want to merge. The last PDF file in the command line represents the output PDF:

user@client:~$ pdfunite source1.pdf source2.pdf merged_output.pdf

The number of PDF documents you can merge is infinite so this line can be extended like this to merge 4 documents, for e.g.:

user@client:~$ pdfunite source1.pdf source2.pdf source3.pdf source4.pdf merged_output.pdf

Keep in mind that the source files have to be in the same directory where the command pdfunite is executed. If your PDF files are stored in different places, you have to enter the relative or absolute path, for e.g.:

user@client:~$ $HOME/pdfs/source1.pdf $HOME/pdfs/source2.pdf $HOME/Downloads/source3.pdf /mnt/externalhdd/source4.pdf merged_output.pdf

And that’s it. All the magic is done 🙂

Second option: Using a GUI

There are several GUIs which are doing all the work for you but one of those GUIs is (for me) the real shining star: PDFsam. The main reason for this is that PDFsam is capable of doing a lot of more things than just merging: Split, Rotate, Extract, Split bookmarks and many more. PDFsam is written in Java and (of course) available in most Linux distributions. For Ubuntu / Debian you can easily install PDFsam like this:

user@client:~$ sudo apt-get update
user@client:~$ sudo apt-get install pdfsam

After PDFsam is successfully installed, you can start PDFsam through your start menu or by entering the command pdfsam in a terminal window.

PDFsam start window

With an click on the button Merge the merge window is going to pop up. The rest is almost self-explaining. Click on the button Add to choose the source PDF documents from your drive you want to merge, go down to the Destination file, click on Browse and select a place + filename for the merged destination PDF. Click on Run and that’s it.
PDFsam merge dialog

Final words

As you can see, merging PDF documents under Linux is super easy. If you want a graphical toolset which offers more possibilities than just merging, go with PDFsam. If you just want to merge PDF documents on a simple and easy way or if you are just a fan of the command line, go with pdfunite. However, it doesn’t matter which program you use. There are both fast, reliable and easy 🙂
 

bookmark_borderSetup a TeamSpeak 3 Server on Linux (Ubuntu / Debian)

This article is about how to setup a TeamSpeak 3 server on your Linux box. Thanks to the TeamSpeak 3 developers, this process is rather easy and you should have a running TeamSpeak 3 server within minutes.
TeamSpeak 3 is a heavily used solution (if not the most used one) to do low latency voice chat while gaming. For e.g. if you use Skype, the delay and the traffic between the talking people will be much higher, besides the Skype client being way more bloated than TeamSpeak. Besides TeamSpeak 3 there are other gaming based low latency solutions like Discord (which uses central servers without the possibility to setup your own instance) and Mumble.

Install requirements

The TeamSpeak 3 Server doesn’t really need any extra libraries in order to work. With a new Debian 9 setup for e.g. it start without any additional libraries. However to download and extract the server software we need some additional software, in this case a download manger (wget) and the utility to extract the compromised server software (bzip2). With the following command you will install this needed utilities. In this case we use Debian / Ubuntus package manager APT:

user@server:~$ sudo apt-get update
user@server:~$ sudo apt-get install wget bzip2

Now that all the needed utilities are on board, let’s move forward and install the server software itself.

Download and install the TeamSpeak 3 Server

TeamSpeak 3 is a proprietary software solution. Due to this fact you will not be able to install it from the repositories of your Linux distribution. So this means you have to download it from the developers homepage onto your server. You can download the latest TeamSpeak 3 Server software here. As of writing this tutorial the latest and greatest TeamSpeak 3 Server version was 3.0.13.8. Whenever you go through this tutorial, your version number may be a newer one. The following command downloads version 3.0.13.8 to your server:

user@server:~$ wget http://dl.4players.de/ts/releases/3.0.13.8/teamspeak3-server_linux_amd64-3.0.13.8.tar.bz2

After the download is finished (which can take some time depending on your network speed), we can extract the downloaded server software. The following command is doing this:

user@server:~$ tar xfvj teamspeak3-server_linux_amd64-3.0.13.8.tar.bz2

Now it’s time to start the server for the first time.

Starting the TeamSpeak 3 Server

Now, that we’ve downloaded and extracted the server software, we will be able to start the server software. To do so, we have to change into the TeamSpeak Server directory (which has been automatically created with extracting the server software) and issue the command to start the server:

user@server:~$ cd teamspeak3-server_linux_amd64
user@server:~/teamspeak3-server_linux_amd64$ ./ts3server_startscript.sh start

The first start takes some time, approximate 1-3 minutes. After the first start is finished, you will get an output like this:

------------------------------------------------------------------
 I M P O R T A N T
------------------------------------------------------------------
 Server Query Admin Account created
 loginname= "serveradmin", password= "BVV2YUIJ"
------------------------------------------------------------------
------------------------------------------------------------------
 I M P O R T A N T
------------------------------------------------------------------
 ServerAdmin privilege key created, please use it to gain
 serveradmin rights for your virtualserver. please
 also check the doc/privilegekey_guide.txt for details.
token=zvCYfUTRlcYl12dviAMuGKR7e+nQYKSE0bD9O4CI
------------------------------------------------------------------

Important: You should write down the server query admin account on a piece of paper, or you save these informations in a password database. This account is needed in emergency cases, like lost TeamSpeak user data or hacking attempts.
In this case we only need the privilege key for now. Store the line, starting with token= in a text file. We need this token later on.
To finally ensure if you’re server is running correctly, you can issue the following command:

user@server:~/teamspeak3-server_linux_amd64$ ./ts3server_startscript.sh status
Server is running

If the output Server is running is welcoming you, it’s time to connect to your new server.

Connect to your server and give yourself admin rights

At this point I assume, that you’ve already installed the TeamSpeak 3 client onto your computer. If you didn’t, you should download it here. If you’re a Linux user, you have to download the TeamSpeak 3 client through the link. You will not find the TeamSpeak 3 client in the distribution repositories due to the same reason as you will not find the TeamSpeak 3 server software.
To connect to your server, start the TeamSpeak 3 client and click on Connections –> Connect or use the hotkey CTRL+S. In the upcoming dialog, enter the IP address or name of your server and pick a nickname which you want to use on that server and hit the Connect button.

Connection dialog

The server recognizes that the server was initially setup and pops up another dialog where it asks for a so called Privilege Key. This Privilege Key is the generated token we’ve saved a few steps before in a text file. Open the text file (if not already) and copy everything after token= and insert this key into the dialog box like this:
TeamSpeak privilege key

After you’ve used the privilege key you can delete the text file. A privilege key is for onetime use only. However, you should now see a new symbol besides your nickname which states that you’re an Administrator. From now on, you should be able to create channels, server groups, edit the servers name and so on.
Indicator that you’re an Admin (click to enlarge)

After this step your TeamSpeak 3 server is completely and fully setup. You can now close the SSH connection to your server and start to share your servers address with your friends and start talking 🙂

Useful tips

While the TeamSpeak 3 software is mainly rock solid, you should take care that your server is always up to date. To update the TeamSpeak 3 server software go to their official homepage, download the newest version (like you did before in this tutorial with wget) and extract it. The files will be overwritten besides the database files. This ensures that you don’t have to start all over again when you do an update. However, you have to stop the TeamSpeak 3 server before you update it. You can do this easily like this:

user@server:~$ cd teamspeak3-server_linux_amd64
user@server:~/teamspeak3-server_linux_amd64$ ./ts3server_startscript.sh stop

After you’ve extracted the updated server files you can start the server again:

user@server:~/teamspeak3-server_linux_amd64$ ./ts3server_startscript.sh start

Please be also aware that you should use a firewall or package filter solution like IPTables. A server with the latest security patches is good, but a firewall solution will always increases the security these days.

Final words

In times where almost everything goes more and more centralized (Discord, WhatsApp, …) I feel that a solution like TeamSpeak 3 is really needed. I know there are other solutions like Mumble which has the additional benefit of being Open Source, however, we can’t have enough decentralized solutions if you ask me 😉
I hope this tutorial is helpful for you. If you have any questions or if you just want to leave a feedback, use the comment section below.

Further links