Tag Archives: Debian

Setting up Nagios Server to Remotely Server on Debian

Step 1. Installing packages

We have one server for monitoring (eg. myoneserver). [client]

# aptitude install nagios-nrpe-server nagios-plugins

And one server to view statistics. [server]

# aptitude install nagios-nrpe-plugin nagios-plugins nagios3

Step 2. Configuring the server for monitoring [client]
Edit /etc/nagios/nrpe.conf.

# nano /etc/nagios/nrpe.conf

Set the server_address to the IP address you want NRPE to bind to on the Untangle server.  If you want it to bind to all addresses, leave this command commented out.


Change allowed_hosts to the IP address of the Nagios server:


Add a command to check the swap utilization:

command[check_sda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda1

Save and quit /etc/nagios/nrpe.conf.

Restart the NRPE service:

/etc/init.d/nagios-nrpe-server restart

Step 3. Configure the Nagios Server
Create a file named /etc/nagios3/conf.d/myoneserver.cfg with the following contents:

#Host Definition
define host{
use                     generic-host
host_name               myoneserver
alias                   MyOneServer Server

# Service Definitions
define service{
use                     generic-service
host_name               myoneserver
service_description     CPU Load
check_command           check_nrpe_1arg!check_load

define service{
use                     generic-service
host_name               myoneserver
service_description     Swap Drive Usage
check_command           check_nrpe_1arg!check_swap

define service{
use                     generic-service
host_name               myoneserver
service_description     Free Disk Space
check_command           check_nrpe_1arg!check_sda1

define service{
use                     generic-service
host_name               myoneserver
service_description     Number of Users
check_command           check_nrpe_1arg!check_users

define service{
use                     generic-service
host_name               myoneserver
service_description     Number of Zombie Processes
check_command           check_nrpe_1arg!check_zombie_procs

define service{
use                     generic-service
host_name               myoneserver
service_description     Total Processes
check_command           check_nrpe_1arg!check_total_procs

Save and quit  /etc/nagios3/conf.d/myoneserver.cfg.

Edit /etc/nagios3/conf.d/hostgroups_nagios2.cfg and add the following section to define an

Server group. (optional)
define hostgroup {
hostgroup_name  myoneserver
alias           MyOneServer Servers
members         MyOneServer1, MyOneServer2 MyOneServer3

Restart the Nagios service to apply the changes:

/etc/init.d/nagios3 restart

Quick server backup

mount /dev/xxxx -o remount-ro /mnt
tar -cvjpf serverbackup.tar.bz2 /mnt

then unpack the behavior of permissions

tar -xvjpf serverbackup.tar.bz2

here my script with mysql backup. backup.sh

  1. # create backup catalog
  2. mkdir /backup
  3. # clean
  4. aptitude clean
  5. rm /var/log/*.gz
  6. rm /var/log/apache2/*.gz
  7. rm /var/log/apt/*.gz
  8. rm /var/log/clamav/*.gz
  9. rm /var/backups/*.gz
  10. # start archive
  11. tar -cvjpf /backup/backup_bin.tar.bz2 /bin
  12. tar -cvjpf /backup/backup_home.tar.bz2 /home
  13. tar -cvjpf /backup/backup_lib.tar.bz2 /lib
  14. tar -cvjpf /backup/backup_root.tar.bz2 /root
  15. tar -cvjpf /backup/backup_usr.tar.bz2 /usr
  16. tar -cvjpf /backup/backup_etc.tar.bz2 /etc
  17. tar -cvjpf /backup/backup_lib64.tar.bz2 /lib64
  18. tar -cvjpf /backup/backup_sbin.tar.bz2 /sbin
  19. tar -cvjpf /backup/backup_var.tar.bz2 /var
  20. # backup mysql
  21. mysqldump -u root -p<PASSWORD> --all-databases > /backup/all_databases.sql
  22. # archiving of all backups to a single file
  23. tar -cvjpf /backup_`date +"%F"`.tar.bz2 /backup
  24. # send backup to another server
  25. scp /backup_`date +"%F"`.tar.bz2 user@server:/home/backup
  26. # remove local backup
  27. rm -R /backup /backup_`date +"%F"`.tar.bz2

backup from remote server to local /mnt

mount /dev/sda1 /mnt/
rsync -aHxv root@* /mnt --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/tmp

Own IRC Server on Debian with Anope and MySQL

** Pre-Installation **

First, download the UnrealIRCd source, located hier

wget http://www.unrealircd.com/downloads/Unreal3.2.10.1.tar.gz
wget http://www.unrealircd.com/pgp/Unreal3.2.10.1.tar.gz.asc

After you install it, run a few checks on the gzip file to make sure it is the secured version.

gpg --keyserver keys.gnupg.net --recv-keys 0x9FF03937
gpg --verify Unreal3.2.10.1.tar.gz.asc Unreal3.2.10.1.tar.gz

Next, we have to extract the contents of the compressed file. Type

tar zxvf Unreal3.2.10.1.tar.gz

** SSL Support

If you want users to be able to connect to your IRC server via a secure connection, you will need to install a package called libcurl4-openssl-dev. This is a bundle that includes everything needed for SSL, plus what is needed for remote includes which are discussed below.

You will need to install the packages as root. Type these:

apt-get install build-essential
apt-get install openssl
apt-get install libcurl4-openssl-dev

You now have what is required for SSL connections to your server.

**Ziplinks Support

Ziplinks reduce the amount of bandwidth used by your servers by compressing data before it is sent to another server.
zlib1g is the library required for ziplinks, which is usually installed already, so you don’t have to do anything.

** Remote Includes Support

A remote include is pretty much like a normal include, the difference being that remote includes are obtained from a remote FTP server. This makes it so there could be one central FTP server with most of the configuration files that are not server-specific. This will make updates to the configuration files much easier, since you only have to update the files on the FTP server, then rehash all of the IRC servers.

For remote include support, we will need libcurl, which is already installed with the libcurl4-openssl-dev package above.

** Installation **
We are now ready to install UnrealIRCd. Switch back to the account that you will be installing UnrealIRCd on, and navigate to the Unreal3.2 folder. Type:


… answers to questions that ask configurator …
with SSL support!
And type make

** Anope **
Download Anope Services.

Decompress them
tar zxvf anope-1.8.8.tar.gz

Change to anope directory and start the installation:
cd anope-1.8.8

Configuration answers:

install binaries to? I suggest /path/to/Unreal3.2.10.1/services
create dir? yes
install data files to? hit enter
group? hit enter
default umask? hit emter
MD5 passwd encryption? no (unless you really want it)
auto-check for mysql libs? hit enter

Type make and make install to complete the compilation process
When everything is done, cd to the services directory and copy the example conf:

cd /path/to/Unreal3.2.10.1/services
cp example.conf services.conf
Open services.conf in your favorite editor and modify/add these values:
IRCDModule "unreal32"
RemoteServer 6667 "services"
ServerName "services.yourdomain.com"
ServicesRoot "YourNicknameHere"

** Configuration **
Copy the example configuration file
cd Unreal3.2.10.1/
cp doc/example.conf unrealircd.conf

Lines that start with # are my comments so you don’t have to add them to the config file.

/* FOR *NIX, uncomment the following 2lines: */
loadmodule "src/modules/commands.so";
loadmodule "src/modules/cloak.so";

Set your IRCD info:

name "irc.yourdomain.com";
info "your IRC network name";
numeric 1;

Show users you’re the admin

admin {
"Your Name";
"Your Nickname";

Add an O:Line for yourself
You can edit the one already there
O:Lines define the IRCops

oper YourNickHere {
class clients;
from {
userhost *@*;
password "YourPassHere";
g lobal;

Add a C/N Line for IRC Services
Don’t edit the link block already there.
C/N Lines allow other IRCDs or IRC Services to link with you

link services.itunix.eu
   username   *;
   bind-ip    *;
   port       7070;
   hub             *;
   password-connect "password";
   password-receive "password";
   class           servers;
   options {
listen         *:6697

listen *:7070
link            hub.itunix.eu
	username	*;
	bind-ip 	*;
	port 		7029;
	hub             *;
	password-connect "password";
	password-receive "password";
	class           servers;
		options {
			/* Note: You should not use autoconnect when linking services */

You can edit the ulines block already there

ulines {

Network configuration is the most important part
You can use the block already there

/* Network configuration */
set {
network-name "YourNetworkNameHere";
default-server "irc.yourdomain.com";
services-server "services.yourdomain.com";
stats-server "stats.yourdomain.com";
help-channel "#help";
hiddenhost-prefix "hidden";
/* prefix-quit "no"; */
/* Cloak keys should be the same at all servers on the network.
/* [..etc..]
cloak-keys {
/* on-oper host */
hosts {
local "locop.yourdomain.com";
global "ircop.yourdomain.com";
coadmin "coadmin.yourdomain.com";
admin "admin.yourdomain.com";
servicesadmin "csops.yourdomain.com";
netadmin "netadmin.yourdomain.com";
host-on-oper-up "no";

Server configuration
You can edit the block already there

/* Server specific configuration */
set {
kline-address "VALID.mail@address.here";
auto-join "#lobby";
modes-on-connect "+ixw";
modes-on-oper "+xwgs";
oper-auto-join "#opers";
dns {
nameserver Your.DNS.IP.Here;
timeout 2s;
retries 2;

** Anope
Corrected that but in services.conf where i had:

RemoteServer 7070

MysqlHost “”
MysqlUser “user”
MysqlPass “pass”
MysqlName “anope”
MysqlSock “/tmp/mysql.sock”
MysqlPort 3306

and import tables.sql to mysql

Save and close the config file
Start Anope IRC Services with debug mode enabled in order to spot:

./services -debug -nofork

If the services didn’t show any errors in the console and connected (and stayed connected) to the IRC server, it’s safe to run them normally:


Start your new IRCD server by typing:

./unreal start

Nginx proxy_pass

From synchtube.itunix.eu:1337 to synchtube.itunix.eu

  1. server {
  2. #  listen;
  3.    server_name synchtube.itunix.eu;
  4.    access_log  /var/log/nginx/access.log;
  5.    error_log   /var/log/nginx/error.log;
  7.    location / {
  8.         proxy_pass  http://synchtube.itunix.eu:1337;
  9.         proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
  10.         proxy_redirect off;
  11.         proxy_buffering off;
  12.         proxy_set_header        Host            static.example.com;
  13.         proxy_set_header        X-Real-IP       $remote_addr;
  14.         proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  15.     }
  16. }

FIX ping: command not found

root@nsa310:~# ping
-bash: ping: command not found

here is simple solution

# aptitude install inetutils-tools inetutils-ping

test it

root@nsa310:~# ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=0.128 ms
64 bytes from icmp_seq=1 ttl=64 time=0.091 ms
^C--- ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.091/0.110/0.128/0.000 ms

Own IRC Server on Debian

  1. aptitude install ircd-irc2
  2. nano /etc/ircd/ircd.conf


3. nano /etc/ircd/ircd.motd
Your welcome text

4. /etc/init.d/ircd restart

Own XMPP/Jabber Server on Debian

  1. Installing ejab­berd:

    aptitude install ejabberd
  2. Configuration:

    nano /etc/ejabberd/ejabberd.cfg
  3. Find and change the line:

    {acl, admin, {user, "YOURNAME", "YOURDOMAIN"}}.
  4. Append a little below your domain:

    {hosts, ["YOURDOMAIN"]}.
  5. Restart ejabberd:

    ejabberdctl restart
  6. Register an account for yourself:

  7. If the ejabberd is on a different server set SRV records:

    _xmpp-client._tcp.YOURDOMAIN.TLD. SRV 10 0 5222 jid.YOURDOMAIN.TLD.
    _xmpp-server._tcp.YOURDOMAIN.TLD. SRV 10 0 5269 jid.YOURDOMAIN.TLD.