khanhnnvn

Install Tonido private cloud server on Ubuntu 14.04.3 / 15.04

 Solution  Comments Off on Install Tonido private cloud server on Ubuntu 14.04.3 / 15.04
Sep 072015
 
Tonido private cloud server
Tonido private cloud server

Tonido is a free application server that helps you to access all your files on your Linux server / machine from a web browser, smart phone, tablet, and even from DLNA enabled devices. Also, you can share them with your family, friends and colleagues. Configure public direct links so that anyone can access the content, additionally, you can create a secure private share to only allow authorized people to access them.

With Tonido, you can stream your Media such as Photos, Audios, and Videos to any devices on your network. It works on Windows, Linux, Mac and all major mobile phones and tablets including iPhone, iPad, Android, Windows Phone 8 and Blackberry. Tonido can also be used to take backup photos / videos from phone to your desktop.

Please note that, Tonido comes in two version, free for SOHO user, and paid for enterprise. In free version, you are allowed to have a custom logo, branding, and identity.

Prerequisites:

Install below dependent packages for Tonido.

$ sudo apt-get install libjpeg8 libfontconfig

Installing Tonido:

Here we will be using free version of Tonido. Please follow below instructions to install tonido on Ubuntu 64 bit, detailed instruction on installing Tonido on 32 bit can be found here.

Lets install curl, we will use this for downloading Tonido using terminal.

$ sudo apt-get update

$ sudo apt-get install curl

Create a directory for Tonido installation.

$ sudo mkdir /usr/local/tonido

Go to that directoryt and download the free version of Tonido from official website.

$ cd /usr/local/tonido
$ sudo curl -o tonido64.tar.gz  http://www.tonido.com/download.php?tonido64.tar.gz

Extract the tar file using below command.

$ sudo tar -zxvf tonido64.tar.gz

Now, run Tonido using command.

$ sudo ./tonido.sh start

Troubleshooting:

If Tonido service is not starting or not listening on port 10001, go through the Tonido logs for any errors.

$ cat /tmp/tonido_<accountname>.log

Configure Tonido:

After starting Tonido, open up your web browser and navigate to http://127.0.0.1:10001 or http://ip-add-ress:10001. You should get a below screen.

Now, create a local account. Enter the account name of your choice, password and email id.

Install Tonido - Create a Account
Install Tonido – Create an Account

Your remote access server will be created now, URL will look like.

http://<accountname>.tonidoid.com
Install Tonido - Remote Server URL
Install Tonido – Remote Server URL

Select the folders that can be accessed remotely via Tonido, you can change these settings later.

Install Tonido - Remote Access and Sharing
Install Tonido – Remote Access and Sharing

Select the folders to index Music, Photos and Video collection.

Install Tonido - Indexing Media Files
Install Tonido – Indexing Media Files

Install the mobile apps for iOS, Android, Windows phone and get access to all your collections. Click on Close to finish the installation.

Install Tonido - Mobile Apps
Install Tonido – Mobile Apps

Now, you will be redirected to your Tonido dashboard.

Install Tonido - DashBoard
Install Tonido – DashBoard

You can upload your files / Music / Videos by clicking on the upload button.

Once you have uploaded the media files, have to manually index those files by going to Settings –> Misc –> Index Now.

Install Tonido - Manual Indexing
Install Tonido – Manual Indexing

Wait for a minute to get indexing completed, you can play videos by going to Videos section.

Install Tonido - Playing Videos
Install Tonido – Playing Videos

You can share files/folders to your friends, family, and colleagues or to a particular person. To do that, go to Shared files section, click on New Share button and select the file / folder you want to share.

Install Tonido - Sharing File
Install Tonido – Sharing File

Also, you can share this file to a particular person.

Install Tonido - Sharing Files Permission
Install Tonido – Sharing Files Permission

If you want to sync files/folders to multiple systems, you can install the Tonido sync tool. Click the Account name drop-down box, and select Tonido Sync. Since I am using desktop, I selected the Desktop application.

Install Tonido - Sync Files
Install Tonido – Sync Files

You will be redirected to the Tonido sync download page. Select and download the Sync app depending upon your operating system.

You can configure app to sync files / folders from your desktop to Tonido.

Auto Start:

Copy the Tonido script to /etc/init.d directory.

$ sudo cp /usr/local/tonido/tonido.sh /etc/init.d/tonido

Make the service script to run as service at every boot.

$ sudo update-rc.d tonido defaults

To remove the tonido script.

$ sudo update-rc.d tonido remove

To start the script.

$ sudo service tonido start

For further, I suggest you to read comprehensive usage guide from Tonido site.

That’s All!!!, you have successfully configured Tonido private cloud server on Ubuntu 14.04 / 15.04.

Register clients with SpaceWalk Server

 Solution  Comments Off on Register clients with SpaceWalk Server
Sep 072015
 
Install Spacewalk
Spacewalk

This is the third part of Spacewalk installation and configuration series. In the first two parts, we gone through how to install and configure Spacewalk server and managing Spacewalk channels and repositories.

  1. Install And Configure Spacewalk In CentOS 7
  2. Managing Spacewalk Channels And Repositories

In this tutorial, we will configure clients to take installation packages from the Spacewalk server by registering it with Spacewalk server.

Environment:

OS : CentOS Linux release 7.0.1406 (Core)

Hostname : client.itzgeek.local

IP Address : 192.168.12.4

Install Spacewalk clients:

CentOS Base repository does not have packages that are required for registering clients with Spacewalk server, so we would require to configure Spacewalk repo on client machine.

# rpm -Uvh http://yum.spacewalkproject.org/2.3-client/RHEL/7/x86_64/spacewalk-client-repo-2.3-2.el7.noarch.rpm

Install below packhttp://www.itzgeek.com/wp-admin/post.php?post=9265&action=editage.

# yum install yum-rhn-plugin

Once the packages are installed, proceed to register the clients with spacewalk server.

Register clients with SpaceWalk Server:

It is recommended to use activation keys for registering and configuring client systems with Spacewalk server.

Now, login to Spacewalk server and get an activation that we created in previous tutorial.

Goto System –> Activation Keys.

Register clients with SpaceWalk Server - Activation Keys
Register clients with SpaceWalk Server

On client system’s Terminal, run the following command to register it to the Spacewalk server.

# rhnreg_ks --activationkey 1-3de95eb8d397e65b3831910fdc3e3f61 --serverUrl https://server.itzgeek.local/XMLRPC

Once the above command is executed, goto Spacewalk console, and click on Systems. You will see our client system that we just registered with Spacewalk.

Register Clients with Spacewalk server - System Overview
Register Clients with Spacewalk server – System Overview

Click on client name, you will be taken to client summary page where you can see detailed information about registered client (client.itzgeek.local). You can see that this system has subscribed automatically to base channel (itzgeek_centos7).

Register Clients with Spacewalk server - Client Overview
Register Clients with Spacewalk server – Client Overview

Modifying Subscription (Optional):

GUI Mode:

If you want to make a use of child channels (Ex. To install Nginx), To enable the child channels of the base channel to get Niginx packages.

Go to Systems –> <Your Client> –> Software –> Software Channels –> Software Channel Subscriptions.

OR

Click on Alter Subscription Channels on client over page.

Select the Child channels (Ex. nginx_centos7) and click Change Subscriptions.

Register Clients with Spacewalk server - Change Channel subscription
Register Clients with Spacewalk server – Change Channel subscription

Now, client system is successfully subscribed to Nginx child channel.

Register Clients with Spacewalk server - Subscripton List
Register Clients with Spacewalk server – subscription List

Command Line Mode:

You can also change channel subscription using command Line. To list subscribed channels, run.

# rhn-channel -l

sample output:

itzgeek_centos7

To list the available channels, run.

# rhn-channel -L

sample output:

Username: itzgeek
Password:
nginx_centos7

Now, to subscribe to child channel, run.

# rhn-channel -a -c nginx_centos7

You will have to enter username and password of Spacewalk server admin account.
Veryify the subscription using below command.

# rhn-channel -l

sample output:

itzgeek_centos7
nginx_centos7

If you want to remove child channel subscriptions, run the following command.

# rhn-channel -r -c nginx_centos7

That’s it.  You can start to install or update packages from the Spacewalk server. Also, make sure that you have disabled non-Spacewalk repositories.

To do that, run:

# sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/*

To test, install Nginx package on client machine.

# yum install nginx

Sample output:

Loaded plugins: fastestmirror, rhnplugin
This system is receiving updates from RHN Classic or Red Hat Satellite.
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.8.0-1.el7.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package      Arch          Version                  Repository            Size
================================================================================
Installing:
nginx        x86_64        1:1.8.0-1.el7.ngx        nginx_centos7        369 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 369 k
Installed size: 889 k
Is this ok [y/d/N]:

[...]

If you see the above output, the packages are installed from Spacewalk child channel (nginx_centos7).

That’s All. You have successfully registered client systems with Spacewalk server for packages.I plan to cover more topics on Spacewalk server, stay tuned.

Managing Channels and Repositories – Spacewalk on CentOS 7 / RHEL 7

 Solution  Comments Off on Managing Channels and Repositories – Spacewalk on CentOS 7 / RHEL 7
Sep 072015
 
Install Spacewalk
Install Spacewalk

This is the continuation from installing and Configuring SpaceWalk on CentOS 7. This tutorial will show you how to configure Spacewalk to distribute updates for CentOS or RHEL clients.This is a simple step by step process, so i will only mention minimal settings to be done for distributing updates.

Spacewalk Channels:

Channel is nothing but a collection of software packages. A channel may contain packages from a specific distribution, also it may contain packages for an application or family of applications. Users may also define channels.

Any client can subscribe to a particular channel to download, update, install packages. The channels are linked to upstream server (a normal YUM repository). A channel may have linked to multiple repositories, can be cloned, sync or customized.

There are two types of channels:

1.Base channels

2. Child channels

A base channel consists of packages based on a specific architecture and Red Hat Enterprise Linux release. A child channel is a channel associated with a base channel that contains extra packages. A system must be subscribed to only one base channel. A system can be subscribed to multiple child channels of its base channel. A subscribed system can only install or update packages available through its Satellite channels.

Create a Base Channel:

Login to Spacewalk web console, https://spacewalk-server-ip. Enter user name and password that you defined in previous tutorial.

Goto Channels –> Manage Software Channels –> Create New Channel.

Managing Channels and Repositories - Create Base Channel
Managing Channels and Repositories – Create Base Channel

This is where you can label your different type of architecture. Here i created label “itzgeek_centos7” for CentOS 7 packages, same like you can create label for other architectures and other Linux flavors, label name does not matter; only architecture is important while configuring.

Managing Channels and Repositories - Base Channel Details
Managing Channels and Repositories – Base Channel Details

Create a repository:

Goto Channels –> Manage Software Channels –> Manage Repositories –> Create repository.

Managing Channels and Repositories - Create a Repository
Managing Channels and Repositories – Create a Repository

Here you can mention upstream server from where Spacewalk server will download the updated packages for clients. To show you a demo, i used http://mirror.supremebytes.com/centos/7/os/x86_64/as Repository URL. This repository URL is one of CentOS mirror, you can find more mirrors here.

Managing Channels and Repositories - Repository Detail
Managing Channels and Repositories – Repository Detail

Assigning a repository to Base channel:

Goto Channels –> Manage Software Channels –> Select the created channel (itzgeek_centos7) –> Repository –> Select the previously created repository –> Update repository.

Managing Channels and Repositories - Adding Repository to Base Channel
Managing Channels and Repositories – Adding Repository to Base Channel

Now its time to sync packages from upstream server, Go to Channels –> Manage Software Channels –> Select the created channel –> Repository –> Sync –> Sync Now.

Managing Channels and Repositories - Sync Base Channel
Managing Channels and Repositories – Sync Base Channel

or

Run below command to sync with upstream server.

# /usr/bin/spacewalk-repo-sync --channel  itzgeek_centos7 --type yum

You can go through sync logs to troublehoot any issues arise during the synchronization.

# cat /var/log/rhn/reposync/reponame.log

Note: The packages will be downloaded from the upstream server will be kept in /var/satellite/ folder of your Spacewalk server. Make sure you have enough space in /var/satellite/ folder.

Once the package synchronization is completed, you can list the packages by going to Channels –> Manage Software Channels –> Select your channel –> Packages –> List / Remove.

Managing Channels and Repositories - Channel Packages
Managing Channels and Repositories – Channel Packages

Create Activation Key:

Goto Systems –> Activation Keys –> Create New Key.

Managing Channels and Repositories -Activation Keys
Managing Channels and Repositories -Activation Keys

Here you can create a activation keys for client subscription, in this page you need to select the base channel ( itzgeek_centos7).

Whenever any client uses this key, the client machine will be automatically subscribed to the created channel. You can create multiple keys; in case you would like to use multiple channels.

Note: Better to leave the key blank for automatic generation.

Managing Channels and Repositories -Create Activation Key
Managing Channels and Repositories -Create Activation Key

You can get a list of activation key by going to Systems –> Activation Keys.

Managing Channels and Repositories - All Activation Keys
Managing Channels and Repositories – All Activation Keys

Creat a Child Channel:

Goto Channels –> Manage Software Channels –> Create New Channel. Enter the Child channel name, label, Parent channel, Architecture, and Channel description etc. Here you must select the Parent channel from the drop down list. Finally, click Create Channel button.

Managing Channels and Repositories - Create a child channel
Managing Channels and Repositories – Create a child channel

Creat a Repository for Child Channel:

Goto Channels –> Manage Software Channels –> Manage Repositories –> Create repository.

Let us create a Nginx repository, Enter the repository name and actual URL.

You can create your own repository.

Managing Channels and Repositories - Create a Nginx repository
Managing Channels and Repositories – Create a Nginx repository

Assigning a repository to Child channel:

Goto Channels –> Manage Software Channels –> Select the child channel.

Managing Channels and Repositories - Adding repository to Child Channel
Managing Channels and Repositories – Adding repository to Child Channel

Goto Repository (TAB) –> Select the created repository (Nginx) –> Update repository.

Managing Channels and Repositories - Adding repository to Child Channel - Updating respoitory
Managing Channels and Repositories – Adding repository to Child Channel – Updating respoitory

In same page, goto Sync (TAB) –> Sync Now or Select a schedule.

Managing Channels and Repositories - Adding repository to Child Channel - Sync
Managing Channels and Repositories – Adding repository to Child Channel – Sync

or

Run below command.

/usr/bin/spacewalk-repo-sync --channel nginx_centos7 --type yum

You can go through sync logs to troubleshoot any issues arise during the synchronization.

# cat /var/log/rhn/reposync/reponame.log

At this stage your Spacewalk server is almost ready to serve packages to the clients.

That’s all. The next tutorial will be on configuring client to use Spacewalk server for updates.

How to install SpaceWalk on CentOS 7 / RHEL 7

 Solution  Comments Off on How to install SpaceWalk on CentOS 7 / RHEL 7
Sep 072015
 
Install Spacewalk
Install Spacewalk

Spacewalk is an open source package and system management solution for RedHat derivative distributions like CentOS, Scientific Linux and Fedora, developed by the spacewalk community. Spacewalk is the upstream project for the source of ​Red Hat Satellite, It is released under GPLv2 license.

Spacewalk provides the web interface to manage and view the updates for the system that are registered with Spacewalk, we can initiate the task such as install, update, inventory, and so on. Here is the small tutorial about installing Spacewalk on CentOS 7 / RHEL 7.

Features:

  • Inventory of the systems
  • Install and Update system packages.
  • Configuring Kick-start installation.
  • Deploy and Manage the configuration files from singe location
  • Start / Stop / Configure the guests.
  • Distribute the content across the multiple Geo graphical location using spacewalk proxy.

Prerequsites

  • Outbound open ports 80, 443
  • Inbound open ports 80, 443, 5222 (only if you want to push actions to client machines) and 5269 (only for push actions to a Spacewalk Proxy), 69 udp if you want to use tftp
  • Storage for database: 250 KiB per client system + 500 KiB per channel + 230 KiB per package in channel (i.e. 1.1GiB for channel with 5000 packages)
  • Storage for packages (default /var/satellite): Depends on what you’re storing; Red Hat recommend 6GB per channel for their channels
  • 2GB RAM minimum, 4GB recommended
  • Underlying (SpaceWalk Server) OS is fully up-to-date.

Environment:

HostName :  server.itzgeek.local

IP Address : 192.168.12.3

OS : CentOS Linux release 7.1.1503 (Core)

Setup Repositories:

Before installing Spacewalk on CentOS, we must configure required repositories for Spacewalk setup.

Lets first setup Spacewalk repository, at the time of writing, latest available Spacewalk version was 2.3.

rpm -Uvh http://yum.spacewalkproject.org/2.3/RHEL/7/x86_64/spacewalk-repo-2.3-4.el7.noarch.rpm

Setup Jpackage Repo:

vi /etc/yum.repos.d/jpackage-generic.repo

Add the following.

[jpackage-generic]
name=JPackage generic
#baseurl=http://mirrors.dotsrc.org/pub/jpackage/5.0/generic/free/
mirrorlist=http://www.jpackage.org/mirrorlist.php?dist=generic&type=free&release=5.0
enabled=1
gpgcheck=1
gpgkey=http://www.jpackage.org/jpackage.asc

Setup EPEL repo on CentOS 7.

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Your Spacewalk server should have a resolvable fully-qualified domain name (FQDN) such as “hostname.domain.com”, to do that; edit /etc/hosts file.

vi /etc/hosts

Modify it according to your environment.

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
# Your Spacewalk Server
192.168.12.3 server.itzgeek.local server

Configure Firewall:

As said in the prerequisites, we need to have outbound port opened. Run the following on terminal to allow the required ports.

firewall-cmd --add-service=http ; firewall-cmd --add-service=https

Add port 5222 if you want to push actions to client machines and 5269 for push actions to a Spacewalk Proxy, 69 udp if you want to use tftp.

Restart firewall service using command:

firewall-cmd --reload

SpaceWalk Database:

SpaceWalk supports PostgreSQL (version 8.4 or higher) or Oracle ( version 10g or higher) as a database for storing its data.

Embedded Database:

Spacewalk has the embedded setup for PostgrSQL database which will do the automatic Spacewalk installation without having user intervention to enter the database information. Embedded database method is very easy to setup and run the Spacewalk in no time; this is very useful for those who do not have any database knowledge.

yum install spacewalk-setup-postgresql

External Database:

You can use the external PostgreSQL or Oracle database to install Spacewalk, you can find the tons of documents online to setup database.

Installing SpaceWalk:

If you are planning use PostgreSQL database (Either Embedded or External PostgreSQL database).

yum install spacewalk-postgresql

If you are planning to use Oracle database.

yum install spacewalk-oracle

Configuring SpaceWalk:

If you have installed embedded database, then use below command. It will ask you to enter the admin mail and organization details to generate the self signed certificate for secured access.

spacewalk-setup --disconnected

if you have setup database manually, then use below commands depend on database type. It will ask you to enter external database details.

Oracle:

spacewalk-setup --disconnected --external-oracle

PostgreSQL:

spacewalk-setup --disconnected --external-postgresql

Since i am using embedded postgresql database, an example session is as follows;

# spacewalk-setup --disconnected

* Setting up SELinux..
** Database: Setting up database connection for PostgreSQL backend.
** Database: Installing the database:
** Database: This is a long process that is logged in:
** Database:   /var/log/rhn/install_db.log
*** Progress: ###
** Database: Installation complete.
** Database: Populating database.
*** Progress: ############################
* Configuring tomcat.
* Setting up users and groups.
** GPG: Initializing GPG and importing key.
** GPG: Creating /root/.gnupg directory
You must enter an email address.
Admin Email Address? [email protected] ## Email Address ##
* Performing initial configuration.
* Activating Spacewalk.
** Loading Spacewalk Certificate.
** Verifying certificate locally.
** Activating Spacewalk.
* Configuring apache SSL virtual host.
Should setup configure apache's default ssl server for you (saves original ssl.conf) [Y]? ## Press Y ##
** /etc/httpd/conf.d/ssl.conf has been backed up to ssl.conf-swsave
* Configuring jabberd.
* Creating SSL certificates.
CA certificate password? ## Enter Certificate Password ##
Re-enter CA certificate password? ## Re Enter Certificate Password ##
Organization? ITzGeek ## Your Organization Name ##
Organization Unit [server.itzgeek.local]? Linux ## Your Organization Unit ##
Email Address [[email protected]]? ## Email Address ##
City? Albany ## Your City ##
State? NY ## Your State ##
Country code (Examples: "US", "JP", "IN", or type "?" to see a list)? US ## Your Country ##
** SSL: Generating CA certificate.
** SSL: Deploying CA certificate.
** SSL: Generating server certificate.
** SSL: Storing SSL certificates.
* Deploying configuration files.
* Update configuration in database.
* Setting up Cobbler..
Cobbler requires tftp and xinetd services be turned on for PXE provisioning functionality. Enable these services [Y]? ## Press Y ##
* Restarting services.
Installation complete.
Visit https://server.itzgeek.local to create the Spacewalk administrator account                                                                                        .

On complete, start the Spacewalk service if not started automatically.

/usr/sbin/spacewalk-service start

Open up your browser and navigate it to https://ip-add-ress or https://your-domain-name.

You will be asked to create administrator account for spacewalk, fill up details and click on Create Login.

Install Spacewalk on CentOS 7 - Create Spacewalk Administrator
Install Spacewalk on CentOS 7 – Create Spacewalk Administrator

Once administrator account is created, it will take you to home page of spacewalk where you can do all administration activities.

Install Spacewalk on CentOS 7 - Overview of Spacewalk
Install Spacewalk on CentOS 7 – Overview of Spacewalk

That’s All!!!, you have sucessfully installed Spacewalk on CentOS 7 / RHEL 7. Next tutorial is about Configuring the SpaceWalk to distribute the updates for CentOS clients.

Setup SysLog Server on CentOS 6 / RHEL 6

 Linux  Comments Off on Setup SysLog Server on CentOS 6 / RHEL 6
Sep 072015
 

Today we will be looking into how to setup a centralized log management for Linux servers, this will help the Linux admin to have a multiple server logs into one single place. The Linux admin not required to login in to each servers for checking the logs, he can just login into the centralized server and start do the logs monitoring.

Linux labels (auth, cron, ftp, lpr, authpriv, news, mail, syslog, etc ,..) the log messages to indicate the type of software that generated the messages with severity (Alert, critical, Warning, Notice, info, etc ,..).

You can find more information on Message Labels and Severity Levels

Make sure you have the following to setup log server.

Two Linux servers ( server and client).

server.itzgeek.local 192.168.0.105

client.itzgeek.local  192.168.0.104

Server setup:

Install syslog package, if you do not have it installed.

[root@server ~]# yum -y install rsyslog

Edit /etc/rsyslog.conf

[root@server ~]# vi /etc/rsyslog.conf

Un comment the following to enable the syslog server to listen on the tcp and udp port.

From

# Provides UDP syslog reception
#$ModLoad imudp
#$UDPServerRun 514
 
# Provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 514

To

# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
 
# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514

Restart the syslog service

[root@server ~]# service rsyslog restart

Verify the syslog server listening.

[root@server ~]# netstat -antup | grep 514
 
tcp        0      0 0.0.0.0:514                 0.0.0.0:*                   LISTEN      8081/rsyslogd
tcp        0      0 :::514                      :::*                        LISTEN      8081/rsyslogd
udp        0      0 0.0.0.0:514                 0.0.0.0:*                               8081/rsyslogd
udp        0      0 :::514                      :::*                                    8081/rsyslogd

Client setup:

Edit /etc/rsyslog.conf

[root@client ~]# vi /etc/rsyslog.conf

At the end of file place the following line to point the client message log to the server

*.info;mail.none;authpriv.none;cron.none   @192.168.0.105

You can either mention hostname or ip address.

Restart the syslog service

[root@client ~]# service rsyslog restart

Now all the message logs are sent to the central server and also it keeps the copy locally.

Firewall Port opening (Optional):

Mostly all the production environment are protected by hardware firewall, ask them to open the TCP & UDP 514. You can verify the port opening by issuing the following command from the client.

[root@client ~]# telnet 192.168.0.105 514
 
Trying 192.168.0.105...
Connected to 192.168.0.105.
Escape character is '^]'.

If it didn’t give any reply, disable firewall on both client and server.

Test:

Monitor the activity from the log server, open the message log.

[root@server ~]# tailf /var/log/messages

Now restart xinetd service on client, Now you can get the service restart message on the syslog server.

Oct 17 15:06:41 client xinetd[4280]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
Oct 17 15:06:41 client xinetd[4280]: Started working: 0 available services

By this way you can monitor the other logs such as secure, mail, cron logs etc.

Install Nginx on CentOS 7 / RHEL 7

 Monitoring  Comments Off on Install Nginx on CentOS 7 / RHEL 7
Sep 072015
 

NGINX

Nginx is a popular lightweight server for those who do not need the bulk and extra services that Apache may offer. This article will look at installing Nginx on a CentOS using the ‘yum’ package manager.

Install Nginx:

To install Nginx using yum we need to include the Nginx repository, install the Nginx repository.

rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

Install the Nginx by issuing the following command.

yum install nginx

Starting Nginx:

Once installed, start the Nginix by using the following command.

systemctl start nginx.service

Once started. Navigate the web browser to Nginx server(IP Address or Host Name). The following image shows the default Welcome Screen of Nginx.

CentOS 7 - Nginx Default Page
CentOS 7 – Nginx Default Page

Extras:

Init scripts will help you to start and stop the service. The init scripts for the Nginx is installed while installing Nginx. However, we need to set up Nginx to start automatically if the server is rebooted:

systemctl enable nginx.

Configuration File:

The name of the default configuration file is nginx.conf, located in /etc/nginx directory. Configuration file is based on directives and parameters, each directive ends with a semi colon. The following shows the directives for worker connection and in which user name Nginx process should run.

user  nginx;
worker_processes  1;
events {
worker_connections  1024;
}

Creating a Virtual Server:

We must setup at least one virtual server for Nginx, in order to process the HTTP request by Nginx. When Nginx process the request,  it looks for the server directive which is placed in http context. You can add multiple server directives, to define multiple virtual servers.

Default virtual server config can be found under /etc/nginx/conf.d directory, if you open and see that; first line itself a virtual server for localhost and listening on port 80.

server {
listen       80;
server_name  localhost;
}

You will find the location directive, which will tell the server to look for the static file when the requests comes for the localhost.

location / {
root   /usr/share/nginx/html;
index  index.html index.htm;
}

Additionally you can mention the error pages.

error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   /usr/share/nginx/html;
}

The above is the minimum configuration for a virtual server, you can find the full configuration here.

Example:

The following virtual server will accept the request for server.itzgeek.com, create a configuration file  in/etc/nginx/conf.d or copy the default configuration file.

cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/itzgeek.conf

Edit in such a way that, it receives the request. Minimal configuration will look like below.

vi /etc/nginx/conf.d/itzgeek.conf
server {
listen       80;
server_name  server.itzgeek.com;
location / {
root   /usr/share/nginx/html/itzgeek;
index  index.html index.htm;
}
}

Create root directory.

mkdir /usr/share/nginx/html/itzgeek

Create Index.html page.

echo “This is ITzGeek Home” > /usr/share/nginx/html/itzgeek/index.html

Restart the Nginx service.

 systemctl restart nginx.service

Test with browser, url will be http://server.itzgeek.com

CentOS 7 - Nginx Virtual Server
CentOS 7 – Nginx Virtual Server

That’s all.

How to install Java SDK 1.8 on RHEL 7/ CentOS 7

 Linux  Comments Off on How to install Java SDK 1.8 on RHEL 7/ CentOS 7
Sep 072015
 

Java

Today we will be looking into the installation of Oracle Java SDK 1.8_u5 on RHEL / CentOS, Java SDK is the most important base to the developers; this guide will be more useful for them to setup development environment when they especially uses Redhat or CentOS.

Download Java SDK:

You can either use command line or browser to download the JDK, better to use the browser, the easiest one. Visit the Oracle SDK page to download. If you still want to use the command line, use the below command.

# wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u11-b12/jdk-8u11-linux-x64.tar.gz
# tar -zxvf jdk-8u11-linux-x64.tar.gz
 
#  mv jdk1.8.0_11/ /usr/

Install Java:

Once moved the java to the desired location, java must setup with the alternatives commands; this will install the java on your system.

# /usr/sbin/alternatives --install /usr/bin/java java /usr/jdk1.8.0_11/bin/java 2
 
# /usr/sbin/alternatives --config java

Select the latest java.

There are 2 programs which provide 'java'.
 
  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51-2.4.5.5.el7.x86_64/jre/bin/java
   2           /usr/jdk1.8.0_11/bin/java
 
Enter to keep the current selection[+], or type selection number: 2

Verify the Java:

Once setup the alternatives, verify the java version installed using the following command.

# java –version
 
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

Setup Environmental Variable:

The most important part has come now, it should be set before the installation of any java based applications.

# export JAVA_HOME=/usr/jdk1.8.0_11/
 
# export JRE_HOME=/usr/jdk1.8.0_11/jre/

Set PATH variable too.

# export PATH=$JAVA_HOME/bin:$PATH

To set it as a permanent, place the above three commands in the /etc/profile (All Users) or .bash_profile (Single User)

That’s All!. Hope this helped, place your valuable comments below.

Install Apache Tomcat 8 on CentOS 7 / RHEL 7

 Linux  Comments Off on Install Apache Tomcat 8 on CentOS 7 / RHEL 7
Sep 072015
 

Tomcat Logo

Apache Tomcat is an open source web server and servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Oracle and provides a “pure Java” HTTP web server environment for running the Java codes. Apache Tomcat includes tools for configuration and management, but can also be configured by editing XML configuration files.

Here is the step by step guide to install Apache Tomcat 8.0 on RHEL 7 / CentOS 7.

Open Terminal.

Switch to root user.

Install OpenJDK:

Tomcat requires to have java installed on your machine, you can either have Oracle JDK or OpenJDK installed on your machine. Here i used the openjdk, lets install openjdk by issuing the following command.

[root@server ~]# yum install java-1.7.0

You can also verify it, by issuing the following command.

[root@server ~]# java -version
java version “1.7.0_65″
OpenJDK Runtime Environment (rhel-2.5.1.2.el7_0-x86_64 u65-b17)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

Download & Setup Apache Tomcat:

Download the latest version of the Apache Tomcat from the website and save it on your home directory.

[root@server ~]# wget http://mirror.nexcess.net/apache/tomcat/tomcat-8/v8.0.9/bin/apache-tomcat-8.0.9.tar.gz

Download the MD5 file.

[root@server ~]# wget --no-check-certificate https://www.apache.org/dist/tomcat/tomcat-8/v8.0.9/bin/apache-tomcat-8.0.9.tar.gz.md5

Verify the md5 check sum of the downloaded Tomcat archive with check sum provided by Apache Tomcat.

[root@server ~]# cat apache-tomcat-8.0.9.tar.gz.md5
82140943a894d582e5b34eff79b8c776 *apache-tomcat-8.0.9.tar.gz
 
[root@server ~]# md5sum apache-tomcat-8.0.9.tar.gz
82140943a894d582e5b34eff79b8c776  apache-tomcat-8.0.9.tar.gz

If both matches, extract the the tomcat on to your desired (/var/local) directory.

[root@server ~]# tar -zxvf apache-tomcat-8.0.9.tar.gz -C /var/local/

Controlling Apache Tomcat:

Apache Tomcat can be started and stopped by the script which comes with package, start the Apache Tomcat.

[root@server ~]# /var/local/apache-tomcat-8.0.9/bin/startup.sh

you will get the following output.

Using CATALINA_BASE:   /var/local/apache-tomcat-8.0.9
Using CATALINA_HOME:   /var/local/apache-tomcat-8.0.9
Using CATALINA_TMPDIR: /var/local/apache-tomcat-8.0.9/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /var/local/apache-tomcat-8.0.9/bin/bootstrap.jar:/var/local/apache-tomcat-8.0.9/bin/tomcat-juli.jar
Tomcat started.

You can verify the service running, by default tomcat runs on port no 8080

[root@server ~]# netstat -antup | grep 8080
tcp        0      0 0.0.0.0:8080                0.0.0.0:*                   LISTEN      2476/java

Open the web browser and point to http://ipaddress:8080

CentOS 7 - Apache Tomcat 8 Default Page
CentOS 7 – Apache Tomcat 8 Default Page

Stop the Apache Tomcat.

[root@server ~]# /var/local/apache-tomcat-8.0.9/bin/shutdown.sh

Managing the Apache Tomcat:

Tomcat can be managed through the web-manager, the following can be done through that.
Deploy new application, deploy new application on specified context, list the active or in active applications, start and stop the web applications.

Web manager is password protected, requires user name and password to access. Only the user with the “manager-gui” role is allowed to access, these users and roles are defined in tomcat-users.xml. By default “manager-gui” role not defined that file, we need to add it manually.

[root@server ~]# vi /var/local/apache-tomcat-8.0.9/conf/tomcat-users.xml

Place the following two lines just above the last line.

<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>

Start the tomcat, now tomcat user have access to the web manager.

CentOS 7 - Apache Tomcat 8 App Manager
CentOS 7 – Apache Tomcat 8 App Manager

Same like, you can define the other roles.

Install Memcached on CentOS 7

 Database  Comments Off on Install Memcached on CentOS 7
Sep 072015
 

Memcached Logo

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.

Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its APIis available for most popular languages.

Here is the simple steps to install Memcached on CentOS 7.

Open Terminal and then switch to root user.

[raj@itzgeek~/]$ su -l

Install Memcached:

Install Memcached using the following command.

[root@itzgeek~/]# yum install memcached

Edit Memcached configuration file to change / enable the features.

[root@itzgeek~/]# vi /etc/sysconfig/memcached

There are some default settings available in the configuration file, change it (if necessary). The following is example settings for 256MB caching.

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="256"
OPTIONS=""

Start Memcached.

[root@itzgeek~/]# systemctl start memcached.service

To auto-start Memcached on booting.

[root@itzgeek~/]#  systemctl enable  memcached.service

Confirm the Memcached running status.

[root@itzgeek~/]# memcached-tool  127.0.0.1:11211 stats
#127.0.0.1:11211   Field       Value
         accepting_conns           1
               auth_cmds           0
             auth_errors           0
                   bytes           0
              bytes_read           7
           bytes_written           0
              cas_badval           0
                cas_hits           0
              cas_misses           0
               cmd_flush           0
                 cmd_get           0
                 cmd_set           0
               cmd_touch           0
             conn_yields           0
   connection_structures          11
        curr_connections          10
              curr_items           0
               decr_hits           0
             decr_misses           0
             delete_hits           0
           delete_misses           0
       evicted_unfetched           0
               evictions           0
       expired_unfetched           0
                get_hits           0
              get_misses           0
              hash_bytes      524288
       hash_is_expanding           0
        hash_power_level          16
               incr_hits           0
             incr_misses           0
                libevent 2.0.21-stable
          limit_maxbytes   268435456
     listen_disabled_num           0
                     pid       12545
            pointer_size          64
               reclaimed           0
            reserved_fds          20
           rusage_system    0.014289
             rusage_user    0.000000
                 threads           4
                    time  1406441667
       total_connections          11
             total_items           0
              touch_hits           0
            touch_misses           0
                  uptime          48
                 version      1.4.15

Iptables entry:

Add the following entry to allow the incoming connection on port no 11211.

firewall-cmd --permanent --zone=public --add-port=11211/tcp

Check the remote connectivity.

[root@itzgeek~/]# echo stats | nc memcache_host_name_or_ip 11211

Install PHP Module:

Install Memcached PHP module to work with PHP5.

[root@itzgeek~/]# yum install php php-pecl-memcache

Now restart the Memcached and Apache server to take effect.

[root@itzgeek~/]# systemctl restart memcached.service
[root@itzgeek~/]# systemctl restart httpd.service

That’s all!

Manage PostgreSQL using phpPgAdmin on CentOS 7

 Database  Comments Off on Manage PostgreSQL using phpPgAdmin on CentOS 7
Sep 072015
 

phpPgAdminphpPgAdmin is a web based administration tool for managing PostgreSQL database, it is very similar in look of phpMyAdmin. If you have a work experience on phpMyAdmin, you wont take much time in finding the way to work with. This guide will help you to setup phpPgAdmin on CentOS 7 / RHEL 7.

Installing phpPgAdmin:

Before installing, take a look at how to install PostgreSQL on CentOS 7. If you have followed PostgrqSQL install, you do not need to steup EPEL.

Here is the link to setup EPEL repository on CentOS 7.

yum -y install phpPgAdmin php-pgsql httpd php

Configuring phpPgAdmin:

Edit  /etc/phpPgAdmin/config.inc.php file, we have to modify the admin file to enable the browser access.

vi /etc/phpPgAdmin/config.inc.php

Add the localhost in the following server parameter.

$conf['servers'][0]['host'] = 'localhost';

If extra login security is true, then logins via phpPgAdmin with no password or certain usernames (pgsql, postgres, root, administrator) will be denied. To enable the postgres login, change it to false.

$conf['extra_login_security'] = false;

To simply hide other databases in the list make following condition to true – this does not in any way prevent your users from seeing other database by other means.

$conf['owned_only'] = true;

Configuring PostgreSQL:

Modify config file to accept the authentication from the remote networks.

vi /var/lib/pgsql/9.3/data/pg_hba.conf

Please enter the value as per your requirements inIPv4 and Ipv6 connections and make sure it accepts md5 passwords.

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
host    all             all             192.168.2.0/24         md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

Configuring Apche:

By-default phpPgAdmin places the web config file in /etc/httpd/conf.d directory; it has the rules and access permission for the web access. In CentOS 7, web access is managed by mod_authz_core.cmodule; so normal allow or deny rules wont work even if you modify.

vi /etc/httpd/conf.d/phpPgAdmin.conf

Default config will look like below.

Alias /phpPgAdmin /usr/share/phpPgAdmin

<Location /phpPgAdmin>
<IfModule mod_authz_core.c>
# Apache 2.4
Require local
#Require host example.com
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</IfModule>
</Location>

Please comment Require local and add Require all granted just below to commented line, it will look like below.

Alias /phpPgAdmin /usr/share/phpPgAdmin

<Location /phpPgAdmin>
<IfModule mod_authz_core.c>
# Apache 2.4
# Require local
Require all granted
#Require host example.com
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</IfModule>
</Location>

Restart the services.

systemctl restart postgresql-9.3.service
 
systemctl restart httpd.service

Accessing phpPgAdmin:

Now access the phpPgAdmin from the browser, url will be http://your-ip-address/phpPgAdmin.

CentOS 7 - phpPgAdmin Home page
CentOS 7 – phpPgAdmin Home page

Login by using postgres user.

CentOS 7 - phpPgAdmin Login page
CentOS 7 – phpPgAdmin Login page

You will get the database page.

CentOS 7 - phpPgAdmin Databases
CentOS 7 – phpPgAdmin Databases

That’s All. Hope this helped you, we welcome your comments.