Linux Server Setup

I wrote a post in February called Linux Server Pulling Sextuple Duty, describing all the things I use a Linux server for. I said that I would write a guide on how to set it up, since I was always breaking things and needed a guide myself. I have now broken my server so many times that I am pretty good at getting a new one going again. So here is part one of my setup guides.

General Setup

There are several things that need to be done when you have a new Linux environment. Firstly create a new account with sudo privileges and disable the root account. Make sure you can login to your new account and execute sudo commands before disabling the root with:

sudo nano /etc/ssh/sshd_config

and change the line which says PermitRootLogin yes to no. You will need to re-boot the machine or re-start ssh for this to take effect.

The next bit was really complicated, until I found a amazing script to do everything for me. The original is well tested and seems to be regularly updated. My fork works on Ubuntu 16.04 LTS, and will be updated from the original when ever I next run it.

It will then auto-install vsftpd, rtorrent, rutorrent, Nginx, autodl-irssi and optionally Webmin. You can then create and remove new users and configure ssh access, download pages etc. It will configure all the IP table rules, will start services on boot and move the SSH port to a new random one. The HTTPS download pages are especially useful for transferring files to people.

That it, you now have Nginx running, with an rutorrent page for easy management. The readme’s on GitHub explain everything you need to know about for setting it up and using it.

 

OpenVPN

There are lots of reasons to use a VPN, aside from watching US content on Netflix*. Things I use mine for:

  • Securing my internet traffic if I am on a network I don’t trust (coffee shops etc)
  • Getting around network restrictions (blocked ports etc)
  • Occasionally some apps don’t work on mobile data without a VPN
  • General debugging of network issues

Again this is trivial with this script. Run it once (it can take a little while to generate keys), and it will generate a key file to use. You can then run it again to add or remove new users. OpenVPN is available for clients using Windows, Mac OS, Linux, Android and iPhone. Just download the user certificate top your device and add it.

 

Other Uses

I discussed other thing I was using Linux servers for at the time in my previous post. Since then I have found better ways to do many of those things, which I have described below. I am constantly revisiting ideas and researching the best way to do things, so these are likely to change again in the future.

Git Repositories

I use GitHub extensively for open source code, but you have to pay for private repositories. Since I didn’t need to share any private repositories, using my server was a simple solution. You can push and pull to a Git repository over SSH.

I have since stated using GitLab, which provides free private repos and has the added benefit of allowing you to share a repository easily. It doesn’t have the same following for open source projects, but the free features are better than GitHub in my opinion.

Minecraft Server

I haven’t really played Minecraft in a few years, so this is a non-issue. It’s still as simple as ever to do, but if you are going to use mods and add-ons it is probably easier to get a dedicated Minecraft server**.

Team Speak

Voice communication for gaming (because Skype is meh at best) has always been tricky. The traditional way was for someone to host a Ventrilo/Team Speak/Mumble server, or pay for one.

Things are finally getting better, with some games supporting voice natively, Steam chats including it and Discord. Discord allows you to setup your own server, or use one hosted by them. They also claim it will be free forever, with a paid options with mostly cosmetic benefits. It is by far the easiest group chat system I have used and negates the need for a hosted team speak server.

File Backup

Backing up files is still something I am figuring out a good way of doing. However most thing I now work on either don’t change often (pictures and video) or can live in a Git repository. For rarely changing files I use a Linux server (in France so its very off site!) and manually backup archived files there. Hopefully I will one day have a more graceful way of doing this.

 

*Procrastination

So as I wrote “aside from watching US content on Netflix” I wondered if that was still the case. As in is there still more stuff on US Netflix. So I Googled that for a wile. Then I thought about setting up a VPS in the US with a VPN. So I did some more Googling to find a cheap one, and then I set that up…

Now at least I have a new idea for a future post.

**Weirdly the day I wrote that someone asked me about Minecraft servers, so I set one up. About once a year I get really into it for a few weeks then stop again!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.