Installing Subversion with Plesk 8.0/ CentOs 4.3 as Subdomain

==== pre-SVN configuration ====

* Plesk 8.0

* CentOS

* Root access via SSH

* Subdomain setup via Plesk 8.0 Administrator page. In my case, I used svn.my-domain.com as the sub domain

* A folder /var/svnrepo/ is used to house my SVN repository.

After you created the subdomain for your domain, you can proceed to the next step: installing Subversion

==== A. Installing Subversion ====

To install subversion, all you have to do is SSH into the box as the root user. (# denotes the root prompt)

* #yum install subversionThis command will painlessly install the subversion package to the CentOS.

* #cd /etc/httpd/modulesChange the current directory to the modules folder of Apache, where all the plugins of Apache are installed.

* #yum mod_dav_svnThis command will install the mod_dav_svn to apache

* #svn –versionThis command will ensure that you have successfully installed subversion. (At the current time of writing, the version of this SVN package is 1.1.4, while the current version of SVN is 1.4 — maybe another article on how to upgrade SVN?)

* #mkdir /var/svnrepoThis is our root repository.

* #svnaddmin create /var/svnrepoThis command will create a subversion repository in the /var/svnrepo folder.

* #chmod -R 777 /var/svnrepoChanging the permision of svnrepo folder to allow Apache/Subversion to have read/write rights. Without changing the permissions, you will get an error when you are trying to access the repository via your browser.

==== B. Configuring Apache ====

So with the painless installation of Subversion, now we can configure Apache to begin to serve our repository. First of all, you will need to make sure that Apache is loading the mod_dav_svn.so file. Personally, I like to use mc (Midnight Commander) for text-editting ((( *) I can use VI but it’s not on my list of user-friendly software so I opt for a more “notepad-like” text editor. If you don’t have Midnight Commander installed, run **#yum install mc** and that should take care of it. The nto run Midnight Commander, just type in #mc. If you use Putty like I do, use **#mc -a** instead to get a nicer frame instead of the weird ASCII characters.)).

* Open the file **/etc/httpd/conf/httpd.conf**

* Search for **mod_dav_svn.so** in the Modules section. If you don’t find this line in **httpd.conf**, then check the folder /etc/httpd/conf.d/ for other .conf files. I have a subversion.conf file here which is included in the main **/etc/httpd/conf/httpd.conf** at initialization time. In this subversion.conf file, there are these 2 lines to make sure that Apache loads the SVN modules:

#File: /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module modules/mod_dav_svn.so

LoadModule authz_svn_module modules/mod_authz_svn.so

Cool! Apache does load the Subversion modules. Now we need to configure our subdomain created using Plesk earlier to use with Subversion. But let’s go over how Plesk organizes our file system.

==== C. Working with Plesk: The primer ====

If you’d like to by-pass the web-based administration page of Plesk and do some advanced customization, then here is how Plesk is organizing the files system:

* Web-docs (your domains) are stored under **/var/www/vhosts/**

* Custom configuration for your domain is stored under **/var/www/vhosts/[you_domain_name]/conf/vhost.conf**

* The **httpd.include** file in **/var/www/vhosts/[you_domain_name]/conf/** will be overwritten everytime you use the web-based Plesk to update your domain configuration. Hence manual updates of this file is NOT advisible. Your changes will be lost, so why bother. If you want to customize the domain, create a **vhost.conf** file in the conf/ folder instead.

* Similarly, for sub-domains, the main .conf file are **/var/www/vhosts/[you_domain_name]/subdomains/[you_subdomain_name]/conf/vhost.conf**. All you have to do is to create this vhost.file and it will be automatically included in the main httpd.conf file of apache.

Also,

* Only **Root users** can create vhost.conf files.

* After you make changes to the conf files, you have to tell Plesk to reload the new configuration. To do so, run#/usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –vhost-name=

For more information, please consult the [[http://download1.swsoft.com/Plesk/Plesk7.5/Doc/plesk-7.5r-admins-guide-html/apas02.html|Plesk’s Admins Guide on sub-domain customization]]

==== D. Customizing Sub-Domain configurations ====

As I created a subdomain “svn” for my site, makefun.us, I had to create a vhost.conf file under **/var/www/vhosts/makefun.us/subdomains/svn/conf/vhost.conf**. Also, my repository is under **/var/svnrepo/**, so here is the content of the vhost.conf file

#svn.makefun.us — vhost.conf file

DAV svn

SVNPath /var/svnrepo/

AuthType Basic

AuthName “Makefun.us Subversion Repository”

AuthUserFile /etc/svn-auth-file

Require valid-user

First of all, with **DAV svn** we ask Apache to hand over to the mod_dav_svn module when there’s a request to **http://svn.makefun.us** (the location /). Then we specify the **repository’s root** at **/var/svnrepo/**. Then we specify that this is a private repository by asking Apache to provide **Basic Authorization** (which means the authenticated password will be transmitted as text via the wire). Well, we name our private zone the “Makefun.us Subversion Repositor” and the user accounts are stored in **/etc/svn-auth-file**. Finally, to access the repository via the web, the user must be able to authenticate — as we only allow valid-user to access (Require valid-user)

Next, I created a new user account for myself so that I can access the repository:

#htpasswd -c /etc/svn-auth-file my_user_name

At this point, you can either restart Apache by running **#server httpd restart** or just use the **websrvmng** of Plesk to pick up the new configuration. I just restarted Apache.

If everything works out correctly for you, if you point your browser to **http://svn.yourdomain.com**, you would see a prompt for username and password. Enter your just created account, you can access to your very own the SVN repository

Plesk backup

1) using  PleskX.pl

bash# cd /home/support/backup-agent
bash# perl PleskX.pl –dump-domains=< domain_name > -o=< output_file_name >

2) using pleskbackup

a) To back up all data, including server and control panel configuration, remote database servers, license keys, user accounts, Web sites, databases, and mailboxes with e-mail messages.

/usr/local/psa/bin/pleskbackup –all <backup_file_name>

b) To back up all user accounts with all users’ sites,
/usr/local/psa/bin/pleskbackup –clients <backup_file_name>

c) To back up selected user accounts with web sites:
1 Create a text file and list there the control panel login names of the
clients whose accounts you wish to back up, one login name per line.
For example:
client1
client2
2 Save the file.
3 Run the command
/usr/local/psa/bin/pleskbackup –clients <backup file name> -list <file name>

where <file name> is the file listing the objects you wish to backup that you created
at the step 1.

d) To back up selected web sites:
1 Create a text file and list there the domain names of the sites that you
wish to back up, one domain name per line. For example:
domain1.com
domain2.com
2 Save the file.
3 Run the command
/usr/local/psa/bin/pleskbackup –domains <backup file name> -list <file name>
where <file name> is the file listing the objects you wish to backup that you created
at the step 1.

e) To back up a specific user account with all user’s web sites.
echo ‘client’s login name‘ | /usr/local/psa/bin/pleskbackup –clients <backup file name> -list –

f) To back up a specific web site.
echo ‘domain name‘ | /usr/local/psa/bin/pleskbackup –domains <backup_file_ name> -list –

Details of Email, FTP, Database users from PSA database

In Plesk, PSA database stores details of email, ftp and database users in plain text format. So it is easy to get the details from the plesk database.

bash# mysql -u admin -p`cat /etc/psa/.psa.shadow`
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 95
Server version: 5.0.51 Source distribution

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.

mysql> use psa
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql>

EMAIL ACCOUNT DETAILS

mysql> SELECT mail.mail_name, accounts.password, domains.name FROM mail, accounts, domains WHERE domains.id=mail.dom_id AND mail.account_id=accounts.id;

Use following command.

mysql> SELECT CONCAT(mail.mail_name,’@’,domains.name) AS Email_Address , accounts.password AS Password FROM mail, domains, accounts WHERE domains.id=mail.dom_id AND mail.account_id=accounts.id;

DATABASE USER DETAILS

mysql> SELECT domains.name, data_bases.name, data_bases.type , db_users.login,accounts.password FROM domains, data_bases, db_users, accounts WHERE domains.id=data_bases.dom_id AND data_bases.id=db_users.db_id AND db_users.account_id=accounts.id;

FTP / SYSTEM USER DETAILS

mysql> SELECT domains.name, sys_users.login, accounts.password, sys_users.home, sys_users.shell, sys_users.quota FROM domains, accounts, hosting, sys_users WHERE domains.id=hosting.dom_id AND hosting.sys_user_id=sys_users.id AND sys_users.account_id=accounts.id;

IP Address DETAILS

mysql> SELECT domains.name, IP_Addresses.ip_address, IP_Addresses.mask, IP_Addresses.iface, IP_Addresses.type FROM domains, IP_Addresses, hosting WHERE domains.id=hosting.dom_id AND hosting.ip_address_id=IP_Addresses.id;

Originally posted by : Praveen’s Matrix