Instaling pip command on CentOS

Enable the epel repository and run:

yum install python-pip to get:

yum install python-pip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.nexcess.net
* epel: mirror.sfo12.us.leaseweb.net
* extras: centos.sonn.com
* updates: centos.sonn.com
Resolving Dependencies
--> Running transaction check
---> Package python-pip.noarch 0:7.1.0-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

Tags:

Creating a patch file with diff command

To create a patch file simply run:

diff -u functions.php.orig functions.php > a.patch

Tags:

Rename network interface back to old "eth0" on Fedora/RHEL/CentOS

The easiest way to restore the old way Kernel/modules/udev rename your ethernet interfaces is supplying these kernel parameters to Fedora 19:

net.ifnames=0
biosdevname=0

To do so follow this steps:

  1. Edit /etc/default/grub
  2. At the end of GRUB_CMDLINE_LINUX line append "net.ifnames=0 biosdevname=0"
  3. Save the file
  4. Type "grub2-mkconfig -o /boot/grub2/grub.cfg"
  5. Type "reboot"

Removing the RAID metadata

If you see the “Disk contains BIOS metadata, but is not part of any recognized BIOS RAID sets. Ignoring disk sda” error message during OS installation, then you need to remove the raid metadata the “classic” way:

dmraid -r -E /dev/sda
Do you really want to erase "pdc" ondisk metadata on /dev/sda ? [y/n] :
y

Postfix: Sender address rejected: Domain not found (in reply to RCPT TO command))

If you are trying to send emails from a local application on a CentOS machine that is not a primary mail server, then you might hit the

Sender address rejected: Domain not found (in reply to RCPT TO command))
error. In this case you need to rewrite the outgoing address that is being rejected to something that make sense with the proper domain for the users.

Here are the quick steps to accomplish this:


nano /etc/postfix/main.cf

Modify the "mydomain" variable to your email domain

Pear doesn't work properly after upgrade to PHP 5.6

After upgrade to PHP 5.6 Pear stopped to work properly giving lot's of "Download of "pear/package_name" succeeded, but it is not a valid package archive". To fix this I had to:


# pear upgrade Archive_Tar
downloading Archive_Tar-1.4.0.tgz ...
Starting to download Archive_Tar-1.4.0.tgz (x bytes)
.......done: x bytes
could not extract the package.xml file from "/tmp/pear/download/Archive_Tar-1.4.0.tgz"
Download of "pear/Archive_Tar" succeeded, but it is not a valid package archive
Error: cannot download "pear/Archive_Tar"
Download failed
upgrade failed

Tags:

How to keep a detailed audit trail of what’s being done on your Linux systems

Intrusions can take place from both authorized (insiders) and unauthorized (outsiders) users. My personal experience shows that unhappy user can damage the system, especially when they have a shell access. Some users are little smart and removes history file (such as ~/.bash_history) but you can monitor all user executed commands.It is recommended that you log user activity using process accounting. Process accounting allows you to view every command executed by a user including CPU and memory time.

Migrate files and directories between two remote servers with rsync and progress bar

To push an archive file from local to remote server with progress bar use:


rsync --rsh -av -e 'ssh -p #####' --progress --partial file.tgz [email protected]:/backup

To push the content of the directory from local to remote server recursively with progress bar use:


rsync -avz -e 'ssh -p #####' --progress --partial localdirectory/ [email protected]:/backup/

Tags:

Ubuntu Software RAID 1 on EFI

- Use the "manual" partitioning option during install.

- For each of your disks, delete the partition table, and then "automatically partition" the free space. There might be some 1 MB space left at the beginning and at the end of the automatically created partitioning table, just ignore them.

- Modify the automatically generated partition table: use the ext4 and swap partition as "physical RAID devices".

Tags:

Mdadm Cheat Sheet

Mdadm is the modern tool most Linux distributions use these days to manage software RAID arrays; in the past raidtools was the tool we have used for this. This cheat sheet will show the most common usages of mdadm to manage software raid arrays; it assumes you have a good understanding of software RAID and Linux in general, and it will just explain the commands line usage of mdadm. The examples bellow use RAID1, but they can be adapted for any RAID level the Linux kernel driver supports.

Pages

Subscribe to Front page feed