R1soft server installation

Installing CDP server (On Backup Server)
——————————————————————-

USING YUM

cd /etc/yum.repos.d
vi r1soft.repo

Insert the following text into the file and save the file:

[r1soft]
name=R1Soft Repository Server
baseurl=http://repo.r1soft.com/yum/stable/$basearch/
enabled=1
gpgcheck=0

yum install r1soft-cdp-enterprise-server

USING RPM

Login to the backup server.
Check whether any rpm for r1soft is installed on the server

rpm -qa |grep r1soft

Check the server archetecture and download the zip file.

wget http://repo.r1soft.com/release/trials/R1Soft-EnterpriseEdition-linux32.zip
wget http://repo.r1soft.com/release/trials/R1Soft-EnterpriseEdition-linux64.zip

Unzip the file.

unzip R1Soft-EnterpriseEdition-linux64.zip

cd enterprise-rpm

Install all the rpm files.

rpm -i *.rpm

Configure and Start the CDP Server Web-based User Interface

Use ”’r1soft-setup”’ to configure r1soft
r1soft-setup –help

Run the following command with admin username and password.
r1soft-setup –user DESIRED_USERNAME –pass DESIRED_PASSWORD

Restart the CDP server

/etc/init.d/cdp-server restart

Assign ports for http and https.

r1soft-setup –http-port 8080 –https-port 8443

/etc/init.d/cdp-server restart

Qmail installation

First you need to install the libraries that is needed for qmail

yum install gcc
yum install make
yum install groff
yum install patch
yum install openssl openssl-devel
yum install pam pam-devel

the following are the source file need to be downloaded
cd /usr/local
wget http://www.qmail.org/netqmail-1.06.tar.gz
wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
wget http://cr.yp.to/checkpwd/checkpassword-0.90.tar.gz
wget http://downloads.sourceforge.net/project/vpopmail/vpopmail-stable/5.4.30/vpopmail-5.4.30.tar.gz?use_mirror=nchc
wget http://www.dovecot.org/releases/1.2/dovecot-1.2.11.tar.gz

mkdir /package
mv -iv /usr/local/daemontools-0.76.tar.gz /package

Adding needed Users/Groups

———————————
groupadd nofiles
useradd -g nofiles -d /var/qmail qmaild
useradd -g nofiles -d /var/qmail qmaill
useradd -g nofiles -d /var/qmail qmailp
useradd -g nofiles -d /var/qmail/alias alias
groupadd qmail
useradd -g qmail -d /var/qmail qmailq
useradd -g qmail -d /var/qmail qmailr
useradd -g qmail -d /var/qmail qmails

Installing qmail

—————–
tar -xzvf netqmail-1.06.tar.gz
cd netqmail-1.06/
make setup check
./config-fast –> hostname of the server

Qmail aliases.

—————–
useradd adminmails;
cd ~alias;
echo “adminmails” > .qmail-postmaster
echo “adminmails” > .qmail-mailer-daemon
echo “adminmails” > .qmail-root
echo “adminmails” > .qmail-postmaster
echo “adminmails” > .qmail-abuse
chmod 644 ~alias/.qmail*
su – adminmails
/var/qmail/bin/maildirmake ~/Maildir

————-

Make a script /var/qmail/rc with following contents

########
#!/bin/sh

# Using stdout for logging
# Using control/defaultdelivery from qmail-local to deliver messages by default

exec env – PATH=”/var/qmail/bin:$PATH” \
qmail-start “`cat /var/qmail/control/defaultdelivery`”
########

chmod 755 /var/qmail/rc
echo ./Maildir/ >/var/qmail/control/defaultdelivery

Linking Qmail to sendmail binaries

——————————————-
chmod 000 /usr/lib/sendmail ### Only if sendmail exist
chmod 000 /usr/sbin/sendmail ### Only if sendmail exist
mv /usr/lib/sendmail /usr/lib/sendmail.bak ### Only if sendmail exist
mv /usr/sbin/sendmail /usr/sbin/sendmail.bak ### Only if sendmail exist
ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

Install ucspi-tcp

——————
tar -xzvf ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88
patch < /usr/local/netqmail-1.06/other-patches/ucspi-tcp-0.88.errno.patch
make
make setup check

Install checkpassword

—————————
cd /usr/local
tar -xzvf checkpassword-0.90.tar.gz
cd checkpassword-0.90
patch < /usr/local/netqmail-1.06/other-patches/checkpassword-0.90.errno.patch
make
make setup check

Install daemontools

————————
tar -xzvf daemontools-0.76.tar.gz
cd /package/admin/daemontools-0.76/src
patch < /usr/local/netqmail-1.06/other-patches/daemontools-0.76.errno.patch
cd ..
package/install

qmailctl

————
cd /var/qmail/bin/
wget http://lifewithqmail.org/qmailctl-script-dt70
mv -iv qmailctl-script-dt70 qmailctl
chmod 755 /var/qmail/bin/qmailctl
ln -s /var/qmail/bin/qmailctl /usr/bin

qmail-send & qmail-smtpd scripts & qmail-pop3d-> run/log

———————————————-
mkdir -p /var/qmail/supervise/qmail-send/log
mkdir -p /var/qmail/supervise/qmail-smtpd/log
mkdir -p /var/qmail/supervise/qmail-pop3d/log

1,make file /var/qmail/supervise/qmail-send/run with below given content
##########
#!/bin/sh
exec /var/qmail/rc

##########

2,make file /var/qmail/supervise/qmail-send/log/run with below given content
###########
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail
###########

3,make file /var/qmail/supervise/qmail-smtpd/run with below given content
###########
#!/bin/sh

QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
LOCAL=`head -1 /var/qmail/control/me`

if [ -z “$QMAILDUID” -o -z “$NOFILESGID” -o -z “$MAXSMTPD” -o -z “$LOCAL” ]; then
echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in
echo /var/qmail/supervise/qmail-smtpd/run
exit 1
fi

if [ ! -f /var/qmail/control/rcpthosts ]; then
echo “No /var/qmail/control/rcpthosts!”
echo “Refusing to start SMTP listener because it’ll create an open relay”
exit 1
fi

exec /usr/local/bin/softlimit -m 9000000 \
/usr/local/bin/tcpserver -v -R -l “$LOCAL” -x /etc/tcp.smtp.cdb -c “$MAXSMTPD” \
-u “$QMAILDUID” -g “$NOFILESGID” 0 smtp /var/qmail/bin/qmail-smtpd 2>&1
###########

echo 20 > /var/qmail/control/concurrencyincoming
chmod 644 /var/qmail/control/concurrencyincoming

4,Make file /var/qmail/supervise/qmail-smtpd/log/run with below given content
#########
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail/smtpd ##
#########

 

5,Make file /var/qmail/supervise/qmail-pop3d/run with below given content

 

########

#!/bin/sh
exec /usr/local/bin/tcpserver -H -R -v -c100 0 110 /var/qmail/bin/qmail-popup server.domain.com \
/home/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir 2>&1

#######

 

6,make a file /var/qmail/supervise/qmail-pop3d/log/run

########     
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s100000 n20 /var/log/qmail/qmail-pop3d 2>&1

########

mkdir -p /var/log/qmail/smtpd

mkdir -p /var/log/qmail/pop3d
chown qmaill /var/log/qmail
chown qmaill /var/log/qmail/smtpd

chown qmail /var/log/qmail/pop3d
chmod 755 /var/qmail/supervise/qmail-send/run
chmod 755 /var/qmail/supervise/qmail-send/log/run
chmod 755 /var/qmail/supervise/qmail-smtpd/run
chmod 755 /var/qmail/supervise/qmail-smtpd/log/run
chmod 755 /var/qmail/supervise/qmail-pop3d/run

chmod 755 /var/qmail/supervise/qmail-pop3d/log/run
ln -s /var/qmail/supervise/qmail-send /service/qmail-send
ln -s /var/qmail/supervise/qmail-smtpd /service/qmail-smtpd
ln -s /var/qmail/supervise/qmail-pop3d /service/qmail-pop3d

Install Vpopmail

——————-
groupadd vchkpw
useradd -g vchkpw vpopmail
tar -xzvf vpopmail-5.4.30.tar.gz
cd vpopmail-5.4.30
./configure
make
make install-strip

Install Dovecot

——————
useradd dovecot
tar -xzvf dovecot-1.2.11.tar.gz
cd dovecot-1.2.11
./configure –with-ioloop=IOLOOP –with-notify=NOTIFY –with-ssl=openssl –with-passwd –with-passwd-file –with-shadow –with-pam –with-checkpassword –with-vpopmail –with-static-userdb
make
make install

Cert Generation
cd /usr/local/src/build/dovecot-1.2.5/doc/
sh mkcert.sh

make file /etc/pam.d/dovecot with the below content

auth required pam_unix.so nullok
account required pam_unix.so

Get Dovecot configuration file
wget 216.67.251.5/qmail/dovecot.conf -O /usr/local/etc/dovecot.conf
id -u vpopmail #### this will print out the userID
first_valid_uid = VPOPUID #### replace VPOPUID with user Id from the above command

Get dovecot startup script
wget http://216.67.251.5/qmail/dovecot-start -O /etc/init.d/dovecot
chmod 755 /etc/init.d/dovecot
/etc/init.d/dovecot start

qmailctl stop
qmailctl start
/etc/init.d/dovecot restart
Useful Commands

##############

 

qmailctl start

qmailctl stop

qmailctl reload —> use this command after making changes in qmail configuration files

/var/qmail/bin/qmail-showctl —> check the status of qmail

 

/var/qmail/control/rcpthosts —> contains list of domain names that a qmail server is allowed to send/receive emails with out SMTP authentication.

 

/etc/tcp.smtp → relaying options

 

type the foolowing command after making changes in cp.smtp

tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp

 

To add a domain in qmail server

 

/home/vpopmail/bin/vadddomain userdomain

 

to add a mail account

 

/home/vpopmail/bin/vadduser mailaccount

 

 

To send mail

 

echo to” tester2mail@gmail.com | /var/qmail/bin/qmail-inject

 

Log files

=======

var/log/qmail/current

/var/logqmail/smtpd/current

 

Errors

=====

 

1,If you find any error with smtp-auth

 

Try to apply the patch

 

wget http://members.elysium.pl/brush/qmail-smtpd-auth/dist/qmail-smtpd-auth-0.31.tar.gz
tar -xvzf qmail-smtpd-auth-0.31.tar.gz
cd qmail-smtpd-auth-0.31
patch -d ‘qmail installing directory’ < auth.patch

 

2,while compiling qmail if you find any error related to errno.h,follow the steps

 

Replace “extern int errno;” with “#include <errno.h>” in error.h

 

Please note: you can download thefollowing script and check whether you instalation is correct.

 

==========

wget http://lifewithqmail.org/inst_check

==========

run the script from the shell if the installtion is correct, you will get a message like your installtion looks good.

Nagios installation

yum install httpd php
yum install gcc glibc glibc-common
yum install gd gd-devel

/usr/sbin/useradd -m nagios
passwd nagios

/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache

cd /usr/src
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

cd /usr/src
tar xzf nagios-3.2.1.tar.gz
cd nagios-3.2.1
./configure –with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
vi /usr/local/nagios/etc/objects/contacts.cfg
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
service httpd restart

cd /usr/src
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure –with-nagios-user=nagios –with-nagios-group=nagios
make
make install

chkconfig –add nagios
chkconfig nagios on
Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios start

See if SELinux is in Enforcing mode.
getenforce
Put SELinux into Permissive mode.
setenforce 0

Installing openvz

For setting up an openvz server, first you need to change the custom kernel in the server and then install OpenVZ kernel in the node.

1. Downloading and Installing OpenVZ Kernel

==============================================

a, yum pre-setup

If you want to use yum, you should set up OpenVZ yum repository first.

Download openvz.repo file and put it to your /etc/yum.repos.d/ repository. This can be achieved by the following commands, as root:

# cd /etc/yum.repos.d
# wget http://download.openvz.org/openvz.repo
# rpm --import  http://download.openvz.org/RPM-GPG-Key-OpenVZ
b,kernel installation 
First, you need to choose what “flavor” of the kernel you want to install. Please refer to Kernel flavors for more information.
http://wiki.openvz.org/Kernel_flavors
For installing run the following command 
# yum install ovzkernel[-flavor]

 

Configuring Boot Loader and other parameters

=======================

a, In case you use the GRUB loader, it will be configured automatically. You should only make

sure that the lines below are present in the /boot/grub/grub.conf file on the Node:

 

title Fedora Core (2.6.8-022stab029.1)

root (hd0,0)

kernel /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5 quiet rhgb

initrd /initrd-2.6.8-022stab029.1.img

However, we recommend that you configure this file in the following way:

Change Fedora Core to OpenVZ (just for clarity, so the OpenVZ kernels will not be

mixed up with non OpenVZ ones).

Remove all extra arguments from the kernel line, leaving only the root=… parameter.

At the end, the modified grub.conf file should look as follows:

title OpenVZ (2.6.8-022stab029.1)

root (hd0,0)

kernel /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5

initrd /initrd-2.6.8-022stab029.1.img

 

b, Once you’ve installed the kernel and the headers, you want to add a few parameters to /etc/sysctl.conf

to prep the system for running OpenVZ. For example, you need to tell the system to enable IP

forwarding so that the VPSes can have networking as well. Just add these lines to sysct.conf if they’re

not already present, or make sure they match:

net.ipv4.ip_forward = 1

net.ipv4.conf.default.proxy_arp = 0

net.ipv4.conf.all.rp_filter = 1

kernel.sysrq = 1

net.ipv4.conf.default.send_redirects = 1

net.ipv4.conf.all.send_redirects = 0

To apply the changes issue the following command:

# sysctl -p

After installing the kernel and making these changes, you will need to reboot the system. Please set

single boot before rebooting the kernel, use the following command::

#echo “savedefault –default=0 –once” | grub –batch

#reboot

Remember to replace “0” to match your own config.

c, SELinux

SELinux should be disabled. # vi /etc/sysconfig/selinux

Add the following line to this file.

SELINUX=disabled

 

2. Downloading and Installing OpenVZ Packages

============================================

After you have successfully installed and booted the OpenVZ kernel, you can proceed with

installing the user-level tools for OpenVZ. You should install the following OpenVZ packages:

 

*vzctl: this package is used to perform different tasks on the OpenVZ Virtual Private

Servers (create, destroy, start, stop, set parameters etc.).

• vzquota: this package is used to manage the VPS quotas.

• vzpkg: this package is used to work with OpenVZ templates.

You can download the corresponding binary RPMs from http://openvz.org/download/utils/.

On the next step, you should install these utilities by using the following command:

# rpm –Uhv vzctl*.rpm vzquota*.rpm vzpkg*.rpm

After installation of all the above modules, Now you start the OpenVZ. Please use following

command:

/etc/init.d/vz start

This will load all the needed OpenVZ kernel modules. During the next reboot, this script will be executed automatically.

Installing OS Templates

========================

Template (or package set) is a set of package files to be installed into a VPS. Operating system templates are used to create new Virtual Private Servers with a pre-installed operating system.

You can also use one of the already pre-cached OS templates available at http://openvz.org/download/template/cache/ for the VPS creation. To this effect, you should download the corresponding OS template and place it to the /vz/template/cache

directory on the Node.

How to create a vps

==================

You can use the following commands to create a vps.

First you need to select a vps id. The id 0 is used for the hardware node itself.

# vzlist -a

This command list all the vps in the host. You can create a vps using the default template or you can

define a template package and a configuration. The default creation is as follows,

# vzctl create 101

If you want to create a vps using a OS template as follows

# vzctl create 101 –ostemplate fedora-core-4 -i –config vps.basic

Here, 101: is the vp id

fedora-core-4: is the OS template

vps.basic: is the configurations defined in vps.basic.conf

 

#vzctl set 101 –onboot yes –save

–onboot yes : Make sure VPS boots automatically after a reboot.

### Set Hostname for VPS ###

 

# vzctl set 101 –hostname vps.example.com –save

 

### Set IP for VPS ###

#vzctl set 101 –ipadd 102.111.11.1 –save

 

### Set Nameservers IP for VPS ###

# vzctl set 101 –nameserver 202.168.1.1 –save

 

####Set user and password for the vps####

#vzctl set 101 –userpasswd root:HF%#&&TRUF%$F

 

####Command for setting memory limit in the Vps####

#vzctl set 101 –slmmemorylimit 1024M –save

 

##### Set Disk quota for VPS (10G min [soft] and 11G max hard limit) ###

#vzctl set 10 –diskspace 10G:11G –save

After compleating the above steps, now the time to start the vps.

Use the following command

#vzctl start 101

 

Install Teamspeak

The first step would be creating a directory for your TS3 installation.

mkdir teamspeak3

cd teamspeak3

wget http://ftp.4players.de/pub/hosted/ts3/releases/beta-5/teamspeak3-server_linux-amd64-3.0.0-beta5.tar.gz

tar zxvf teamspeak3-server_linux-amd64-3.0.0-beta5.tar.gz

cd teamspeak3-server_linux-amd64

create a ts3server.ini

./ts3server_linux_amd64 createinifile=1

Now close it by pressing Ctrl-C. Don’t forget to copy/paste the admin
login and password since you’ll need it later. it looks like this.

——————————————————————
I M P O R T A N T
——————————————————————
Server Query Admin Acccount created
loginname= “serveradmin”, password= “42ds23ak”
——————————————————————

Now that youv’e setup everything (including your license key), it’s time
to start TS3 using screen so that it runs in the background. Don’t worry
you can switch your to it anytime you want.

Let’s first create a file. I named mine /ts3-server/.

vi ts3-server

Add the following line.

screen -A -m -d -S ts3-server ./ts3server_linux_amd64

Save your file and then chmod it so it’s recognized as an executable by
your system.

chmod +x ts3_run

To go back to your TS3’s screen, just type…

screen -r ts3-server

To close your TS3 screen without closing your server, just type…

Ctrl-A-D