Friday, March 1, 2013

Subversion installation and configuration

Install Subversion
First of all make sure whether these modules are available, if it's not there, do the needful.
#httpd -M | grep dav

dav_module (static)
dav_fs_module (static)
dav_lock_module (static)
dav_svn_module (shared)
Also make sure whethe neon installed or not, if not installed.
http://www.webdav.org/neon/neon-0.28.4.tar.gz
tar -xzvf neon-0.28.4.tar.gz
cd neon-0.28.4
./configure --prefix=/usr/local/neon
installation
[/usr/src]# wget wget http://subversion.tigris.org/downloads/subversion-1.6.3.tar.bz2
tar xfj subversion-1.6.3.tar.bz2
wget http://www.sqlite.org/sqlite-amalgamation-3.7.0.tar.gz
tar -zxvf sqlite-amalgamation-3.7.0.tar.gz
cd subversion-1.6.3
mkdir sqlite-amalgamation

cp /usr/src/sqlite-3.7.0/sqlite3.c /usr/src/subversion-1.6.3


./configure --prefix=/usr/local/subversion --with-apr=/home/cpeasyapache/src/httpd-2.2.23/srclib/apr/ --with-apr-util=/home/cpeasyapache/src/httpd-2.2.23/srclib/apr-util/ --with-neon=/usr/local/neon

make
make install

mkdir -v /home/user/directory/repository

/usr/bin/svnadmin create --fs-type fsfs /usr/local/subversion/repository
That should create a subversion repository under /usr/local/subversion/repository.
ls /usr/local/subversion/repository

conf/ dav/ db/ format hooks/ locks/ README.txt
You should be able to see those files under the repository directory.
chown -R user:nobody /home/user/dir/repository
chmod -R 770 /home/user/dir/repository

Put the following entries in /usr/local/apache/conf/userdata/std/2/user/domain/svn.conf


DAV svn
SVNListParentPath On
SVNPath /home/user/directory/repository
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /home/user/directory/repository/conf/authz
Require valid-user


Save it.
Then run:
/scripts/ensure_vhost_includes --user=username
Adding SVN users:
htpasswd -cmd /home/user/directory/repository/conf/auth username
Setting up the initial repository layout:
A repository mostly contains 3 standard folders.
branches
tags
trunk
For creating those standard folders in a repository, create a temporary folder anywhere you want, /tmp would be a good idea, with the following subdirectories.
mkdir -pv /tmp/subversion-layout/{branches,tags,trunk} touch /tmp/subversion-layout/trunk/test.html

/usr/local/subversion/bin/svn import /tmp/subversion-layout/ http://domain.com/dir

For reference
http://sven.webiny.com/subversion-on-cpanel-3-with-centos-55-and-easyapache-32/
http://www.howtoforge.com/apache_subversion_repository

Install and Configure NFS

If we need to mount /mntsource on NFS server 192.168.1.1 to /mntclient on remote client machine 192.168.1.2, use the following method. You can also mount sub-directories, like /mntsource/dir1/dir2 --> /mntclient/dir1/dir2/dir3

On server 192.168.1.1

Install nfs and portmap softwares

yum install nfs-utils nfs-utils-lib portmap

Check nfsd module is loaded in the kernel.

[root@server ~]# lsmod | grep -i nfs
nfsd 177170 13
lockd 51571 1 nfsd
nfs_acl 1635 1 nfsd
auth_rpcgss 26415 1 nfsd
exportfs 2414 1 nfsd
sunrpc 137004 13 nfsd,lockd,nfs_acl,auth_rpcgss

If its not present, insert it to kernel.
modprobe nfsd

Add this to /etc/rc.local so that on every boot this module is loaded
What we need:
192.168.1.1 (/mntsource) --> 192.168.1.2 (/mntclient)
service portsentry stop
service portmap start
service nfs start
Add in /etc/exports on the nfs server to mount from remote server 192.168.1.2 to nfs server

/mntsource 192.168.1.2(ro,no_root_squash)
or
/mntsource 192.168.1.2(rw,sync)

Then run
exportfs -a

On remote client machine (192.168.1.2)
yum install nfs-utils nfs-utils-lib portmap
service portsentry stop
service portmap start
Mount to source NFS server
mount -t nfs 192.168.1.1:/mntsource /mntclient
Use df command to see if mounted
df -h

If you need to get this done all time when the system boots, add the following to the /etc/fstab file
192.168.1.1:/mntsource /mntclient nfs soft,nfsvers=2 0 0
NOTE: The value of nfsvers may change with the nfs server version

Htscanner Install for enabling php value in .htaccess in suphp/cgi


Allow to use htaccess-like file to configure PHP in a suphp/CGI environment.

cd /usr/src
download htscanner-1.0.1.tgz
tar -zxf htscanner-1.0.1.tgz
cd htscanner-1.0.1
phpize
./configure --enable-htscanner --with-php-config=/usr/local/bin/php-config
make
make install

Collect the extension_di from the "make install" output.

Add in php.ini

[htscanner]
extension = "htscanner.so"
config_file = ".htaccess"
default_docroot = "/"
default_ttl = 300
stop_on_error = 0

If you are using /usr/local/bin/php-config for --with-php-config then it will always comes to the default path( easyapache), so you don't have to give extension_dir

Add the following line in a .htaccess and see if it works in a phpinfo page. Keep "Off" or "On" as needed.

php_value register_globals Off


You can avoid adding ifmodule tag in .htaccess by enable htscanner module for apache
Go to the unzipped package location
Make sure apache has mod_so

/usr/local/apache/bin/httpd -l | grep mod_so.c
mod_so.c
Compile the module by
cd /usr/local/src

download mod_htscanner2.c
/usr/local/apache/bin/apxs -c -a -i mod_htscanner2.c
Restart apache
/usr/local/apache/bin/apachectl configtest
/usr/local/apache/bin/apachectl restart
/usr/local/cpanel/bin/apache_conf_distiller --update
grep mod_htscanner2.so /usr/local/apache/conf/httpd.conf
LoadModule htscanner_module modules/mod_htscanner2.so

R1soft : Moving Disk Safe

http://wiki.r1soft.com/display/CDP3/Copying+and+Moving+Disk+Safes http://wiki.r1soft.com/display/CDP3/Attaching+Disk+Safes

R1soft : cPanel Addon

Refer :

http://wiki.r1soft.com/display/CDP3/Adding+Control+Panel+Instances
http://wiki.r1soft.com/display/CDP3/Setting+up+cPanel+Plugin

To Activate control panel in policy . enable control panel in Disk safe

R1soft Installation

Installing CDP server (On Backup Server)

USING YUM :-
Login to the backup server.
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=0
gpgcheck=0

yum install r1soft-cdp-enterprise-server --enablerepo=r1soft
(wont work now since r1soft chnaged its rpm names so try below command)
OR
yum install serverbackup-enterprise-server --enablerepo=r1soft

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
Location of server Key file /usr/sbin/r1soft/conf/server.allow/127.0.0.1

======================================================================
Installing CDP agent (On Client Server)
USING YUM
Login to the data server.
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=0
gpgcheck=0

yum install r1soft-cdp-enterprise-agent --enablerepo=r1soft
OR
yum install serverbackup-enterprise-agent --enablerepo=r1soft
USING RPM
rpm -qa |grep r1soft
wget http://repo.r1soft.com/release/trials/R1Soft-EnterpriseEdition-linux32.zip
wget http://repo.r1soft.com/release/trials/R1Soft-EnterpriseEdition-linux64.zip
unzip R1Soft-EnterpriseEdition-linux64.zip

If it is 64 bit, then
cd rpm-linux64/
rpm -i *.rpm
If it is 32 bit, then
cd rpm-linux32/
rpm -i *.rpm

make sure that port 8443 & 1167 are allowed in the csf.
Configure and Start the CDP Agent Web-based User Interface
Enter the following command to get key from the CDP server.
r1soft-setup --get-key https://IP_of_CDP_server:

Configure My.cnf
vi /etc/my.cnf
add
[mysqld_safe]
basedir=/usr
Restart MySQL
/etc/init.d/mysql restart
Adding hcpdriver kernel module for R1Soft
Check kernel version
uname -r
check hcpdriver is present in /lib/modules/r1soft/
ll /lib/modules/r1soft/
If present, check the it has the same version of current running kernel as follows.
--------
[root@angel ~]# ll /lib/modules/r1soft/
total 76
-rw-r--r-- 1 root root 69658 Jan 30 2011 hcpdriver-cki-2.6.35.10-19.ko
lrwxrwxrwx 1 root root 49 Apr 7 11:13 hcpdriver.o -> /lib/modules/r1soft/hcpdriver-cki-2.6.35.10-19.ko
[root@angel ~]# uname -r
2.6.35.10-19
[root@angel ~]#
--------
Creating a new hcpdriver.ko when a new kernel is compiled.
When we compile a kernel, we need to create the hcpdriver from the same server where kernel is compiled and rpm is made. We have to use the build directory of the kernel compilation where all the necessary build details for creating the kernel modules lie. For example, we have compiled a kernel 3.3.3D in the server proton. The kernel will be created in the path /usr/src/redhat/RPMS/x86_64/kernel-3.3.3D-1.x86_64.rpm and the corresponding build directory will be formed at /usr/src/redhat/BUILD/kernel-3.3.3D. When we install the kernel rpm in the same server, a link will be created to this build directory like follows.
root@newsrv [/]# ls -al /lib/modules/3.3.3D/build
lrwxrwxrwx 1 root root 35 Jun 19 04:28 /lib/modules/3.3.3D/build -> /usr/src/redhat/BUILD/kernel-3.3.3D
If we install this kernel rpm on a different server, a similar link will be created but there will be no build directory /usr/src/redhat/BUILD/kernel-3.3.3D. For example see izzy server
root@izzy [~]# ll /lib/modules/3.3.3D/build
lrwxrwxrwx 1 root root 35 Jun 23 02:25 /lib/modules/3.3.3D/build -> /usr/src/redhat/BUILD/kernel-3.3.3D

root@izzy [~]# ll /usr/src/redhat/BUILD/kernel-3.3.3D
/bin/ls: /usr/src/redhat/BUILD/kernel-3.3.3D: No such file or directory
So, we need to compile a custom kernel module from the server where the rpm is created. Lets compile hcpdriver. Make a directory /usr/src/3.3.3Dhcp and give it as the dest dir. hcpdriver will be formed there.
mkdir /usr/src/3.3.3Dhcp
root@newsrv [/etc/yum.repos.d]# r1soft-setup --get-module --kernel-dir /lib/modules/3.3.3D/build --dest /usr/src/3.3.3Dhcp/
Checking for binary module
Waiting |
No binary module found
Gathering kernel information
Gathering kernel information complete.
Creating kernel headers package
Checking '/lib/modules/3.3.3D/build' for kernel headers
Found headers in '/lib/modules/3.3.3D/build'
Compressing...
uploading kernel package 99% 33MB 3.5MB/s 00:00 ETA
Starting module build...
Complete.
Saving kernel module to '/usr/src/3.3.3Dhcp//hcpdriver-cki-3.3.3D.ko'
Kernel module is now installed.
Use '/etc/init.d/cdp-agent restart' to load the new driver

You can use this hcpdriver-cki-3.3.3D.ko on all servers where you are installing kernel 3.3.3D. Copy this to the staffbox server /home/download/kernel/generic. Create a symlink for the .ko file to hcpdriver.ko, so that it looks like below. Now anyone can download the hcpdriver you created.
[root@im generic]# ll /home/download/kernel/generic/hcpdriver.ko
lrwxrwxrwx 1 root root 23 Jun 24 06:18 /home/download/kernel/generic/hcpdriver.ko -> hcpdriver-cki-3.3.3D.ko
Configuring hcpdriver on a server.
For 64bit servers, Download the hcpdriver to the path /lib/modules/r1soft/
Note the file downloaded, make a sylimk for hcpdriver.o for the file downloaded.
root@izzy [~]# ll /lib/modules/r1soft/hcpdriver.o
lrwxrwxrwx 1 root root 43 Jun 24 07:58 /lib/modules/r1soft/hcpdriver.o -> /lib/modules/r1soft/hcpdriver-cki-3.3.3D.ko
Restart cdp-agent
/etc/rc.d/init.d/cdp-agent start
See if it lists in lsmod
root@izzy [~]# lsmod | grep -i hcpdriver
hcpdriver 571990
You are Done !!


In openVZ node, fisrt install kernel-devel and then try r1soft-setup --get-module
yum install kernel-devel-$(uname -r) -y
r1soft-setup --get-module
OR
Use RPM to install kernel-devel
rpm -ivh http://download.openvz.org/kernel/branches/rhel6-2.6.32/042stab053.5/vzkernel-devel-2.6.32-042stab053.5.x86_64.rpm
r1soft-setup --get-module

Take the interface from browser
http://IP:8080
Enter using username & password.
Now you can add the agent to the CDP server and can create volume and disk safe and also the policies and schedule backup.

How to set separate DNS for subdomain

"You can create a separate DNS Zone for a subdomain if you
manually delete it's "A" record from it's parent domain name's DNS Zone.
You could then modify/add the NS entries for the subdomain itself."

First crate a zone file for subdomain, then set he nameservers there
You are done!