Linux Archives

Over 80% is running on some form of Linux – so does your Mac and you iPhone. Sometimes we have to get our hands dirty on the command line – it makes you feel like a proper hacker.

Here are some pointers I picked up on my journey.

How to setup MySQL Master/Slave Replication with existing data

mysqlThis is a step-by-step guide on how to replicate an existing MySQL server. The server is live and contains data and needs a constant backup companion.

Many tutorials focus on how to setup replication when no data is present on the system. That’s an ideal solution if you’re building a new setup, but in case you’ve got a server that already has data present then here’s how to accomplish the this:

  1. setup your existing MySQL server (with data) as a Master
  2. export all your databases and user accounts
  3. create a slave and import all your data
  4. start replication

I’ve done this several times and always forgot to take some notes – until today. Without further ado, let’s replicate MySQL.

Read more

How to install CentOS 6 on a Samsung NC10

NC10

Today was a rather exciting day for me: I’ve successfully turned my aging Samsung NC10 Netbook into an internal server in our office.

I bought the little guy in 2009 and he’s been my trusty companion on many jobs before I got an iPad. He still works fine, even though Windows XP was getting weird of late – and admittedly I hadn’t even turned him on in over 8 months.

Now my trusty pal is running CentOS 6.4 while sitting quietly in a corner next to the printer, serving as an internal Linux server. This is great for testing and automated backups – and in the same spirit as playing with a Raspberry Pi (in a much neater battery powered package).

Refreshing the NC10 wasn’t a picnic though, and some of the steps are rather involved. Here are my notes, in case I either have to do it again or you want to follow along.

Read more

How to add a System User Account on Linux (CentOS)

On both CentOS and Red Hat Linux systems you can easily create new user accounts with their own home directories. Here’s how you do this from the command line. I’m assuming you’re logged in as root, and the new user we’d like to create is called “testuser”: useradd testuser Let’s give our testuser a password … Read more

How to install Git on CentOS

Git-Logo-2ColorGit is a superb version control system that’s tightly integrated into Apple’s Xcode. To collaborate with some coding buddies of mine we wanted to setup a central remote storage on my Plesk server so we could all contribute to the code.

Since we did not want to share our code with the public we wanted to make it secure. So secure in fact that we could contribute from coffee shops around the world, hence we decided to use Git with SSH. This is probably the easiest and most straightforward way for read/write access to Git remotes: no daemon to setup, to Firewall to tweak – all we needed was a set of SSH credentials and a server running Git with a bit of space.

Read more

How to fix Duplicate Counter Error in OSSEC

You may come across a duplicated counter / duplicate error in OSSEC. This can happen when you try to add an agent to the server again which was previously added (say when you had to rebuild the OSSEC Server).

The agent is basically saying “hey I’ve got some data here which doesn’t line up with what I should be getting from the server”.

This problem can be resolved easily – let me show you how.

Read more

How to install EPEL and apachetop on Centos 5 and Centos 6

I wanted to use apachetop to monitor one of my servers in real time. Much like top, apachetop reads the acces_log file in /var/logs/httpd/ and displays the results as apache processes happen.

Rather than installing apachetop from source, I thought a simple command like

yum install apachetop

should to the trick… but it doesn’t work by default. Now what?

Well an install via yum will only work if it is configured to look in the right repositories. Apachetop however is not part of the standard repos, hence we need to add what’s known as the EPEL package to yum (it stands for Extra Packages for Enterprise Linux).

In this article I’ll show you how to do it and how to run apachetop.

Read more

How to show your Linux Version

Sometimes you’re working on a system and you’re not entirely sure which Linux distribution it is. There are several ways to find out what you’re working with and I keep forgetting what they commands are to get there – so here’s a quick list for all of us. Release and Distribution Most systems (but not … Read more