Monday, June 28, 2010

Install SNMPD on Ubuntu

1.Installation

root@ibsen:~# sudo apt-get install snmpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libmpich1.0gf libdc1394-22 genisoimage linux-headers-2.6.27-7 libgfortran2 dvd+rw-tools linux-headers-2.6.27-7-generic libcarp-clan-perl libxml-xql-perl libparse-yapp-perl
rdate python-xml localechooser-data gcc-4.2-base libimage-size-perl libdebconfclient0 libvisual-0.4-0 libmyth-python perlmagick libvisual-0.4-plugins libavdevice52
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libperl5.10 libsensors3 libsnmp-base libsnmp15
Suggested packages:
lm-sensors
The following NEW packages will be installed:
libperl5.10 libsensors3 libsnmp-base libsnmp15 snmpd
0 upgraded, 5 newly installed, 0 to remove and 3 not upgraded.
Need to get 2463kB of archives.
After this operation, 7987kB of additional disk space will be used.
Do you want to continue [Y/n]?

answer y

2. Configuration

Move existing /etc/snmp/snmpd.conf configuration file to /etc/snmp/snmpd.conf.org

mv /etc/snmp/snmpd.conf  /etc/snmp/snmpd.conf.org

Create a new /etc/snmp/snmpd.conf file:

rocommunity  public
syslocation "PDC, Peters DataCenter"
syscontact peter@it-slav.net

Make snmpd use the newly created file and make it listen to all interfaces:

Edit /etc/default/snmpd

Change from:

# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'

To:

# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'

and restart snmpd

/etc/init.d/snmpd restart


Credit to http://www.it-slav.net/blogs/2009/02/05/install-and-configure-snmp-on-ubuntu/

Wednesday, June 23, 2010

Change usr directory to other HDD / Partition

to change the usr directory in freebsd (i already make it)
add new hdd to your server, format it. let say i give the new patition is /usr2
after finish format

cd /usr2
dump 0af - /usr | restore rf -

After the dump completed, edited /etc/fstab.
Delete the line with /usr in /etc/fstab.
Updated the line with /usr2, changed /usr2 for /usr. (inside fstab)
Then rebooted. Finally the system started with a new /usr filesystem.

Done!

Credit to BSD Forum!

reset your mysql root password

Stop mysql dulu

#/usl/local/etc/rc.d/mysql-server stop.

#mysqld_safe --skip-grant-tables

than open new shell and go to the mysql-server

#mysql --user=root mysql

now you enter the mysql server and run this command

update user set Password=PASSWORD('new-password') where user='root';
flush privileges;
exit;

start the server

done

Tuesday, June 15, 2010

make symbolic link on Unix

# ln -s /usr/home /home or ln -s /data/moodle2/ moodle2

Sunday, June 13, 2010

How to Lock / Unlock User in ubuntu

For Locking User from command Line

$ sudo usermod -L waxs This will Lock user account named waxs

For Locking User from command Line

$ sudo usermod -U waxs This will UnLock user account named waxs

Thursday, June 3, 2010

list all installed application on ubuntu

list all installed application on ubuntu

dpkg --get-selections

Tuesday, June 1, 2010

Centos - Adduser

You can also do this from the command line, below are the equivalent commands. You need to have root level access to use the commands below.
  • usr/sbin/useradd [options] login_name
    creates a new user
  • usr/sbin/usermod [options] login_name
    modifies a user’s attributes
  • usr/sbin/userdel [options] login_name
    deletes the specified user. Use the -r option to automatically remove the user’s home directory and mail spool.
  • usr/bin/passwd login_name
    sets the password for the specified user
  • usr/sbin/groupadd [options] group_name
    creates a new group
  • usr/sbin/groupmod [options] group_name
    modifies a group’s attributes
  • usr/sbin/groupdel group_name
    deletes the specified group