Tag Archives: Linux

Execute commands if load average is above in linux

Description

I needed this to do some testing with a load problem I had. One of our server would spike in load for a minute or two, but at random times.
I needed to see what was generating these spikes, but did not want to sit around waiting for it to happen and being ready to hit enter on the commands i needed to run when the load was spiking. So I made this simple little script that you can edit to your needs.

It’s a bash script, and requires the package “bc” to be installed (install it using your package manager if you don’t already have it installed.)

I have tested the script on CentOS and Debian.

I have tried commenting everything in the script as good as possible, but if you have any changes feel free to post a comment.

Continue reading

How to install a single package from debian testing through apt

Why would you want to install a package from testing when running on stable?

The reason is simple. Sometimes you just need a later version of a package than is in the Debian Stable repository. You could of course compile it from source, but this was not good enough for me since if you compile it from source, you have to keep it updated manually, and i’m sure i will forget to.
I wanted to do it through apt like the normal packages, But at the same time still keep running on Debian stable but having the option to install a later version of a package.
In this post, i will show you how you can make that possible, and it’s really easy!
Continue reading

How to install a CentOS 6 64Bit Server

CentOS 7 has been released. I have made an updated guide for installing that too, you can find it here: How to install a CentOS 7 64Bit server
Now that CentOS 6 has been released, I though I should make a quick step-by-step guide on how to set up a CentOS server yourself!

Download the iso

Download the netinstall iso: http://mirror.1000mbps.com/centos/6.6/isos/x86_64/CentOS-6.6-x86_64-netinstall.iso

Burn or mount and boot the iso

Burn iso, or mount it in your virtual machine and boot the system up. You will get following screen:
centos_boot
Continue reading

Set up your own Mumble server for speaking with your friends while gaming

Sometimes I game with some friends. For the time we are playing Payday2 which requires a lot of teamwork. Chatting using the ingame chat system is not the best or fastest way, there is simply no time for it. That’s why I decided to make a Mumble server.

What is Mumble?

Mumble is like teamspeak, ventrilo or skype. It is a online “chat room” but with microphones instead of keyboards (VoIP, Voice Over IP), It’s like a conference call on the phone, but over the internet so it’s free. This makes it good for gaming, since you can speak about what to do in-game without having to use time typing and reading.

Why Mumble and not the other softwares

Some say, Mumble is the best.. But actually they are all great, exept Skype (It uses up all your internet connection so there is nothing left for the game).
I choose mumble personally because it’s open source, and the server can run on Linux.
Continue reading

How to configure a distributed file system with replication using GlusterFS

Distributed file system between multiple servers is a thing I have planned for a long time, but I never got around to it because I first had to find the right filesystem for it.
After a lot of research, I found that GlusterFS was the right file system for me.
My plan was to use a distributed filesystem to share the content of my webservers to make sure all my webservers had the same content on their pages at all time and using some sort of high availability to make sure the content was always there.
To this I used a tool in Linux called Lsyncd before I set up my GlusterFS cluster, this worked well and did live syncing of all the servers using rsync. But there was one problem with it.
If I uploaded a lot of files (20+) to one webserver, and it started to sync to the other webserver before I was finished copying, the result would be that some of the files ended up corrupt, and this was a problem for me!

My distributed file system overview

Here is the overview of the setup I am making, it’s not pretty but I’m sure it’s a lot more easy to explain the setup using a simple mspaint drawing than with text!
GlusterFS distributed file system overview
As you can see in the picture above, I have build this with high availability in mind, since I want my websites to always be up and running!
Continue reading

Upgrading Debian Squeeze server to Debian Wheezy server

My web and others servers was set up on Debian Squeeze about a year ago. and they have been working great. But it thought it was about time to upgrade all my Debian servers to Wheezy instead so I could get some newer updates for packages and in general be up-to-date.
Here is the simple, fast and trouble free way I did it.
Continue reading

Rsync tips and tricks

This post is about tips and tricks for Rsync.
Rsync is a great tool used by many for backup, or just copying data from one server to another and even for local copying of multiple files or syncing folders.
In this post I will show you some examples of what I use rsync for every day
Normally you would use the rsync program like this, to copy files from one folder to another:

rsync -zrav /source/dir/ /destination/dir

What does the parameters do?
z = Compress the data stream, this can improve performance if you copy from one server to another over the network
r = recurse into directories
a = Keep the attributes, this is for example the timestamp on which the file was last modified, or created.
v = Verbose, this just makes sure you see some helpful info while it copies.
If you want to sync and folder to another server via. ssh. you can use the following:

rsync -zrav /local/source/dir/ root@remote-server:/destination/dir/on/remote/server/

There are some other useful parameters you can append to the commands above. Here are some examples that I use a lot:
Continue reading

Convert multiple JPG or PNG to PDF in Linux

I think we all have been in the situation before, you have some scanned documents in JPG or PNG format that you need to convert into a PDF file.
There are many solutions for this on the internet, including free sites that just does it for you if you upload your images, but they almost always put some kind of watermark on the pages if you don’t pay them.
There are also a bunch of Windows applications that do this, but they are often complicated or full of ads.
This guide show you a free solution on Linux, that just works, is fast, and does not add any crap to the PDF.
Continue reading