ABHIONLINUX
Site useful for linux administration and web hosting

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

2011/05/17

How to clear cache memory(RAM) in linux


Clear cache memory.

You can use the command given below to clear the pagecache
echo 1 > /proc/sys/vm/drop_caches

To  free dentries and inodes, you can use the command
echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches

2011/04/25

/bin/mv: Argument list too long

When you are trying to move large number of files such 200000 files. you can use the command

mv  * /path/to/move

If you try the above command, you will be getting the error  "/bin/mv: Argument list too long"


You can use the command given below to avoid this error ,


find /path/to/file -type f | xargs -i mv "{}" /path/to/move


Try this out.. :)

2011/03/21

Command to check the performance of the hard disk.


Command to check the performance of the hard disk.

You can use the command given below to check the hard disk performance.

hdparm /dev/sda

/dev/sda:
 multcount     = 16 (on)
 IO_support    =  1 (32-bit)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 19457/255/63, sectors = 312581808, start = 0


You can replace /dev/sda with the name of your disk device.

2010/02/26

How to enable tun/tap device with nat

OpenVZ supports VPN inside a container via kernel TUN/TAP module and device. To allow container #101 to use the TUN/TAP device the following should be done:

Make sure the tun module has been already loaded on the hardware node:

# lsmod | grep tun

If it is not there, use the following command to load tun module: .
# modprobe tun

To make sure that tun module will be automatically loaded on every reboot you can also add it or into /etc/modules.conf (on RHEL see /etc/sysconfig/modules/ directory) or into /etc/sysconfig/vz-scripts/CTID.mount. (echo 'modprobe tun' >> /etc/sysconfig/vz-scripts/CTID.mount)

Granting container an access to TUN/TAP

Allow your container to use the tun/tap device by running the following commands on the host node:

vzctl set 101 --devices c:10:200:rw --save
vzctl set 101 --capability net_admin:on --save

And create the character device file inside the container (execute the following on the host node):

vzctl exec 101 mkdir -p /dev/net
vzctl exec 101 mknod /dev/net/tun c 10 200
vzctl exec 101 chmod 600 /dev/net/tun

Configuring VPN inside container

After the configuration steps above are done it is possible to use VPN software working with TUN/TAP inside container just like on a usual standalone linux box.

The following software can be used for VPN with TUN/TAP:

* Virtual TUNnel (http://vtun.sourceforge.net)
* OpenVPN (http://openvpn.net)

If NAT is needed within the VE, this error will occur on attempts to use NAT:

# iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o venet0 -j MASQUERADE

2009/12/23

Configuration files in cpanel server

Apache:-

/usr/local/apache/ bin->Apache binaries are stored here
/usr/local/apache/conf–>configuration files – httpd.conf
/usr/local/apache/cgi-bin->Cgi bin directory
/usr/local/apache/domlogs–>domain log files are stored here
/usr/local/apache/htdocs->default doucument root of the server
/usr/local/apache/include–>contains header files
/usr/local/apache/modules–>Contains shared object (.so) files
/usr/local/apache/logs–>apache logs contains access_log, errorlog and suexec_log

Exim:-

->/etc/exim.conf – exim configuration file
->/etc/localdomains – list of the domains which are allowed to relay mail
->/var/log/exim_mainlog – exim main log file
-> /var/log/exim_rejectlog – Contains the logs for the rejected mails.
->/var/log/exim_paniclog – Contains exim errors
->/var/spool/exim/input-Mail queue for exim
->/etc/valiases/domainname.com- Email forwarders and catchall.
->/etc/vfilters/domainname.com-Email filter
->/home/username/etc/domainname/passwd-POP authentication file

ProFTPD:-

-> /etc/proftpd-configuration file
->/var/log/messages-ftp logs
->/etc/proftpd/username- All the ftp accounts and password will be listed here.

Pure-FTPD:-

->/etc/pure-ftpd.conf-Pureftpd configuration file.
->/etc/pure-ftpd/ip-address-document root for the anonymous ftp

Mysql:-

/etc/my.cnf->configuration file
/root/.my.cnf->Contains the root password
/var/lib/mysql –Data directory which contains all the MySql databases.

SSHD:-

/etc/ssh/sshd_config->configuarton file
/var/log/messages-> Log file
/etc/banner->Contains the banner to be displayed

Named:-

/etc/named.conf->Main configuration file
/var/named->Directory which contains the db records
/var/log/messages-> Log file

Cpanel Configuration files:-

/usr/local/cpanel-/bin –> cpanel binaries
/usr/local/cpanel/cgi-sys –> Contains cgi files like formmail.cgi etc
/usr/local/cpanel-/base –> phpmyadmin, squirrelmail, skins, webmail etc
/usr/local/cpanel-/logs -> cpanel access log, error log etc
/usr/local/cpanel/ 3rdparty/ –Fantastico,mailman files are located here
/usr/local/cpanel-/addons –> AdvancedGuestBook, phpBB etc
/var/cpanel/users/username – >cpanel user file
/var/cpanel/cpanel.config –> cpanel configuration file.
/var/cpanel/resellers –> Reseller configuration files.
/var/log/dcpumon –> Top log process
/etc/wwwacct.conf –> account creation default file
/etc/cpupdate.conf – >cPanel Updation Config file
/etc/cpbackup.conf –> Backup configuration file
/var/cpanel/bandwidth –> Contains bandwidth usage details of the domains.

Name server and IP configuration files:-

/etc/sysconfig/network –Network configuration files
/etc/hosts->Contains hostname of the server
/etc/resolv.conf –> Resolver Configuration
/etc/nameserverips –>Contains the name server IP details
/etc/ips –>List of all the ip addresses except the shared ip on the server.
/etc/ipaddrpool – >ip addresses which are free
/etc/ips.dnsmaster –> name server ips