Skip to content

Blog

Beanstalkd Installation on CentOS 6

Beanstalkd is a simple, fast work queue. Its interface is generic, but was originally designed for reducing the latency of page views in high-volume web applications by running time-consuming tasks asynchronously. In this documentation, I will show how to install Beanstalkd on CentOS 6.


Install Beanstalkd from EPEL repository using yum

sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo yum install beanstalkd

Enable and start Beanstalkd service

sudo chkconfig beanstalkd on
sudo service beanstalkd start

Reference: https://kr.github.io/beanstalkd/download.html

Percona Server 5.6 Installation on CentOS 6

Percona Server 5.6 is the latest release of drop-in replacement for MySQL®. The new version offers all the improvements found in MySQL 5.6 Community Edition plus scalability, availability, backup, and security features found only in MySQL 5.6 Enterprise Edition, which requires a support contract from Oracle to access. Percona Server 5.6 is free, open source software which includes superior diagnostics and improved integration with other Percona software. In this documentation, I will show how to install Percona Server 5.6 on CentOS 6.


Install Percona repository

sudo yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm

Install Percona Server 5.6

sudo yum install Percona-Server-client-56 Percona-Server-server-56

Enable and start Percona Server 5.6

sudo chkconfig mysql on
sudo service mysql start

Run mysql_secure_installation to secure Percona Server 5.6 installation

sudo /usr/bin/mysql_secure_installation

Create user defined function (UDF) from Percona Toolkit

mysql -u root -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'"
mysql -u root -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'"
mysql -u root -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'"

Reference: https://www.percona.com/doc/percona-server/5.6/installation.html

Elasticsearch on CentOS 6

Elasticsearch is a distributed restful search and analytics. In this documentation, I will show how to install Elasticsearch on CentOS 6.


Install Oracle Java

wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u31-b13/server-jre-8u31-linux-x64.tar.gz
sudo mkdir /opt/jre
sudo tar zxf server-jre-8u31-linux-x64.tar.gz -C /opt/jre
sudo update-alternatives --install /usr/bin/java java /opt/jre/jdk1.8.0_31/bin/java 2000
sudo update-alternatives --install /usr/bin/javac javac /opt/jre/jdk1.8.0_31/bin/javac 2000
sudo update-alternatives --display java
sudo update-alternatives --display javac

Import Elasticsearch GPG key

sudo rpm --import https://packages.elasticsearch.org/GPG-KEY-elasticsearch

Add Elasticsearch repository

sudo vi /etc/yum.repos.d/elasticsearch.repo

[elasticsearch-1.4]
name=Elasticsearch repository for 1.4.x packages
baseurl=http://packages.elasticsearch.org/elasticsearch/1.4/centos
gpgcheck=1
gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch
enabled=1

Install Elasticsearch using yum

sudo yum install elasticsearch

Start Elasticsearch service

 sudo service elasticsearch start
 sudo chkconfig elasticsearch on

Reference: https://www.elasticsearch.org/guide/en/elasticsearch/reference/current/setup-repositories.html

Fluent Treasure Data (TD) Agent Installation on CentOS 6

Fluentd is an open source data collector, which lets you unify the data collection and consumption for a better use and understanding of data. In this documentation, I will show how to install fluentd (td-agent) on CentOS 6.


Pre-installation: increase number of maximum file descriptors

ulimit -n
sudo vi /etc/security/limits.conf

*               soft    nofile          65535
*               hard    nofile          65535
root            soft    nofile          unlimited
root            hard    nofile          unlimited

sudo reboot

Pre-installation: network kernel optimization

sudo vi /etc/sysctl.conf

net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.ip_local_port_range = 10240 65535

sudo sysctl -p

Install fluentd (td-agent)

curl -L http://toolbelt.treasuredata.com/sh/install-redhat-td-agent2.sh | sudo sh
sudo chkconfig td-agent on
sudo chkconfig td-agent start

Reference: http://docs.fluentd.org/articles/install-by-rpm

InfluxDB Installation on CentOS 6

InfluxDB is an open-source, distributed, time series database with no external dependencies. In this documentation, I will show how to install InfluxDB on CentOS 6.


Download InfluxDB

wget https://s3.amazonaws.com/influxdb/influxdb-latest-1.x86_64.rpm

Install InfluxDB

sudo rpm -ivh influxdb-latest-1.x86_64.rpm

Enable and start InfluxDB service

sudo chkconfig influxdb on
sudo service influxdb start

Reference: http://influxdb.com/download/

Sensu Installation on CentOS 6

Sensu is often described as the “monitoring router”. Essentially, Sensu takes the results of “check” scripts run across many systems, and if certain conditions are met; passes their information to one or more “handlers”. Checks are used, for example, to determine if a service like Apache is up or down. Checks can also be used to collect data, such as MySQL query statistics or Rails application metrics. Handlers take actions, using result information, such as sending an email, messaging a chat room, or adding a data point to a graph. There are several types of handlers, but the most common and most powerful is “pipe”, a script that receives data via standard input. Check and handler scripts can be written in any language, and the community repository continues to grow! In this documentation, I will show how to install Sensu on CentOS 6.


Generate SSL certificates for communication of Sensu components (be sure that OpenSSL is installed)

which openssl
openssl version
cd /tmp
wget http://sensuapp.org/docs/0.16/tools/ssl_certs.tar
tar -xvf ssl_certs.tar
cd ssl_certs
./ssl_certs.sh generate

Install RabbitMQ (requires Erlang from EPEL repository)

sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo yum install erlang
sudo rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
sudo rpm -Uvh http://www.rabbitmq.com/releases/rabbitmq-server/v3.4.4/rabbitmq-server-3.4.4-1.noarch.rpm
sudo chkconfig rabbitmq-server on
sudo service rabbitmq-server start

Configure RabbitMQ SSL listenet

sudo mkdir -p /etc/rabbitmq/ssl
sudo cp /tmp/sensu_ca/cacert.pem /etc/rabbitmq/ssl/
sudo cp /tmp/server/cert.pem /etc/rabbitmq/ssl/
sudo cp /tmp/server/key.pem /etc/rabbitmq/ssl/
sudo vi /etc/rabbitmq/rabbitmq.config

[
{rabbit, [
{ssl_listeners, [5671]},
{ssl_allow_poodle_attack, true},
{ssl_options, [{cacertfile,"/etc/rabbitmq/ssl/cacert.pem"},
    {certfile,"/etc/rabbitmq/ssl/cert.pem"},
    {keyfile,"/etc/rabbitmq/ssl/key.pem"},
    {verify,verify_peer},
    {fail_if_no_peer_cert,true}]}

]} ].

sudo service rabbitmq-server restart

Create a RabbitMQ vhost for Sensu

sudo rabbitmqctl add_vhost /sensu

Create a RabbitMQ user with permissions for the Sensu vhost

sudo rabbitmqctl add_user <rabbitmq-user> <rabbitmq-password>

Create a RabbitMQ user with permissions for the Sensu vhost

sudo rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*"

(Optional) Enable the RabbitMQ web management console

sudo rabbitmq-plugins enable rabbitmq_management

Install Redis (you can use tutorial in this page) Add Sensu repository

sudo vi /etc/yum.repos.d/sensu.repo

[sensu]
name=sensu-main
baseurl=http://repos.sensuapp.org/yum/el/$releasever/$basearch/
gpgcheck=0
enabled=1

Install Sensu using yum

sudo yum install sensu

Add Sensu SSL certificates

 sudo mkdir -p /etc/sensu/ssl
 sudo cp /tmp/ssl_certs/client/cert.pem /etc/sensu/ssl/
 sudo cp /tmp/ssl_certs/client/key.pem /etc/sensu/ssl/

Configure Sensu to communicate with RabbitMQ

sudo vi /etc/sensu/conf.d/rabbitmq.json

{

"rabbitmq": { "ssl": { "cert_chain_file": "/etc/sensu/ssl/cert.pem", "private_key_file": "/etc/sensu/ssl/key.pem" }, "host": "", "port": 5671, "vhost": "/sensu", "user": "", "password": "" } } Configure Sensu to communicate with Redis

sudo vi /etc/sensu/conf.d/redis.json

{
  "redis": {
 "host": "localhost",
    "port": 6379
  }
}

Configure Sensu API

sudo vi /etc/sensu/conf.d/api.json

{

"api": { "host": "localhost", "port": 4567, "user": "", "password": "" } } Configure Sensu client

sudo vi /etc/sensu/conf.d/client.json

{
  "client": {
    "name": "<client-name>",
    "address": "<clien-ip>",
    "subscriptions": [ "all" ]
  }
}

Enable Sensu services

sudo chkconfig sensu-server on
sudo chkconfig sensu-client on
sudo chkconfig sensu-api on

Start Sensu services

sudo service sensu-server start
sudo service sensu-client start
sudo service sensu-api start

Install Sensu dashboard: Uchiwa

sudo yum install uchiwa

Configure Sensu dashboard: Uchiwa

sudo cp /etc/sensu/{uchiwa.json,uchiwa.json.old}
sudo vi /etc/sensu/uchiwa.json

{
    "sensu": [
        {
            "name": "Sensu",
            "host": "127.0.0.1",
            "ssl": false,
            "port": 4567,
            "user": "<api-user>",
            "pass": "<api-password>",
            "path": "",
            "timeout": 5000
        }
    ],
    "uchiwa": {
        "user": "<uchiwa-user>",
        "pass": "<uchiwa-password>",
        "port": 3000,
        "stats": 10,
        "refresh": 10000
    }
}

Enable and start Uchiwa

sudo chkconfig uchiwa on
sudo service uchiwa start

You can access Uchiwa in http://sensu-server-ip:3000

References: http://sensuapp.org/docs/0.16/guide http://www.rabbitmq.com/install-rpm.html

Memcached on CentOS 6

Memcached is free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering. In this documentation I will show how to install memcached using yum package manager with Atomicorp repository.


Install the latest Atomicorp repository from http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/

sudo rpm -Uvh atomic-release*rpm

Then install memcached sudo yum install memcached

Reference: http://pkgs.org/centos-6/atomic-x86_64/memcached-1.4.22-4.el6.art.x86_64.rpm.html

MongoDB on CentOS 6

MongoDB is the only database that harnesses the innovations of NoSQL (flexibility, scalability, performance) and builds on the foundation of relational databases (expressive query language, secondary indexes, strong consistency). In this documentation, I will show how to install MongoDB on CentOS 6.


Add MongoDB repository to yum

sudo vi /etc/yum.repos.d/mongodb.repo

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

Install MongoDB

sudo yum install mongo-10gen mongo-10gen-server --exclude mongodb-org,mongodb-org-server

Add this to /etc/yum.conf to prevent MongoDB from being upgraded

sudo vi /etc/yum.conf

...
exclude=mongo-10gen,mongo-10gen-server

Start MongoDB service and configure it to start at boot

sudo service mongod start
sudo chkconfig mongod on

Reference: https://docs.mongodb.org/v2.4/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/

Open Source Phusion Passenger Module for Nginx on CentOS 6

Phusion Passenger is a web server and application server for your web apps which built upon Ruby or NodeJS. In this documentation I will show how to install open source version of Phusion Passenger on CentOS 6.6 using Ruby gem installation.


Check your Ruby location

which ruby
/usr/local/rvm/rubies/ruby-2.1.5/bin/ruby

In this tutorial I assume your Ruby is installed using RVM Install passenger using gem command

gem install passenger -V

Install passenger module for nginx

rvmsudo passenger-install-nginx-module

Follow the installation steps and you can customize your nginx installation if you want Download init script for nginx and install

wget https://gist.githubusercontent.com/prasetiyohadi/90355ce4b02487261f58/raw/35319a9b63331a9503424c40489d7be27387584d/nginx
mv nginx /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx

Start nginx service

sudo chkconfig nginx on
sudo service nginx start
sudo service nginx status

Reference: https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#rubygems_generic_install https://www.digitalocean.com/community/tutorials/how-to-deploy-rails-apps-using-passenger-with-nginx-on-centos-6-5

Redis on CentOS 6

Redis is an open source, BSD licensed, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs. In this documentation, I will show how to install Redis on CentOS 6.


Install Development Tools

sudo yum groupinstall "Development Tools"

Download and extract latest Redis package from http://redis.io/ wget http://download.redis.io/releases/redis-2.8.19.tar.gz tar zxf redis-2.8.19.tar.gz Go to redis directory and run make

cd redis-2.8.19
make

it is a good idea to run make test

sudo yum install tcl
make test

Then run make install

sudo make install

Add /usr/local/bin and /usr/local/sbin to your secure_path in /etc/sudoers

Install as service

sudo ./utils/install-server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server]
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /var/log/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable     : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!

Test your redis installation

redis-cli
127.0.0.1:6379>INFO

Reference: http://redis.io/download