Find us on facebook

Jul 3, 2015

Setup SVN server on ubuntu 14.04

Start the installation .
Step 1 : Update the repositories.
sudo apt-get update

Step 2 : Install SVN and apache webserver (To access SVN through http ) .
sudo apt-get install subversion apache2 libapache2-svn apache2-utils

Step 3 » Create a directory and create a new repository in that directory ( testrepo is the repository name ).
sudo mkdir -p /svn/repos/
sudo svnadmin create /svn/repos/testrepo

Step 4 » Change ownership for the repository.
sudo chown -R www-data:www-data /svn/repos/testrepo

Step 5 » Create a file testrepo.conf in /etc/apache2/sites-available/ and add the below lines for creating apache virtual host.
<Location /svn>
  DAV svn
  SVNParentPath /svn/repos/
  AuthType Basic
  AuthName "Test Repo"
  AuthUserFile /etc/svnpasswd
  Require valid-user
</Location>
SVNParentPath /svn/repos/ : Parent Directory without repository name.
AuthUserFile /etc/svnpasswd : File need to be created ( Step 8) for user details.

Step 6 »Enable the Site ( testrepo in the below command should match the file name created in the previous step )
sudo a2ensite testrepo

Step 7 » Restart or reload apache service.
sudo service apache2 reload

Step 8 » Create user for accessing repository and add the user details to /etc/svnpasswd file.
Use this command to create first user.
sudo htpasswd -cm /etc/svnpasswd user1

Use the same command without c option to create additional users.
sudo htpasswd -m /etc/svnpasswd user2

Step 9 » Access http://yourip/svn/testrepo in your browser ( Eg http://10.0.1.15/svn/testrepo ) and you can see the page like below after successful authentication.

Install Subversion Using Yum CentOS 6.x

yum install mod_dav_svn subversion

sudo vim /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn

   # Limit write permission to list of valid users.
   #<LimitExcept GET PROPFIND OPTIONS REPORT>
      # Require SSL connection for password protection.
      # SSLRequireSSL

      AuthType Basic
      AuthName "Subversion repositories"
      AuthUserFile /etc/svn-auth-users
      Require valid-user
   #</LimitExcept>
</Location>

apachectl configtest
sudo service httpd restart

================================
sudo yum install mod_auth_mysql
sudo vi /etc/httpd/conf.d/subversion.conf
    AuthType Basic
    AuthName "svn repository"
    Require valid-user
    AuthMySQLEnable on
    AuthMySQLPwEncryption sha1
    AuthMySQLHost localhost
    AuthMySQLUser username(of redmine)
    AuthMySQLPassword password
    AuthMySQLDB redmine
    AuthMySQLNameField login
    AuthMySQLPasswordField hashed_password
    AuthMySQLUserTable "users"
apachectl configtest
sudo service httpd restart
===============================
Next we have to actually create the password file that you specified in the previous step. Initially you'll use the -cm arguments. This creates the file and also encrypts the password with MD5. If you need to add users make sure you simply use the -m flag, and not the -c after the initial creation.

## Create testuser ##
htpasswd -cm /etc/svn-auth-users testuser
New password:
Re-type new password:
Adding password for user testuser

## Create testuser2 ##
htpasswd -m /etc/svn-auth-users testuser2
New password:
Re-type new password:
Adding password for user testuser2

mkdir /var/www/svn
cd /var/www/svn

sudo chown -R apache:apache /var/www/svn

svnadmin create testrepo
sudo chown -R apache.apache testrepo

## If you have SELinux enabled (you can check it with "sestatus" command) ##
## then change SELinux security context with chcon command ##

chcon -R -t httpd_sys_content_t /var/www/svn/testrepo

## Following enables commits over http ##
chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo

## Fedora 21/20/19/18 and CentOS/Red Hat (RHEL) 7 ##
systemctl restart httpd.service

## CentOS/Red Hat (RHEL) 6.6/5.11 ##
service httpd restart
## OR ##
/etc/init.d/httpd restart

Goto http://localhost/svn/testrepo address and you should see popup to enter username and password:

Then Configure repository
To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf file:

## Disable anonymous access ##
anon-access = none

## Enable access control ##
authz-db = authz

Create trunk, branches and tags structure under testrepo
Create “template” directories with following command:
mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}

Then import template to project repository using “svn import” command:
Shell

svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/testrepo/
Adding         /tmp/svn-structure-template/trunk
Adding         /tmp/svn-structure-template/branches
Adding         /tmp/svn-structure-template/tags

Committed revision 1.

Import online project to SVN folder
svn import /var/www/vhosts/xxx.cf/httpdocs/yyy http://xx.xxx.xxx.xx/svn/testrepo2 -m "first import"

Go to domain/httpdocs and use following command to get first repo to this folder
svn co http://88.208.221.72/svn/testrepo2

After each commit, to update online site,
Go to domain/httpdocs and use following command
svn co http://88.208.221.72/svn/testrepo2

Jul 2, 2015

Install VSFTP in CentOS 6

Check what ports are standard for a given service
cat /etc/services | grep ftp

View running service
netstat -antlp | grep ftp

Install vsftpd on your virtual private server in the command line:
sudo yum install vsftpd

Install the FTP client, so that we can connect to an FTP server:
sudo yum install ftp

Open up the configuration file:

sudo vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO (vsftpd will not allow anonymous, unidentified users to access the VPS's files)

local_enable=YES

chroot_local_user=YES (all the local users will be within their chroot and will be denied access to any other part of the server.)

Add following lines to end of the file
pasv_enable=YES
pasv_min_port=64000
pasv_max_port=64321
port_enable=YES

Restart vsftpd:
sudo service vsftpd restart

To vsftpd runs at boot, run chkconfig:
chkconfig vsftpd on


Jul 1, 2015

Configure BitBucket Git Repository in Eclipse Environment. Git version control with Eclipse (EGit)

Open Eclipse
Click on Help menu
Click Install New Software

Install eGit into Eclipse. Git version control with Eclipse (EGit)
URL: http://download.eclipse.org/egit/updates


Click Add


Give a name and click OK


Click Next.

After install Go to Window->Open perspective->Other 


Select Git and click OK.

Then Clone a Git repo


OR





Click next. 


Select the branches you want and click next


Browse the directory you want to setup the project and click finish.

Go to Window->Open perspective->Other and select resource

Click OK

Go to 
‘File’ > ‘Import’ > ‘Git’ > ‘Projects from Git’ > ‘Existing local repository’ > ‘Select a Git Repository’ >
‘Import as General Project’ >
‘Next’ >
‘Finish’
The code should then appear in your ‘Project Explorer’ window as a normal project
Now make changes to your file as you want
Look at ‘Git Staging’ view to see your changed files and Click ‘Commit and Push‘




That's all...





FTP Connection refused error

Verify that ftp server installed:

Debian Linux
$ dpkg -l | grep -i "ftp"
Output:
ii  ftpd                           0.17-21                       FTP server

OR:
$ dpkg -l | grep -i ftp

Red Hat/Novell Suse/Fedora Linux:
# rpm -qa | grep -i "*ftp*"

If you have the ftp package installed it will return output. If the ftp package is not installed, it will notify or not give any output. If not installed, Install FTP server.

Red Hat/Fedora Linux install vsftpd server :
# up2date vsftpd

Fedora Linux:
# yum install vsftpd

Debian Linux:
# apt-get install vsftpd

Next configure vsftpd by modifying /etc/vsftpd.conf file.

Is ftp server running (is port 21 open)?
Login to server using ssh and telnet port 21 (to see port is open or not):
$ telnet localhost 21

Next run netstat -tulpn command to see if port 21 is in open:
$ netstat -tulpn | grep :21

Output:
tcp        0      0 0.0.0.0:21             0.0.0.0:*               LISTEN

OR :
$ netstat -a | grep ftp
Output:
tcp        0      0 *:ftp                   *:*                     LISTEN

If port is not open, start ftp server /service.
RedHat/Fedora Linux :
# service vsftpd start

Debian Linux:
# /etc/init.d/vsftpd start

FTP user permissions
File /etc/ftpusers - list of users disallowed use vsftpd server access.

Security or Firewall
Check iptables firewall/tcpd does not block access to ftp server. Run following command on ftp server
# iptables -L -n

Use iptables rules to open port 21. Make sure file /etc/hosts.deny (TCPD wrappers) does not block access to port 21 for your ftp host.

Disable Telnet in CentOS

Telnet is un secure network protocol.It sends clear text passwords over network. Its highly recommended to disable it on any public server and use ssh server instead.


  1. sudo nano /etc/xinetd.d/telnet
  2. disable = yes
  3. CTRL+O (to save) and CTRL+X (to exit)
  4. Now disable it in chkconfig: chkconfig telnet off
  5. /etc/rc.d/init.d/xinetd restart  |  /etc/rc.d/init.d/xinetd stop

Setup virtual host in any location

Step 1: Go to "C:/Windows/System32/drivers/etc" and open the "hosts" file in Notepad.

Step 2: At the bottom of the hosts file, below all the other text, add a new line with the following:
127.0.0.1   mysite.local    #My Test Site

Step 3: Open "httpd.conf" in "C:/wamp/bin/apache/Apache2.2.21/conf/"

Step 4: under "# Virtual hosts", uncomment (remove the hashtag [#]) before the line "Include conf/extra/httpd-vhosts.conf"

Step 5 : Go to "C:/wamp/bin/apache/Apache2.2.21/conf/extra" and open the file "httpd.vhosts.conf".
<Directory D:/Projects>
Require all granted
</Directory>
 <VirtualHost *:80>  
DocumentRoot "D:\Projects\skwirk"
ServerName skwirk.ml

</VirtualHost>