Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Sunday, December 12, 2010

Create subversion repository on Ubuntu

Recently I had to setup a ubuntu box with subversion on it. I had to also provide web access from subversion with authentication. After few hiccups I managed to do this with installing few packages and configuring them.

Step 1: login to your ubuntu box

#ssh root@x.y.z.t

Step 2: Install required packages
#yum install subversion
#yum install mod_dav_svn httpd

Step 3: Create a parent directory where all your repositories will be set up.
#mkdir -p /srv/svn

Step 4: Create a sample repository using svnadmin tool
#svnadmin create /srv/svn/app
In this step we have created a repository named as app.

Step 5: Change the user and group of the created app repository to give the permission to apache user.
#chown -R apache.apache /srv/svn/app
This user is created when you installed httpd package in step 2. Without this step user will not be able to access it via webserver http protocal, they can however access it using command promp using ssh protocol.

Step6: Restart apache webserver.
#service httpd restart

Step 7: Create a password file for the authentication of users which will be accessing your app repository via http protocol.
#mkdir -p /srv/auth/svn/
#htpasswd -c /srv/auth/svn/app.htpasswd ahsan.javed
In this step we are creating a directory first to store the htpasswd file. then using the htpasswd tool we are creating an user name and password hash entry in created file. This htpasswd tool is by default installed when you perform step 2.

Step 8: Create a virtual host for hosting your subversion access
create a new virtual host file at /etc/httpd/conf.d/svn.conf with the content

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

    <Location /repos>
       DAV svn
       SVNParentPath /srv/svn
    </Location>
    <Location /repos/app>
       AuthType Basic
       AuthName "Subversion Repository"
       AuthUserFile /srv/auth/svn/app.htpasswd
       Require valid-user
    </Location>

Step 9: Restart apache webserver
#service httpd restart


Step 10: Access your setup repository in a browser by typing
http://x.y.z.t:80/repos/app
This will ask a user name and password, provide the username and password created in step 7 to access the repository.

Sphere: Related Content

Wednesday, November 24, 2010

How to know which port is blocked by which process on Windows?

Recently I was trying to use my apache server for my web development. However every time, I tried it showed me that port 80 is being used already. So I took a dig and found out the solution as follows.

C:\>netstat -aon | findstr 0.0:80
-a means list all active connections and their ports. -o means include their process IDs. -n means display the port numbers numerically.

I got this output.
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4504

It means that process 4504 is currently listening on port 80. So to start apache on this default port we need to kill this process, you can do it by Task Manager and find process by the id 4504 and kill that process.

You can also identify the process by using command line as follows.
C:\>tasklist | findstr 4504 

I found that skype is using the port 80.
Skype.exe  4504 Console 1 107,170K

So we need to kill the process as follows.
taskkill /F /PID 4504


Now we can start apache as usual. Even if we start skype again it will work, I think it choses some other random port this time.

Sphere: Related Content