system admin

The best linux copy and backup method: Rsync vs cp

I need a method I can make a backup from my laptop. I used a USB HDD for that and linux prompt.

1. step: Make an initial copy of your data

So, after i mount my USB HDD I used first time the cp command of course.

Blog categories:  Linux  Unix admin

How to convert your real system to virtual machine?

I had a real Linux server system that I need to convert into virtual server, because I wanted to sell my old hardware, but I needed the system as backup. This backup is able to run as virtual server. This is a very useful backup method. This tutorial show you how you can convert your whole system into virtualbox system. Virtualbox is a free opensource virtual computer solution from Oracle.

1. Backup your system disk

If you can, put your system disk to another computer. But if you can't do it you can do it the original system.

SATA HotPlug and HostSwap in Ubuntu Linux

Check active scsi devices:

ubuntu@ubuntu:~$ lsscsi
[1:0:1:0]    disk    ATA      SAMSUNG HD103SJ  1AJ1  /dev/sda
[2:0:0:0]    disk    ATA      SAMSUNG HD103SJ  1AJ1  /dev/sdb
[3:0:0:0]    cd/dvd  HL-DT-ST DVDRAM GH22NS90  HN00  /dev/sr0
[5:0:0:0]    disk    Generic  STORAGE DEVICE   9451  /dev/sdd
[6:0:0:0]    disk    GT-I5700  - Card                /dev/sdc

Now refresh SCSI devices. Use this command to refresh host0 (or host1, host2, host3):

ubuntu@ubuntu:~$ echo "- - -" | sudo tee -a /sys/class/scsi_host/host0/scan 

Check the result:

SSH port forwarding in nutshell

My goal:
I want to see the intranet website from home with my linux laptop. I can connect over SSH to the intranet web server. But I want to see the webpage in a browser of my laptop.

The solution is SSH port forwarding. From my Linux laptop. Here is the syntax:

ssh -L <myPortNumber>:<RemoteIP>:<RemotePort>  <host> [other ssh options like port and user]

I used this:

ssh -L 8088:  intranetserver.example.com

Now I can click to http://localhost:8088/ on my favorite browser and I can browse the intranet.

Blog categories:  Linux  Unix admin

RMagick install on Ubuntu 10.10 and 10.04

This small tutorial work on Ubuntu Hardy (8.04), Lucid 10.04 and Maverick (10.10)

Install Imagemagick and GraphicsMagick

apt-get install imagemagick graphicsmagick

Install Image Magick development files

apt-get install libmagickcore-dev libmagickwand-dev
gem install rmagick

On Hardy:
Install imagemagick from source and after it install development files:

Blog categories:  Linux  Unix admin

How to install Phusion Passenger for ruby 1.9.2

There are some easy steps to install Phusion Passenger for ruby 1.9.2 and apache2 on Ubuntu Linux.

1. Install rvm system wide

sudo bash < <( curl -L http://bit.ly/rvm-install-system-wide )

2. Install ruby 1.9.2

rvm install 1.9.2

3. add new line in /etc/bash.bashrc

[[ -s /usr/local/lib/rvm ]] && . /usr/local/lib/rvm

4. install passenger

sudo -i # you need root shell
rvm use 1.9.2-p0@global # or your version, use: rvm list

How to rotate your screen in Linux

This blog entry show you how to use pivot or portre mode on your LCD monitor under Linux. I know the way that NVidia card owners can rotate their screen. You have to use official NVidia driver for this method.

Blog categories:  Linux

Reject 98% of SPAM with Postfix configuration rules

My spam traffic has decreased to minimum after I've inserted following lines in /etc/postfix/main.cf file (Postfix main configuration file). These settings made my SMTP server to spam resist. This method use DNS queries, what mean very fast UDP communication and use less memory and CPU then any spamfilter. If your hardware is weak or an all-in-one server than use this really fast and effective method.

Before: I received 200-300 spam a day.
Now: I receive only 1-2 unsolicited email a day.

Blog categories:  Linux  Unix admin

2 methods of Google-friendly 301 redirection: PHP, Apache .htaccess

Google dont't like indexing a duplicated content. Have you got more domains that point to the same content? Is your site available at www and non-www version of the domain? (example: www.bitprison.net and bitprison.net point to same content) More domain point to my blog: bitprison.com, bitprison.net, bitprison.org and bitprison.hu. I need a solution for avoid duplicated content. I've chosen 301 redirection that google recommends for webmaters in case of duplicated content. It may help Google to determine PageRank for your site more accurately.

Now I'm sharing with you two ways of redirection.

Blog categories:  Programming  Linux