Archive for May, 2008

Relax!
May 1, 2008
‘N NUWE AFRIKAANSE WOORD
May 1, 2008
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|

Installing MRTG in Debian
May 1, 2008
The installation will create an mrtg subdirectory where the Apache Web pages reside. On your Debian system the path of this subdirectory is:
/var/www/mrtg
Now you need to edit the mrtg configuration file to edit the some of the settings
File is located at /etc/mrtg.cfg you need to change the global settings as follows
# Global Settings
RunAsDaemon: yes
EnableIPv6: no
WorkDir: /var/www/mrtg
Options[_]: bits,growright
WriteExpires: Yes
Title[^]: Traffic Analysis for
You will find a crontab running every 5 minutes as user root
# cat /etc/cron.d/mrtg
0-55/5 * * * * root if [ -x /usr/bin/mrtg ] && [ -r /etc/mrtg.cfg ]; then env LANG=C /usr/bin/mrtg /etc/mrtg.cfg >> /var/log/mrtg/mrtg.log 2>&1; fi
Now we need to assign the snmp community name in snmp configration file /etc/snmp/snmpd.conf
# sec.name source community
# com2sec paranoid default public
com2sec readonly default public
#com2sec readwrite default private
Now you need to restart the snmp service
#/etc/init.d/snmpd restrat
The configuration file creating using
#cfgmaker public@localhost > /etc/mrtg.cfg
Creating a configuration file for a device using
#cfgmaker public@192.168.0.1 >> /etc/mrtg.cfg
With the configuration file created correctly there’s only one other thing you have to do and that’s to use the indexmaker utility to create the summary home page. Since you have to re-run this command every time you make certain changes to the /etc/mrtg.cfg configuration file,
Creating index file for the webserver using
#indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html
Now you need to reboot your system wait for five minutes or so and then take a look at your summary home page. If your Debian system’s IP address is 172.16.0.20 then you’d type in the following in the address bar of a browser running on a system on the same network:
http://172.16.0.20/mrtg/
Your summary home page should come up with a graph for each target entry in the configuration file. If a graph looks like there’s no data on it, click on it and check the statistics to see if any traffic is being seen. Small amounts of traffic won’t show up on the graphs because we used the Unscaled statement
Some of examples how to monitor cpu and memory usage
CPU Usage
/etc/mrtg/cpu.cfg
WorkDir: /var/www/localhost/htdocs/mrtg
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[localhost.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@127.0.0.1+ ssCpuRawSystem.0&ssCpuRawSystem.0:public@127.0.0.1+
ssCpuRawNice.0&ssCpuRawNice.0:public@127.0.0.1
RouterUptime[localhost.cpu]: public@127.0.0.1
MaxBytes[localhost.cpu]: 100
Title[localhost.cpu]: CPU Load
PageTop[localhost.cpu]: <H1>Active CPU Load %</H1>
Unscaled[localhost.cpu]: ymwd
ShortLegend[localhost.cpu]: %
YLegend[localhost.cpu]: CPU Utilization
Legend1[localhost.cpu]: Active CPU in % (Load)
Legend2[localhost.cpu]:
Legend3[localhost.cpu]:
Legend4[localhost.cpu]:
LegendI[localhost.cpu]: Active
LegendO[localhost.cpu]:
Options[localhost.cpu]: growright,nopercent
Memory Usage
/etc/mrtg/mem.cfg
LoadMIBs: /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt
Target[localhost.mem]: ..1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.6.0:public@localhost
PageTop[localhost.mem]: <H1>Free Memory</H1>
WorkDir: /var/www/localhost/htdocs/mrtg
Options[localhost.mem]: nopercent,growright,gauge,noinfo
Title[localhost.mem]: Free Memory
MaxBytes[localhost.mem]: 1000000
kMG[localhost.mem]: k,M,G,T,P,X
YLegend[localhost.mem]: bytes
ShortLegend[localhost.mem]: bytes
LegendI[localhost.mem]: Free Memory:
LegendO[localhost.mem]:
Legend1[localhost.mem]: Free memory, not including swap, in bytes
Creating jobs for the above two examples
CPU
/etc/cron.mrtg/cpu
#!/bin/sh
/usr/bin/mrtg /etc/mrtg/cpu.cfg
Memory
/etc/cron.mrtg/mem
#!/bin/sh
/usr/bin/mrtg /etc/mrtg/mem.cfg
Run each script 3 times (disregard the warnings)
/etc/cron.mrtg/cpu
/etc/cron.mrtg/mem
Make the Index Files
#/usr/bin/indexmaker

Ad blocking with ad server hostnames and IP addresses
May 1, 2008A list of ad servers and how to use them to easily block 90% of ads on the web.
http://pgl.yoyo.org/adservers/

How can I set the system date and time from the command prompt (bash shell)?
May 1, 2008Use date command to display the current date and time or set the system date and time over ssh session.
This is useful if the Linux server time and/or date is wrong, and you need to set it to new values from the shell prompt.
Use the following syntax to set new data and time:
date set=”STRING”
For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:
# date -s “2 OCT 2006 18:00:00″
Source http://www.cyberciti.biz/faq/howto-set-date-time-from-linux-command-prompt/

Calamaris
May 1, 2008
The Calamaris is a software written in Perl that effects the generation of reports detailed of the use of the InterNet using the archives of logs of some servers well proxy, as the NetCache, Inktomi Traffic Server, Oops! proxy server, Novell InterNet Caching System, Compaq Tasksmart, Netscape/iplanet Web Proxy server and are clearly the Squid. The generated reports are well simple in the presentation, however very rich in extracted details of the archives of logs, they can be generated in same format HTML or in text to be sent way email.
The use of this software is very simple, first has that to lower the version most recent of it in http://cord.de/tools/squid/calamaris/Welcome.html.en, to unpack the archive in the directory of its preference, in ours in case that /usr/local/calamaris, after this already can use it. Below we have necessary a simple example of comando1 for generation of the reports of log of the Squid.# /usr/local/calamaris/calamaris -a -F html /var/log/squid/access.log >/srv/www/default/html/calamaris/index.html
The command above already is enough for generation of excellent reports of the analysis of logs. In this in case that we use the option – the one that says to the Calamaris to be generated all the reports, – F HTML specifies the format of the report that we want, in the case in HTML, /var/log/squid/access.log is where it is located the archive of log of the Squid and /srv/www/default/html/calamaris/index.html the localization of the generated report, in this case a folder in the tree of the Apache of form that can be analyzed of any station of the net.

Ubuntu Linux shutdown the X server
May 1, 2008“How do I shutdown the X server, so that I have a command line prompt on the console?”
If you are using GNOME:
sudo /etc/init.d/gdm stop
Again to start GNOME desktop:
sudo /etc/init.d/gdm start
source : http://theos.in/ubuntu-linux-shutdown-the-x-server.html

Recover root password under linux with single user mode
May 1, 2008How-To: Recover root password under linux with single user mode
It happens sometime that you can’t remember root password. On Linux, recovering root password can be done by booting Linux under a specific mode: single user mode.
This tutorial will show how to boot Linux in single user mode when using GRUB and finally how to change root password.
During normal usage, a Linux OS runs under runlevels between 2 and 5 which corresponds to various multi-user modes. Booting Linux under runlevel 1 will allow one to enter into a specific mode, single user mode. Under such a level, you directly get a root prompt. From there, changing root password is a piece of cake.
1. Entering runlevel 1
Some Linux distribution, such as Ubuntu for instance, offer a specific boot menu entry where it is stated “Recovery Mode” or “Single-User Mode”. If this is your case, selecting this menu entry will boot your machine into single user mode, you can carry on with the next part. If not, you might want to read this part.
Using GRUB, you can manually edit the proposed menu entry at boot time. To do so, when GRUB is presenting the menu list (you might need to press ESC first), follow those instructions:
- use the arrows to select the boot entry you want to modify.
- press e to edit the entry
- use the arrows to go to kernel line
- press e to edit this entry
- at the end of the line add the word single
- press ESC to go back to the parent menu
- press b to boot this kernel
The kernel should be booting as usual (except for the graphical splash screen you might be used to), and you will finally get a root prompt (sh#).
Here we are, we have gained root access to the filesystem, let’s finally change the password.
2. Changing root password
As root, changing password does not ask for your old password, therefore running the command:
# passwd
will prompt you for your new password and will ask you to confirm it to make sure there is no typo.
That’s it, you can now reboot your box and gain root access again
Source: http://www.debuntu.org/recover-root-password-single-user-mode-and-grub

Install WordPress in Debian Etch
May 1, 2008Install WordPress in Debian Etch
WordPress is a state-of-the-art semantic personal publishing platform with a focus on aesthetics, web standards, and usability. What a mouthful. WordPress is both free and priceless at the same time. WordPress Requirements
* Apache Web server
* PHP 4.2 or greater
* MySQL 3.23.23 or greater
* The mod_rewrite Apache module
First you need to install apache2 with php support and mysql with php support
Apache with PHP Support check here
Mysql Database installation check here
Mysql with php support you need to run the following command
#apt-get install php4-mysql
after that you need to install wordpress using the follwoing command
#apt-get install wordpress
This will install the wordpress now you need to go to /usr/share/doc/wordpress/example folder to setup apache to point to /usr/share/wordpress. See the examples/apache.conf
Create a file called wordpress under /etc/apache2/sites-available/ and enter the following and save the file
Alias /blog /usr/share/wordpress
<Directory /usr/share/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
</Directory>
Now you need to enable this site using the following command
#a2ensite wordpress
Now reload apache using the following command
#/etc/init.d/apache2 restart
Database setup can be done with the help of a script in examples/setup-mysql
To setup mysql database for wordpress you need to follow this
setup-mysql [-n NAME] [-h | -d | -b] FQDN
Creates by default a WordPress mysql configuration depending on required fully
qualified domain name(FQDN).
Options:
-n name for the mysql user and database
-h help
-d destroy and purge
-b backup
Example: You want your blog to be served from http://blog.example.com for user ‘wordpress’.
Then run:
sudo sh setup-mysql -n wordpress blog.example.com
Example:-
#sh setup-mysql -n wordpress 172.20.2.18
After finishing this you need to go to http://your-server-ip/blog/ you should see the following message
It doesn’t look like you’ve installed WP yet. Try running install.php.
Click on install.php link and you should see the following screen saying welcome to wordpress installation in this click on First Step
Source: http://www.debianadmin.com/install-wordpress-in-debian-etch.html

