RSS

  • YouTube
  • LinkedIn
  • Google

Archives for : Linux

How to clear deferred messages from Postfix Queue

Today I was watching the log file from Postfix (in CentOS 6.X default is /var/log/maillog) and saw a lot of messages being deferred.

and these messages did repeat from time to time.

Continue Reading >>

How to fix date / time on Centos 6.X for your timezone even in logfiles

Today I came across a problem when using the Fail2ban that help me so much to keep my server online even under brute-force attack.

One of my filters were not barring the several attempts to authenticate to a my services although it was fine. I decided to increase the Findtime the common configuration and it began to block.

So it was time to understand why with a findtime down he couldn't spread. I began to check in detail the settings and I realized that even though I changed the time for my timezone to the official schedule of Brasilia, the logs continued to display the schedule in UTC. Suspected that it could be this and decided to change the schedule that is placed in the logs (/var/log/messages).

Bingo!

After the change, and confirm that the logs were using the same schedule that the reported in date changed the findtime to values which wanted and everything worked as expected.

Follow the recipe to change the schedule.

Timezone information are on file /etc/localtime and if he's not on what you want simply replaces him for what he wants and that is present in /usr/share/zoneinfo/. In my case, how I wish the schedule of Brasília, I used /usr/share/zoneinfo/America/Sao_Paulo.

Now just try using the date command and check the output should be something like:

Even after these changes, the logs will continue to have the time the old-fashioned way. To change this edit the file /etc/sysconfig/clock and add the following lines to also reflect your timezone.

In my case, I had to restart the server for the changes to surtissem effect but just restarting the rsyslog service already solve.

See you!.

How to fix LOCALE error on Debian Linux/Ubuntu

Today I had to look at the logs to an FTP server that runs under the pure-ftp and I realized that the timetables were all in UTC .
As I needed to send part of the logs to a third party that makes use of it and are not familiar with systems, could end up taking place some misunderstanding. I decided then that should keep the logs of all the applications on Brazilian time zone.
According to the documentation of the pure-ftp it uses environment variables to determine which will be the schedule included in the logs

Continue Reading >>

Creating PostgreSQL database with different encoding

How to create a database UTF8 in a server in LATIN1 or creating a LATIN1 database on a server into UTF8?

PostgreSQL has these things. It does not allow the creation of databases with different Encoding in a same template.
Today I tried to create a new database in UTF8 and came across the following:

This is because the locale of the S.. are in latin1 and when PostgreSQL was installed it absorbs this setting.
When I tried to install in an encoding other than the default set he complained for not being in accordance with the default template that is the template1.

Continue Reading >>

How to decrease the size of VMDK virtual disks-part 3

If you want to read the part 1 This tutorial, Click here.
If you want to read the part 2 This tutorial, Click here.

In the previous item made a cloning a disk with a single partition. In the next lines I'll show you how I cloned a disk with a single partition primary and logic for two primary partitions and a logic with a mount point for the swap that originally was in a file.

NOTE: I did use information from this site, to solve problems with the new boot disk. Do as I, always cite your sources.

Using as a basis the information of part 1 This tutorial, We will add a new disk to the virtual machine.

Continue Reading >>

Como diminuir o tamanho de discos virtuais VMDK –; part 2

If you haven't read the part 1, You can access it here.

Continuing the tutorial, We will now start the cloning of disks. The first part of the cloning is a disk that does not contain the operating system. If you want to go straight to the cloning system bootable, You can skip this part and go straight to the part 3.

Time to start cloning. We start the virtual machine in terminal mode (for if you have graphical environment) and login as root or we become root with the command su –; to be able to execute the instructions of partitioning, formatting and cloning, respectively without the need for sudo all command.

In terminal type fdisk-l for list disks and partitions:

Note that our disks appear as being /dev/sda, /dev/sdb, /dev/sdc (I marked in red to make it more visible) and beside its size. That order the, b, (c) is the connection order on IDE port. As our record was included in the Secondary Slave and on Primary Slave is the CDROM (see image on the 1) He is the third system disk, IE, o /dev/sdc.
We will from now on to partition and format the drive. Type the command Fdisk/dev/sdc.

Continue Reading >>

Como diminuir o tamanho de discos virtuais VMDK –; part 1

Where I work we have a few database servers PostgreSQL in different virtual machines running on a VMWare Server. So far so good, It wasn't a detail that was bothering me. All of them using old versions as 8.1 and 8.2, While the current version is the 9.3.
I sought to know and found out that there are version 9.3 for Centos 6.5 that's what we're using for the new servers and decided then unify the three servers in one.

Se você que leu até aqui e pensou “;Unify servers?? That Buro! give zero for him!; know that it was thought and our reality is an appropriate solution.

That said, and with the dilemma resolved, I set out to create a VM using the Vagrant.

The Vagrant is an excellent tool to help us Devops. With the use of it can create machines that can be easily shared among the members of a team. I won't go into the details of its use, just to inform you that I used a Box of Centos 6.5 Basic.

Until here everything was going very well. Set up the VM and installed the software that would use, including PostgreSQL 9.3.

When I went to migrate the production base started some problems. The PGDATA directory, that's where PostgreSQL stores the data in tables, I was with more than 40 GB. Do a dumpall and a Restore on-the-fly was not an option and decided to extract the whole Bank to later restore the VM.

Continue Reading >>

Error when starting Amavisd-new

Two days ago I'm trying to install the software for my new server that will host this blog, my personal projects and my e-mail server.
I'm using as a base this HOWTO.

I had a lot of problems in installation and in particular an error when starting Amavisd-new

Googando I saw different ways to solve and no work. That's when I realized something silly, but that's making perfect sense. The packages mentioned, Perl-Mail-DKIM and perl-Crypt-OpenSSL-RSA., pointed to EL5 while the package Amavis pointed to EL6.
Checked that the DAG of rpmforge was using EL5 and correct for my Centos 6.3 was to use the DAG EL6. To correct this item and update packages, VOI-la. Everything worked beautifully.

Follow the steps to the fix

first import the key for the repository
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Then uninstall the current (use yum search rpmforge-release to find out the correct name of the package), Download the RPM file and make the installation.

> yum remove rpmforge-release-0.5.2-2.el5.rf.x86_64
> wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
> rpm -i rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

The last step is to synchronize the distribution, that will cause the packages to be replaced by existing in EL5 EL6.
> yum distribution-synchronization

From this point, If there is already done the installation of all packages previously, they should not show this error.

I hope it helped you.

Useful links
http://wiki.centos.org/AdditionalResources/Repositories/RPMForge#head-f0c3ecee3dbb407e4eed79a56ec0ae92d1398e01