Monday, August 17, 2015

How to change a machines hostname in Red Hat 6

There are several ways to change the hostname of a machine running Redhat 6.  These also works on CentOS, Fedora and older/other Redhat variants.

First: The "hostname" command.

You can use the hostname command to see the current host name of the system.

# hostname
bighat.putorius.net


You can also use the hostname command to change the host name of the machine.

# hostname smallhat.putorius.net
Then issue the hostname command again to see the changes.
# hostname
smallhat.putorius.net

This only makes a temporary or non-persistent change of hostname.

Second: The /etc/sysconfig/network configuration file. (preferred method)

In order for the change to survive a reboot, or to make it persistent, you must change it in the /etc/sysconfig/network file.

Open the file in your favorite editor and change the following line to reflect your desired hostname.

HOSTNAME=newname.putorius.net

After making changing to the configuration file you need to restart the network service in order to read that file.

/etc/init.d/network restart
NOTE: Do not do this remotely (via ssh) or you will lose your connection.

If you issue the hostname command now, you will see the hostname has changed. 

Third: The /proc/sys/kernel/hostname entry.
Another simple way to change the hostname is to echo the hostname into the /proc/sys/kernel/hostname file.

echo "bighat.putorius.net" > /proc/sys/kernel/hostname

NOTE: Using the /etc/sysconfig/network file is the preferred method to set the permanent hostname of a system.  Anything in the /proc/sys/kernel/hostname file will be overridden by the /etc/sysconfig/network file during a reboot. 

If you are using Red Hat 7 (RHEL7), CentOS 7 or newed versions of Fedora click below of instructions on changing your hostname.
http://www.putorius.net/2015/04/how-to-change-system-hostname-in-red.html

source page: http://www.putorius.net/2013/09/how-to-change-machines-hostname-in.html 

Sunday, August 16, 2015

How to add new SCSI disk in RedHat OS (under VMware)

To add new SCSI device in RedHat operating system we need to do following steps:

1. Scan system looking for new disks:


echo “- – -” > /sys/class/scsi_host//scan
Parameter can be obtained using command:

ls /sys/class/scsi_host
host0
Our command will be looking :

echo ‘- – -‘ > /sys/class/scsi_host/host0/scan

Then  we can list new disks:
fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1305    10377990   8e  Linux LVM
Disk /dev/sdb: 4294 MB, 4294967296 bytes255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn’t contain a valid partition table
Disk /dev/sdc: 4294 MB, 4294967296 bytes255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn’t contain a valid partition table

We have got two new disks: /dev/sdb and /dev/sdc.
cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: VMware   Model: Virtual disk     Rev: 1.0
Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: VMware   Model: Virtual disk     Rev: 1.0
Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 02 Lun: 00
Vendor: VMware   Model: Virtual disk     Rev: 1.0
Type:   Direct-Access                    ANSI SCSI revision: 02

2. Create partition table and filesystem on new disks:

To create partitions we will use fdisk command:
fdisk /dev/sdb
Then we can choose : n,p,1,w for create new primary partition on disk /dev/sdb
To create filesystem we will use command mkfs.ext3:
mkfs.ext4 /dev/sdb1

mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
524288 inodes, 1048233 blocks
52411 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1073741824
32 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

3. Create mount points and modify fstab file:

We are creating folders where new filesystems will be mounted:

mkdir /u01
mkdir /oradb

then, we are adding following lines to /etc/fstab file :
/dev/sdb1               /u01                    ext3    defaults        1 2
/dev/sdc1               /oradb                  ext3    defaults        1 2
and use command mount to mount new filesystems:
mount -a
We can check if we can see them under os:
df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
7.7G  5.8G  1.6G  79% /
/dev/sda1              99M   13M   82M  14% /boot
tmpfs                      502M     0  502M   0% /dev/shm
/dev/sdb1             4.0G   73M  3.7G   2% /u01
/dev/sdc1             4.0G   73M  3.7G   2% /oradb

To add single device called i.e. /dev/sdb we need to use command:
echo “scsi add-single-device ” > /proc/scsi/scsi
where:
H – host
B – bus(channel)
T – target(id)
L – lun number
in our case:
echo “scsi add-single-device 0 0 2 0″ > /proc/scsi/scsi

Original source: http://www.admindot.eu/index.php/how-to-add-new-scsi-disk-in-redhat-os-under-vmware/ 

Thursday, August 6, 2015

How To Install and Manage RabbitMQ

How To Install and Manage RabbitMQ

Tags: Messaging Distribution: CentOSDebianUbuntu

Introduction

Putting things off for a while instead of immediately doing them can be considered lazy. In fact, most of the time it probably is. However, there are times when it’s absolutely the right thing to do. Occasionally, one needs to delay a time-consuming job for a while; it needs to be queued for future execution so that something more important can be dealt with. For this to happen, you need a broker: someone who will accept messages (e.g. jobs, tasks) from various senders (i.e. a web application), queue them up, and distribute them to the relevant parties (i.e. workers) to make use of them - all asynchronously and on demand.
In this DigitalOcean article, we aim to introduce you to the RabbitMQ project: an open-source message-broker application stack which implements the Advanced Message Queuing Protocol (AMQP) to handle the entirety of the scenario we explained above.

Messaging, Message Brokers and Queues

Messaging is a way of exchanging certain data between processes, applications, and servers (virtual and physical). These messages exchanged, helping with certain engineering needs, can consist of anything from plain text messages to blobs of binary data serving to address different needs. For this to work, an interface managed by a third party program (a middleware) is needed… welcome Message Brokers.
Message Brokers are usually application stacks with dedicated pieces covering the each stage of the exchange setup. From accepting a message to queuing it and delivering it to the requesting party, brokers handle the duty which would normally be much more cumbersome with non-dedicated solutions or simplehacks such as using a database, cron jobs, etc. They simply work by dealing with queues which technically constitute infinite buffers, to put messages and pop-and-deliver them later on to be processed either automatically or by polling.

Why use them?

These message brooking solutions act like a middleman for various services (e.g. your web application). They can be used to greatly reduce loads and delivery times by web application servers since tasks, which would normally take quite bit of time to process, can be delegated for a third party whose sole job is to perform them (e.g. workers). They also come in handy when a more "guaranteed" persistence is needed to pass information along from one place to another.

When to use them?

All put together, the core functionality explained expands to cover a multitude of areas, including-but-not-limited-to:
  • Allowing web servers to respond to requests quickly instead of being forced to perform resource-heavy procedures on the spot
  • Distributing a message to multiple recipients for consumption (e.g. processing)
  • Letting offline parties (i.e. a disconnected user) fetch data at a later time instead of having it lost permanently
  • Introducing fully asynchronous functionality to the backend systems
  • Ordering and prioritising tasks
  • Balancing loads between workers
  • Greatly increase reliability and uptime of your application
  • and much more

RabbitMQ

RabbitMQ is one of the more popular message broker solutions in the market, offered with an open-source license (Mozilla Public License v1.1) as an implementation of Advanced Message Queuing Protocol. Developed using the Erlang language, it is actually relatively easy to use and get started. It was first published in early 2007 and has since seen an active development with its latest release being version 3.2.2 (December 2013).

How does it work?

RabbitMQ works by offering an interface, connecting message senders (Publishers) with receivers (Consumers) through an exchange (Broker) which distributes the data to relevant lists (Message Queues).
APPLICATION       EXCHANGE        TASK LIST        WORKER
   [DATA] -------> [DATA] ---> [D]+[D][D][D] --->  [DATA]
 Publisher        EXCHANGE          Queue         Consumer 

How is it different than the others?

RabbitMQ, unlike some other solutions, is a fully-fledged application stack (i.e. a message broker). It gives you all the tools you need to work with, instead of acting like a framework for you to implement your own. Being extremely popular, it is really easy to get going using RabbitMQ and to find answers to your questions online.

Advanced Message Queuing Protocol (AMQP) in Brief

AMQP is a widely accepted open-source standard for distributing and transferring messages from a source to a destination. As a protocol and standard, it sets a common ground for various applications and message broker middlewares to interoperate without encountering issues caused by individually set design decisions.

Installing RabbitMQ

RabbitMQ packages are distributed both with CentOS / RHEL & Ubuntu / Debian based systems. However, they are - like with most applications - outdated. The recommended way to get RabbitMQ on your system is therefore to download the package online and install manually.
Note: We will be performing our installations and perform the actions listed here on a fresh and newly created VPS due to various reasons. If you are actively serving clients and might have modified your system, in order to not break anything working and to not to run into issues, you are highly advised to try the following instructions on a new system.

Installing on CentOS 6 / RHEL Based Systems

Before installing RabbitMQ, we need to get its main dependencies such as Erlang. However, first and foremost we should update our system and its default applications.
Run the following to update our droplet:
yum -y update
And let's use the below commands to get Erlang on our system:
# Add and enable relevant application repositories:
# Note: We are also enabling third party remi package repositories.
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

# Finally, download and install Erlang:
yum install -y erlang
Once we have Erlang, we can continue with installing RabbitMQ:
# Download the latest RabbitMQ package using wget:
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.2.2/rabbitmq-server-3.2.2-1.noarch.rpm

# Add the necessary keys for verification:
rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc

# Install the .RPM package using YUM:
yum install rabbitmq-server-3.2.2-1.noarch.rpm

Installing on Ubuntu 13 / Debian 7 Based Systems

The process for downloading and installing RabbitMQ on Ubuntu and Debian will be similar to CentOS due to our desire of having a more recent version.
Let's begin with updating our system's default application toolset:
apt-get    update 
apt-get -y upgrade
Enable RabbitMQ application repository:
echo "deb http://www.rabbitmq.com/debian/ testing main" >> /etc/apt/sources.list
Add the verification key for the package:
curl http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key add -
Update the sources with our new addition from above:
apt-get update
And finally, download and install RabbitMQ:
sudo apt-get install rabbitmq-server
In order to manage the maximum amount of connections upon launch, open up and edit the following configuration file using nano:
sudo nano /etc/default/rabbitmq-server
Uncomment the limit line (i.e. remove #) before saving and exit by pressing CTRL+X followed with Y.

Managing RabbitMQ

As we have mentioned before, RabbitMQ is very simple to get started with. Using the instructions below for your system, you can quickly manage its process and have it running at the system start-up (i.e. boot).

Enabling the Management Console

RabbitMQ Management Console is one of the available plugins that lets you monitor the [RabbitMQ] server process through a web-based graphical user interface (GUI).
Using this console you can:
  • Manage exchanges, queues, bindings, users
  • Monitor queues, message rates, connections
  • Send and receive messages
  • Monitor Erlang processes, memory usage
  • And much more
To enable RabbitMQ Management Console, run the following:
sudo rabbitmq-plugins enable rabbitmq_management
Once you've enabled the console, it can be accessed using your favourite web browser by visiting:http://[your droplet's IP]:15672/.
The default username and password are both set “guest” for the log in.
Note: If you enable this console after running the service, you will need to restart it for the changes to come into effect. See the relevant management section below for your operating system to be able to do it.

Managing on CentOS / RHEL Based Systems

Upon installing the application, RabbitMQ is not set to start at system boot by default.
To have RabbitMQ start as a daemon by default, run the following:
chkconfig rabbitmq-server on
To start, stop, restart and check the application status, use the following:
# To start the service:
/sbin/service rabbitmq-server start

# To stop the service:
/sbin/service rabbitmq-server stop

# To restart the service:
/sbin/service rabbitmq-server restart

# To check the status:
/sbin/service rabbitmq-server status

Managing on Ubuntu / Debian Based Systems

To start, stop, restart and check the application status on Ubuntu and Debian, use the following:
# To start the service:
service rabbitmq-server start

# To stop the service:
service rabbitmq-server stop

# To restart the service:
service rabbitmq-server restart

# To check the status:
service rabbitmq-server status
And that's it! You now have your own message queue working on your virtual server.

Configuring RabbitMQ

RabbitMQ by default runs with its standard configuration. In general, it does not require much tempering with for most needs as long as everything runs smoothly.
To learn about configuring it for custom needs, check out its documentation for Configuration.
Source: https://www.digitalocean.com/community/tutorials/how-to-install-and-manage-rabbitmq 
Submitted by: O.S. Tezer

s

Monday, August 3, 2015

How to bring back the Start menu and button to Windows 8

With Windows 10 seemingly just around the corner, Microsoft plans to fix one of its most egregious mistakes with Windows 8: the missing Start menu. By now you may know the story, as the company has gradually backtracked throughout various updates since the OS launched in late 2012. And Windows 10 will bring the real thing back, albeit in an enhanced fashion that doesn’t depend on fiddly per-user shortcuts and extra folders.
The thing is, unless you’re willing to experiment with Windows 10 Technical Preview, the new version won’t help you yet. For several years now, every Windows desktop and laptop sold in a store comes with Windows 8. While Windows 8.1 Update somewhat improves the situation, it’s still no Windows 7 when it comes to ease of use.
Here’s the problem, in a nutshell: Let’s say you’ve just installed Windows 8.1 for the first time, or perhaps bought your first Windows 8 PC. After poking around for a bit you’ve finally found your way to the desktop. In the bottom left corner, you’ll see what looks like the Start button, but when you click it, you’ll be rewarded with a hideous new Start screen, not the Start menu that you know and love from Windows 7 and Vista. For some reason, despite the aforementioned series of updates over the last two years that are meant to make Windows 8 more user friendly for mouse-and-keyboard users, Microsoft is still forcing us to use the Metro interface instead of a real Start menu.
The good news is, despite Microsoft’s best efforts to ensure that the Start button and menu remain banished from its new OS, there are a bunch of third-party Windows 8 Start menu replacement apps that you can download today. Really, it goes to show how devoted the existing user base is. Microsoft completely stripped out the underlying Start menu code to quash potential Luddite revolutionaries, and yet now there are dozens of Start menu and Start button replacements — some of which are even superior to Microsoft’s own Windows 7 Start menu.
If you’re running Windows 8.1 today and want the Start menu back, take a look at our list of the best, least expensive, and most authentic Windows 8 Start menu replacements.

Windows 8 Start button and menu replacements

Start Menu Reviver

Start Menu Reviver 2

Start Menu Reviver 2 is a touch-screen-friendly option — one of the few that is, considering most people want the original Start menu back because they’re used to a keyboard and mouse. In this case, the new version is nicer, with plenty of sizing options and the ability to create shortcuts for documents, music, video, websites, and other tasks. It also embraces the Windows 8 tile design, without completely taking over the UI the way Windows 8 Metro does. It now includes scrolling tiles and a Windows 7-like mode as well.
ViStart

ViStart

ViStart is one of the most customizable Start menu restorers for Windows 8, and lets you choose from a variety of skins. ViStart includes a blurred, translucent menu that integrated well with Windows 8, as well as a Windows 7-like Start Menu skin that we imagine some people will want to head straight for. It also speeds up program launches thanks to built-in indexing, and advertises a faster-than-Windows-7 search option for your local PC.
Windows 8 Start menu replacement: StartIsBack

StartIsBack

If you want a Windows 8 Start menu replacement that looks exactly like Windows 7,StartIsBack is for you. You get the same Start button orb icon, the same Start menu search box, the same jump lists, and — for better or worse — even the same Aero transparency. As you can see in the screenshot above, StartIsBack even detects if your system needs to restart to apply some patches; it really is just like the Windows 7 Start menu. Where StartIsBack diverges from the Windows 7 Start menu, though, is configurability: You can adjust which hot corners are enabled, make your PC jump straight to the Desktop when it first boots up, and configure a key combo to show the Windows 8 Start screen (Win+Ctrl by default).
Download StartIsBack ($3, free 30-day trial)
Windows 8: Pokki Start menu replacement

Pokki

Where StartIsBack tries to replicate the Windows of yesteryear, Pokki (free) is very much its own beast — and as much as we love the Windows 7 Start menu, we have to admit that Pokki is probably even better. It utilizes a neat “pinning” system that isn’t unlike the home screen of your smartphone or tablet. You can also add widgets to Pokki, such as Gmail or Facebook, which display your latest email or status updates. By default, Pokki will configure your Windows 8 system to boot straight to the Desktop — and there is an option that will just completely disable the hot corners, if you so desire. (Remember, Win+C pops open the Charms menu, if you need.)