How to Change the Timezone in Linux
- Logged in as root, check which timezone your machine is currently using by executing `date`. You’ll see something like Mon Nov 9 13:49:01 EST 2009, PST in this case is the current timezone.
- Change to the directory /usr/share/zoneinfo here you will find a list of time zone regions. Choose the most appropriate region, if you live in Hong_Kong or the Singapore this directory is the “Asia” directory.
Install bandwidth monitor vnstat
vnStat is a network traffic monitor for Linux that keeps a log of daily network traffic for the selected interface(s). vnStat isn’t a packet sniffer. The traffic information is analyzed from the /proc -filesystem, so vnStat can be used without root permissions. However at least a 2.2.x kernel is required.
- Install vnStat
wget http://humdi.net/vnstat/vnstat-1.7.tar.gz
tar zxvf vnstat-1.7.tar.gz
cd vnstat-1.7
make
make install
How to install winrar on CentOS
Rar is one of the common file format use for data compression and archiving. What happen if you have a rar file in Linux ? Don’t panic, just using the ‘rar’ program .There is some intro in Unrar the File.
Today I had to install rar support to archive and split large files. I’ve tried to download an rar from rarlab site
wget http://www.rarlab.com/rar/rarlinux-3.9.b2.tar.gz
Extract it:
tar -xf rarlinux-3.8.0.tar.gz
cd rar
Copy rar & unrar files to /usr/bin:
cp rar unar /usr/bin Read more…
How to open winrar files with Linux
Introduction
To open RAR (those created with winrar) you will need unrar. There are lots of sites now providing files packaged under the rar format.
So you will need first to install unrar on your systems and therefore be able to list content and unpack the files into your hard disk to be able to work with them.
Installation unrar on Debian / Ubuntu
apt-get install unrar
Installation unrar on Fedora / Centos
Be sure to have rpmforge repository enabled on CentOS
yum install unrar
Using unrar
To read the contents of the file.
unrar l [filename.rar]
Read more…
How To remote backup with rsync
This is probably the simply way to backup data to other server using a secure protocoal an minimum bandwidh.
Note:
BackupServer.com – Is the backup server
MainServer.com – Is the server you want to backup
- Login to the server you want to backup
- Creating a key with the ssh-keygen utility:
ssh-keygen -t rsa -N '' (these are two single quotes) - Copy RSA encryption key to the backup server:
scp ~/.ssh/id_rsa.pub username@backupserver.com:keys/server1
ssh username@backupserver.com mergekeys
How To Secure /tmp and /dev/shm partition
Keep you server clean of rookits is a good idea to get a good security level. A sysadministrator can create a seperate partition for /tmp and mount it with noexec and nosuid parameters. And to do it is not necessary to reboot or repartition your drive.
1. First you should secure /tmp:
Read more…
System Tuning Info for Linux Servers
NOTE: Most of the info on this page is about 3 years, and one or two kernel versions out of date.
This page is about optimizing and tuning Linux based systems for server oriented tasks. Most of the info presented here I’ve used myself, and have found it to be beneficial. I’ve tried to avoid the well tread ground (hdparm, turning off hostname lookups in apache, etc) as that info is easy to find elsewhere.
Some cases where you might want to apply some of benchmarking, high traffic web sites, or in case of any load spike (say, a web transfered virus is pegging your servers with bogus requests)
Read more…
All about Linux swap space
As well as the swap partition, Linux also supports a swap file that you can create, prepare, and mount in a fashion similar to that of a swap partition. The advantage of swap files is that you don’t need to find an empty partition or repartition a disk to add additional swap space.
To create a swap file, use the dd command to create an empty file. To create a 1GB file, type:
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
/swapfile is the name of the swap file, and the count of 1048576 is the size in kilobytes (i.e. 1GB).
Prepare the swap file using mkswap just as you would a partition, but this time use the name of the swap file:
mkswap /swapfile
Read more…
E-mail Alert on Root SSH Login
Want to be notified instantly when someone logs into your server as root? No problem, check out this nice tutorial on email notification for root logins. Keeping track of who logs into your server and when is very important, especially when you’re dealing with the super user account. We recommend that you use an email address not hosted on the server your sending the alert from.
So lets get started!
Read more…
Command archiving and extracting files .tar.gz
- Create a .tar.gz file from a folder:
tar czf /path/to/output/folder/filename.tar.gz /path/to/folder - Extract a .tar.gz file:
gunzip -c /path/to/folder/filename.tar.gz - View a list of all files in a .tar.gz archive:
gunzip -c /path/to/folder/filename.tar.gz | tar -tvf - - Extract a single file from a .tar.gz file:
gunzip -c /path/to/folder/filename.tar.gz | tar -xvf - path/within/archive/filename.html