Linux Tuning Parameters September 28th, 2010
KernelTo successfully run enterprise applications, such as a database server, on your Linux distribution, you may be required to update some of the default kernel parameter settings. For example, the 2.4.x series kernel message queue parameter msgmni has a default value (for example, shared memory, or shmmax is only 33,554,432 bytes on Red Hat Linux by default) that allows only a limited number of simultaneous connections to a database. Here are some recommended values (by the IBM DB2 Support Web site) for database servers to run optimally:
| - kernel.shmmax=268435456 for 32-bit- kernel.shmmax=1073741824 for 64-bit- kernel.msgmni=1024- fs.file-max=8192- kernel.sem=”250 32000 32 1024″ |
Shared Memory
| To view current settings, run command:# more /proc/sys/kernel/shmmaxTo set it to a new value for this running session, which takes effect immediately, run command:# echo 268435456 > /proc/sys/kernel/shmmaxTo set it to a new value permanently (so it survives reboots), modify the sysctl.conf file:…kernel.shmmax = 268435456… |
Semaphores
| To view current settings, run command:# more /proc/sys/kernel/sem 250 32000 32 1024 To set it to a new value for this running session, which takes effect immediately, run command:# echo 500 512000 64 2048 > /proc/sys/kernel/semParameters meaning:SEMMSL – semaphores per IDSEMMNS – (SEMMNI*SEMMSL) max semaphores in systemSEMOPM – max operations per semop callSEMMNI – max semaphore identifiers |
ulimits
| To view current settings, run command:# ulimit -aTo set it to a new value for this running session, which takes effect immediately, run command:# ulimit -n 8800# ulimit -n -1 // for unlimited; recommended if server isn’t shared Alternatively, if you want the changes to survive reboot, do the following: - Exit all shell sessions for the user you want to change limits on.- As root, edit the file /etc/security/limits.conf and add these two lines toward the end: user1 soft nofile 16000 user1 hard nofile 20000 ** the two lines above changes the max number of file handles – nofile – to new settings.- Save the file.- Login as the user1 again. The new changes will be in effect. |
Message queues Read the rest of this entry »
Posted in CentOS, debian, fedora, feebsd, linux, Networking, ubuntu | No Comments »
Manage Time in Ubuntu Through Command Line September 23rd, 2010
Manage Time in Ubuntu Through Command Line
What if you would like to manage your computer’s time in Ubuntu? It’s easy if you are in a graphical desktop environment. But what if you are on the command line? For example, in Ubuntu Server? Well, it is easy as well. A very helpful, everything-in-one-place resource is Ubuntu Time.
View Time
To view the current date and time, the following command will be enough
date
Set Time
To change time means to set a new time. To set time in Ubuntu (or any Linux), just run the following command
sudo date newdatetimestring
where newdatetimestring has to follow the format nnddhhmmyyyy.ss which is described below
- nn is a two digit month, between 01 to 12
- dd is a two digit day, between 01 and 31, with the regular rules for days according to month and year applying
- hh is two digit hour, using the 24-hour period so it is between 00 and 23
- mm is two digit minute, between 00 and 59
- yyyy is the year; it can be two digit or four digit: your choice. I prefer to use four digit years whenever I can for better clarity and less confusion
- ss is two digit seconds. Notice the period ‘.’ before the ss.
Let’s say you want to set your computer’s new time to December 6, 2007, 22:43:55, then you would use:
sudo date 120622432007.55
It couldn’t be any easier, could it? The source of this information was a good post on Ubuntu Forums (Set time/date via command line).
Change Time Zone
You may update or change your time zone by
tzconfig
This command will guide you through the process of setting a new time zone. You may also choose UTC (GMT) if you want.
If your system does not have tzconfig, you may use something else.
tzselect
This will provide a set of different time zones to choose. If you would like to set the time to UTC, choose the option which says something like ‘none of the above’, or ‘none of these’ or something to this effect. In my case it was option 11. Then it asks for difference from UTC (GMT and GST is also the same thing). I chose GST-0 as the option and it set the time as UTC.
Sync Clock Via NTP
If you want to sync your clock with NTP servers, it is also very easy. Just make sure you have the file ntp.conf file in /etc. How can you check it?
ls /etc/ntp.conf
If you see /etc/ntp.conf as a result, you already have that file. If the ls command gives an error, you do not have it. If so, you may create it yourself.
sudo vim /etc/ntp.conf
This file will be used to automatic synchronization of the clock. I do not know if the client uses this file automatically or one has to configure something first.
Whether you have the file already or not, make sure it has at least the following data
driftfile /var/lib/ntp/ntp.drift
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server pool.ntp.org
Here you may replace, add, and/or remove any servers you wish. You will find a list of time servers from the public NTP time server list.
You may manually sync the clock using the following
sudo ntpdate servername
where servername can be any public or private time server. You may always choose the following without hesitation
sudo ntpdate pool.ntp.org
See, it was quite easy. Enabling NTP Services helped me gain this knowledge.
source here
Posted in debian, linux, Networking, ubuntu | No Comments »
How to backup MySQL databases September 23rd, 2010
rm -f /backup/mysql*
### System Setup ###
BACKUP=/backup
NOW=$(date +”%d-%m-%Y”)
### MySQL Setup ###
MUSER=”mysqluser”
MPASS=”password”
MHOST=”localhost”
MYSQL=”$(which mysql)”
MYSQLDUMP=”$(which mysqldump)”
GZIP=”$(which gzip)”
### Start MySQL Backup ###
# Get all databases name
DBS=”$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse ‘show databases’)”
for db in $DBS
do
FILE=$BACKUP/mysql-$db.$NOW-$(date +”%T”).gz
$MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE
done
source here
Posted in CentOS, debian, fedora, feebsd, linux, Networking, ubuntu | No Comments »
setting up a iptables firewall with logwatch on gmail account September 22nd, 2010
Overview
Any basic home router is a combination firewall/switch/wifi device. If you don’t need wifi, you can get much finer-grained control of your home network by buying a low-power computer with 2 ethernet ports to use as your firewall, and then a cheap 4 or 8 port switch to do your switching. This gives you far better control and flexibility.
Here’s how you configure Fedora 10 on a low-power firewall machine.
Install a minimum F10 install on your firewall computer.
Not covered here. As a general rule, use the DVD, use the i386 version (on the assumption that you are using smaller; low-power hardware).
Kernel Settings
Do NOT skip this step or your internal computers will not be able to reach the internet.
Fedora 10 by default does not allow packet forwarding, which is a fantastically sane default setting. However, this needs to be changed for your 2-ethernet-port computer to act as a firewall. Therefore, ensure /etc/sysctl.conf looks like this:
# Kernel sysctl configuration file for Red Hat Linux # # For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and # sysctl.conf(5) for more details. # Controls IP packet forwarding net.ipv4.ip_forward = 1 net.ipv4.icmp_echo_ignore_broadcasts = 1 # Controls source route verification net.ipv4.conf.default.rp_filter = 1 # Do not accept source routing net.ipv4.conf.default.accept_source_route = 0 # Controls the System Request debugging functionality of the kernel kernel.sysrq = 0 # Controls whether core dumps will append the PID to the core filename. # Useful for debugging multi-threaded applications. kernel.core_uses_pid = 1 Read the rest of this entry »
Posted in CentOS, debian, fedora, feebsd, linux, Networking, ubuntu | No Comments »
7 Easy Steps Installation DNS server in Ubuntu Jaunty September 22nd, 2010
DNS (Domain Name Service) server is a server that translate an IP address into a name that will be easy to remember or do the opposite way.
The administrative job is done in Server side. For client side just set the machine to connect the DNS server.
Before we start, I assume that you are connected to Internet already. For, text editor, you can use any program that you are familiar with. In this sample, I use vim.
The installation is as easy as below:
Step 1. Install the bind9
Open Linux Terminal (Applications>Accessories>Terminal), type: sudo apt-get install bind9
Installation finished.

Read the rest of this entry »
Posted in debian, linux, Networking, ubuntu | No Comments »

