03 Sep

Adding disk quota’s to FreeBSD

Recompile your kernel with the following option:

options        QUOTA
(For help on recompiling your kernel see diffrent entry in this database)

Add the below entry to your /etc/rc.conf file:

enable_quotas=”YES”

Finally you will need to edit /etc/fstab to enable disk quotas on a per-file system basis. This is where you can either enable user or group quotas or both for all of your file systems.

To enable per-user quotas on a file system, add the userquota option to the options field in the /etc/fstab entry for the file system you want to to enable quotas on.

For example:
/dev/da1s2g   /home    ufs rw,userquota 1 2

Similarly, to enable group quotas, use the groupquota option instead of the userquota keyword. To enable both user and group quotas, change the entry as follows:

/dev/da1s2g    /home    ufs rw,userquota,groupquota 1 2

Reboot your machine

Check if it work with

$ quota -v

Edit your quota’s like so:

# edquota -u test

Quotas for user test:

/usr: blocks in use: 65, limits (soft = 50, hard = 75)
inodes in use: 7, limits (soft = 50, hard = 60)
/usr/var: blocks in use: 0, limits (soft = 50, hard = 75)
inodes in use: 0, limits (soft = 50, hard = 60)

27 Aug

/bin/sh: bad interpreter: Permission denied

The mentioned error occurrs when the /tmp is mounted with noexec permission. First step to ensure that the tmp is mounted with noexec permission is to check the /etc/fstab.

cat  /etc/fstab

/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
/dev/VolGroup00/LogVol04 /home                   ext3    defaults        1 2
proc                    /proc                   proc    defaults        0 0
sysfs                   /sys                    sysfs   defaults        0 0
/dev/VolGroup00/LogVol01 /tmp                    ext3 loop,noexec,nosuid,rw    defaults        1 2
/dev/VolGroup00/LogVol02 /usr                    ext3    defaults        1 2
/dev/VolGroup00/LogVol05 /var                    ext3    defaults        1 2
/dev/VolGroup00/LogVol03 swap                    swap    defaults        0 0
#/dev/tmppart           /tmp                     ext3 loop,noexec,nosuid,rw 0 0

If it is mounted with noexec permission, then our requirement to mount the same with execute permission.

Edit the /etc/fstab file. Remove the entry noexec from it.

Now the modified entry should look like,

/dev/VolGroup00/LogVol01 /tmp                    ext3 loop,nosuid,rw    defaults        1 2

Now we need to remount the partition

or

This will mount the /tmp with exec permission.

Once the script execution is over, remount the /tmp back to noexec.

26 Aug

Reset MySQL Password with skip-grant-tables option

Steps to Reset the mysql root password.

Stop the MySQL server process.

Start the MySQL server with the –skip-grant-tables option .

Connect to mysql server as the root user.

Setup new mysql root password for your mysql server.

Exit and restart the MySQL server.

Now you can access your mysql server with the new mysql root paasword

mysql -uroot -p

15 Aug

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:
BckServer.com – Is the backup server
Server1.com – Is the server you want to backup

Login to the server you want to backup

1. Creating a key with the ssh-keygen utility:

# ssh-keygen -t rsa -N ” (these are two single quotes)

2. Copy RSA encryption key to the backup server:

# scp ~/.ssh/id_rsa.pub username@BckServer.com:keys/server1
# ssh username@BckServer.com mergekeys

Now you can backup a folder without prompting for a password:

# rsync -avz -e ssh /etc/folder username@BckServer.com :folder_on_server1

Rsync configuration Examples:

Back up entire server:

rsync -avz –exclude=/proc -e ssh / username@bckserver.com:folder_on_server1

Back up home directories:

rsync -avz -e ssh /home username@bckserver.com:folder_on_server1

Back up specific users:

rsync -avz -e ssh ~user1 ~user2 ~user3 username@bckserver.com:folder_on_server1

Put it on crontab:

# nano /etc/crontab

Add this line:

13 3 * * * root rsync -avz -e ssh /home username@bckserver.com:folder_on_server1

Save and Exit

15 Aug

Automated RED5 Installation

The following steps are intended to automate the installation of Red 5 versions 0.5 , 0.6.3 and 0.7.0 .

Download the red5 installer script ,

Note: Do not download the script to some location where every one can access it as someone may execute it and overwrite an old installation !

Make it executable,

Execute the script,

When the script is executed, it would ask for the red5 version to be installed. There are 3 choices as of now.. 0.7.0 , 0.6.3 and 0.5
Make the choice by entering the digits 1, 2 or 3 . Pressing any other key will select the latest version , 0.70 .

# ./red5_install

Hello ,Please choose the RED5 version : (1,2,3 or 4)

1. RED5 0.7.0
2. RED5 0.6.3
3. RED5 0.5
Press Any other key to install 1. RED5 0.7.0

After the version is selected, the process is automated . If everything goes well, you will see something similar to the following as the last line,

2010-01-23 02:54:24,834 [main] INFO org.springframework.cache.ehcache.EhCacheManagerFactoryBean – Shutting down EHCache CacheManager
2010-01-23 02:54:24,842 [main] INFO org.mortbay.log – Started SelectChannelConnector@0.0.0.0:5080
2010-01-23 02:54:24,968 [main] INFO org.mortbay.log – Started SslSocketConnector@0.0.0.0:8443
2010-01-23 02:54:24,969 [main] INFO org.red5.server.Standalone – Startup done in: 36346 ms

You can exit from this screen by entering the key combination of control and c (^c).

If the installation goes fine , then red5 would be installed in /usr/local/red and it can be started by executing,

or

./red5.sh >/dev/null 2>&1 &

or

nohup sh red5.sh &

10 Aug

Kernel Upgrade on CentOS

Kernel Upgrade on CentOS

1. Find your yum.conf file:
# find yum.conf

2. Verify your yum.conf file:
# nano /etc/yum.conf
“Exclude” line should be something like this:
exclude=courier* apache* mod_ssl* httpd* perl mysql* php* spamassassin* exim*
Note:kernel* should not be excluded on “exclude” line

3. Upgrade kernel using:
– If you have 1 proc:
# yum upgrade kernel
– For dual proc use:
# yum upgrade kernel-smp

When upgrade is complete,
Set “default” to 0 in /etc/grub.conf
Rebbot your server:

Rebbot your server:
# shutdown -r now