System Administration

Linux System Administration

How To Setup MySQL Replication

In this tutorial, I will provide step by step process to setup MySQL replication. We will create one master and one slave. We will use two CentOS 6 servers - one for master and the other for slave. This following steps have been tested on two virtual machines.

Our master server will have IP address 192.168.122.10.
Our slave server will have IP address 192.168.122.12.

You might want to run SELinux in permissive mode.

Perform these steps on the master:

Install MySQL server.

yum install mysql-server -y

How To Install RapidSSL SSL Certificate - Nginx Server

In this article, I will describe how to use the SSL certificate provided by RapidSSL with Nginx server.

openssl is a command line tool to use various cryptography functions.

The req command of openssl provides PKCS#10 X.509 Certificate Signing Request (CSR) management facilities.

We will generate a new certificate request for the domain .

openssl req -new -nodes -keyout www.example.com.key -out www.example.com.csr
Taxonomy upgrade extras: 

Installing Redmine With MySQL And Nginx On CentOS 6

Redmine is a software project management tool which has Wiki, issue tracer, source code browser and other cool features built in. If you want to install Redmine with MySQL and Nginx on CentOS 6, follow these steps.

I always use EPEL repository with CentOS. EPEL provides additional RPM packages. We can use Nginx and some Ruby gem packages from EPEL.

Enable EPEL:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm

Install required packages:

yum install nginx mysql-server ruby rubygem-rack rubygem-rake ruby-mysql

Redmine requires a Ruby gem called i18n. I couldn't find the RPM for i18n gem. I had to install i18n gem using the gem installer.

gem install -v=0.4.2 i18n

Start MySQL server:

/etc/init.d/mysqld start

Use the MySQL secure installation program:

mysql_secure_installation

Connect to the MySQL server as root:

mysql -u root -p

Create a MySQL database and user for Redmine:
mysql> CREATE DATABASE redmine character set utf8;
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'secret_password' WITH GRANT OPTION;

Writing A Python Script To Send Files To Amazon S3

Amazon Simple Storage Service or Amazon S3 is a storage service with a web API. I use Amazon S3 to store backups of my blog and other sites. I made a simple python script to handle file uploads to S3.

In order to use Amazon S3, first create a bucket using your Amazon AWS account. As the name suggests, bucket is a container. You can create buckets using the AWS management console.

The script we're going to write will take two input parameters

  1. Path to file, local
  2. Target S3 path

Learning Nagios 3.0 - Book Review


Title: Learning Nagios 3.0
Publisher: Packt Publishing
Author: Wojciech Kocjan
ISBN-10: 1847195180
ISBN-13: 978-1847195180

Nagios is a powerful and popular network monitoring software. I contacted PackT and asked for a review copy of the book.

Read the full table of contents on the publisher's site.

The topic being system administration, I could read the book from cover to cover in three days.

Like many other technical books, introductory pages of Learning Nagios 3.0 sells you Nagios. The first chapter convinces you why you should use Nagios to make your life easier by setting up automated monitoring of your servers.

Taxonomy upgrade extras: 

How To Install And Configure Nagios On CentOS

Nagios is a popular networking monitoring software. Nagios lets you monitor your IT infrastructure, be it servers, routers, switches or other devices. In this post, I will walk you through the steps of installing and configuring a basic setup of Nagios on CentOS.

At the end of the tutorial you will be have a working Nagios setup to monitor

  • local disk space usage
  • local system load
  • an external website

Whenever there is a problem or recovery with any of the above, Nagios will alert you via email.

Unless you have a strong reason to compile Nagios yourself, you should use the binary packages available for your Linux distribution.

RPMForge provides packages that are not included in CentOS repositories. We will use the Nagios packages from RPMForge.

Enabling RPMForge repository

For 32 bit machines use these commands:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm

For 64 bit machines use these commands:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

Installing And Configuring Nagios

Setting Up MySQL - Database, Users And Sample Table

We discussed how to install LAMP in one of our previous articles. Some of you may be wondering how to create databases, users and tables on your newly installed MySQL server. This blog post introduces the preliminary steps to work with your new LAMP server.

We are going to learn the following:

  • Changing MySQL user password
  • Creating databases
  • Deleting databases
  • Creating MySQL user accounts
  • Deleting MySQL user accounts
  • Connecting to the MySQL server from the command line
Taxonomy upgrade extras: 

Setting Up Apache Virtual Hosts on Fedora

Apache HTTP server is capable of hosting multiple websites on the same server. The feature is popularly known as virtual host.

The term Virtual Host refers to the practice of running more than one web site (such as www.company1.com and www.company2.com) on a single machine. When you configure virtual hosts your web server runs many websites at any given instance. You don't need to edit Apache configuration file and restart Apache every time you switch to a different website.

Follow the instructions below to configure virtual hosts in Apache.

Taxonomy upgrade extras: 

How To Configure Yum To Exclude A Mirror

Many of us have suffered from failing package repository mirrors. Some are slow, some won't have updated content, etc. You might want to remove/blacklist a particular mirror in your yum configuration.

Before trying to remove a mirror, install the fastest mirror plugin.

yum install yum-fastestmirror -y

The fastest mirror plugin is capable of determining mirror speeds and cache it. If that works for you well and good.

Pages