Thursday, December 15, 2016

Simple steps to setup SVN server on Ubuntu

1. Install subversion and related modules using command,
sudo apt install subversion apache2 libapache2-svn apache2-utils
2. Create a directory for SVN root
mkdir /home/svn
3. Create a directory for your project repository 
mkdir /home/svn/MyProject
4. Using the following command create the repository
svnadmin create /home/svn/MyProject
5. Open the conf directory inside the repository directory and edit the svnserve.conf. Uncomment and change settings as,
general
password-db = passwd
anon-access = none # note this change; default will be read
6. Add user credentials in passwd file in same directory,
username = password
7. Start svn server using command,
svnserve -d -r /home/svn
 (Note: Use options --foreground and --config-file=filename, if required)

8. To start the svn server automatically on boot-up, create svnserve.conf inside the directory /etc/init and add below contents,
# svnserve - Subversion server
description    "Subversion Server"
start on (local-filesystems and net-device-up IFACE=lo and started udev-finish)
stop on runlevel [06]
#chdir /home/svn
#respawn
#respawn limit 2 3600
exec /usr/bin/svnserve -d -r /home/svn
 (Note: Use the commented options, if required)

9. Now the repository will be accessible via the url  
svn://hostname/MyProject
Optional,

10. To work with repository using SSH, install ssh server & start it; then use url
 svn+ssh://hostname/home/svn/MyProject
11. To  use HTTP edit the dav_svn.conf file in the directory /etc/apache2/mods-available. Add the following lines to it,
<Location /svn>
DAV svn
SVNParentPath /home/svn
SVNListParentPath On
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/passwd
Require valid-user
</Location>
12. Create a user group subversion using command,
sudo addgroup subversion
13. Add www-data to subversion(group) using command,
sudo adduser www-data subversion
14. Change ownership and permissions for the repository using below commands,
sudo chown -R www-data:www-data /home/svn/MyProject
sudo chmod -R g+rws /home/svn/MyProject
14. Restart apache server, using command,
service apache2 restart
15. Add SVN user credentials using command
 sudo htpasswd -c /etc/subversion/passwd user-name
16. Now the repository will be accessible via the url http://hostname/svn/MyProject

17. To use HTTPS configure the apache for SSL. Then the repository will be accessible via the url https://hostname/svn/MyProject

Note:-

1. To test repository access; use the command to checkout,
cd /home/Working-Directory
svn co http://hostname/svn/MyProject
or
svn co https://hostname/svn/MyProject
or
svn co svn://hostname/MyProject
or
svn co svn+ssh://hostname/home/svn/MyProject
2.a. To setup for HTTPS edit the default-ssl.conf or your own ssl configuration file in the directory /etc/apache2/sites-available
SSLEngine on
SSLCertificateFile path_to_ssl_certificate
SSLCertificateKeyFile path_to_ssl_certificate_key_file
2.b.  To setup for HTTPS edit the ports.conf in the directory /etc/apache2. Comment or remove the line,
Listen 80
2.c. Enable SSL mod using
sudo a2enmod ssl
3. Apache server restart can be done using any of the below commands,
systemctl reload apache2.service
service apache2 reload
service apache2 restart
/etc/init.d/apache2 restart
4. Enable or disable ssl enabled site configurations using commands,
a2ensite default-ssl.conf
a2dissite default-ssl.conf
5. To open directory with Admin power, use
gksu nautilus path_to_directory
6. Replace the /home/svn with path to svn root

7. Replace the /home/svn/MyProject with Repository path

8. Replace /svn in HTTP(S) url with the location provided inside the tag <Location>

Tuesday, July 13, 2010

Basics of IP Addresses

In IPv4 the address is 32 bit (4 bytes) long. We represent the address using dotted decimal notation. i.e. decimal numbers 0-255 (represent a byte), is called octet, and each of that octets separated by '.',

for e.g. 192.168.1.1 the hex equivalent (hexadecimal) of this address is C0.A8.1.1 and binary (1100 0000. 1010 1000. 0000 0001 . 0000 0001) i.e. the equivalent integer is 3232235777 in decimal and C0A80101 in hex.

IP Classification
  • IP addresses are classified into 5 categories
  • Helps in orderly arrangement and efficient application of addresses along different networks
  • classes can be A, B, C, D, E
Class NameStarting bits of of MSO (Most
significant bits of Most significant
Octet i.e.Left most octet)
Range of Left Most Octet
A00-127
B10128-191
C110192-223
D1110224-239
E1111240-255

Number of octets to represent net id and host id in different ip classes:- netid always start from left most octet. Based on the bits the default subnet mask can be determined so that to identify the netid and hostid.


IP Address divided into Net and Host Portions

Class A ip address (Address start with a number between 0 to 127 )

Class B IP Address (Address start with a number between 128 to 191 )

Class C IP Address ( Address start with a number between 192 to 223)

Class Name -(net id/host id )
A -(1/3)
B -(2/2)
C -(3/1)
thus the default subnet masks can be determined by checking the starting bits and the corresponding host and net id division above, thus the default subnet masks for each class is,
A - 255.0.0.0
B - 255.255.0.0
C - 255.255.255.0

This kind of addressing is classful addressing, but it result in wasting/insufficient number of ip addresses in different classes so there is another kind of routing that use classless routing and is known as CIDR (Classless Inter Domain Routing), it uses an ip with CIDR value denoted by preceding / (e.g. 192.168.1.1 /16) instead of the default subnet mask for classful address. Thus the classless addressing can use variable length blocks of ip addresses and thus solving the issue of address wasting or insufficient address in a particular class.

Reserved IP addresses
127.0.0.0 - Default Routing
255.255.255.255 - Global broadcast address

Private IP address ranges for different classes
class A - 10.0.0.0 to 10.255.255.255
class B - 172.16.0.0 to 172.31.255.255
class C - 192.168.0.0 to 192.168.255.255

Types of addresses
Unicast - one to one
Multicast - One to many
Broadcast - One to All
Not:e:-
IPv6 address is 128bit i.e. 16 byte long.

Monday, July 12, 2010

Why IP and MAC Addresses?

The MAC address is 48bit unique address assigned to any networking/inter networking device, which is embedded on the device and will not change anyway. But the IP may vary each time the device is plugged on to the network (if assigned a dynamic IP address), but there will be only that system on the network with the assigned IP (i.e. address is unique).

MAC address is used only in local communication, i.e. inside a local network only, if it goes out of a network it will use IP address to identify the device/machine.

MAC address is also called Physical address.

As we discussed, the IP address and MAC address are unique, i.e there will be no more than one system with same IP address or same MAC address. So there will be a confusion why to use both addresses?both are unique then why cant use IP or MAC itself?Why both are used in communication?Why the overhead/headache of confusing with both addresses?

Here the answer is,

The MAC address will vary each time the packet of data enters a new network, i.e. the source MAC address and Destination MAC address vary each time the packet reaches a new network, since the physical address is used to locate a system in a local network. The source and destination ip address will remain same always and is not altered with respect to the network changes, the ip should remain same to locate the destination, since the physical (MAC) address varies with network.

Sunday, July 11, 2010

Basics of computer Networking

There is no need to say what is computer networking, and what the use of it, all of you will be familiar with that all, so we are not discussing that topics, but just highlighting the basic terms related to computer networking,
  1. Different topologies :- Mesh, Ring, Star, Bus
  2. OSI Layers :- Physical, Data link, Network, Transport, Session, Presentation, Application
  3. Data link sub layers :- MAC (Media Access Control) and LLC (Logical Link Control)
  4. IP Address :- Unique 32bit (IPv4)/128bit (IPv6) number assigned to the devices in a network (Including Routers,Switches,Computers etc)
  5. Different networking and inter networking protocols :- TCP, UDP, ARP, RARP, ICMP, IGMP, DHCP etc
  6. Port numbers :- Port numbers like 80 for http, 21 -ftp, 22 -SSH, 23- Telnet etc
  7. MAC Address :- 48bit Physical Address (Unique)
  8. Networking and Inter networking devices :- Routers, Hub, Switches, Bridges etc
  9. Concept of Routing protocols, Gateways etc
  10. Concept of net id, host id, network address, sub netting, super netting, subnet Mask, simplex, half duplex and full duplex modes of communication
There are more terms related to networking, and we are not going through that all, and will discuss whenever necessary in future discussions.

The ip address is unique for the system in a network. An ip address has 2 parts, a network portion and a host portion. Network portion defines in which network that address belongs to; where as the host portion determine the position of that ip within that particular network.The subnet mask has the role of dividing the ip address in to network portion and host portion.

Cabling
the two ends of 8 color wires of Ethernet cable are connected in 3 different ways to for 3 types of cables as below,


Straight through

Orange white - Orange White
Orange - Orange
Green white - Green white
Blue - Blue
Blue white - Blue white
Green - Green
Brown white - Brown white
Brown - Brown

The straight through cables are used to connect dissimilar devices like PC and Hub, PC and Switch etc.
Cross over cable

Orange white - Green white
Orange - Green
Green white - Orange white
Blue - Blue
Blue white - Blue white
Green - Orange
Brown white - Brown white
Brown - Brown

Cross over cables are used to connect similar devices like hub to hub, PC to PC switch to switch etc.
Rolled or Roll over cable

Orange white - Brown
Orange - Brown white
Green white - Green
Blue - Blue white
Blue white - Blue
Green - Green white
Brown white - Orange
Brown - Orange white


Basic Digital Electronics

Before entering to the detailed networking topics, it is always better to start with basics of digital electronics and digital communication.

The digital electronics as the name implies is electronics of digits or digital data, whatever the data you have is not matter in this case, may be it is voice, video, image, text anything that is manipulated as digits. The digital communication thus should be the communication between digital equipments in digital form of data.

The basics of digital electronics is the binary arithmetic and logic, the binary is base 2 number system in which the possible two digits are 1 and 0, which in turn implies to the two states of electric/electronic component i.e. ON and OFF.

The usual arithmetic like +(addition) , -(subtraction), *(multiply), /(division) are also possible with binary numbers too, in addition to that in binary system we have some logical operations like AND, OR, NOT, XOR etc, for our topic, it is having much importance than other for later discussions.

And the basics of the digital circuits is based on this operations, in the form of simple electronic circuits called digital logic gates which will output the result of these logical operations. And here the output of such great operations,

The AND, OR and XOR gates have two inputs while for NOT only one input and all are having one output. Remember that in digital logic the output 1 is true and 0 is false

AND
its output is true(1) only if both of its inputs are true, all other cases it result false(0)
OR
Its output is true if any or both of the inputs is true, result is false only if both inputs are false
XOR
Its output is true if exactly one of the two inputs is true, i.e. odd number of true(1)s
NOT
It just negates or complements the input, if the input is true output will be false and if input is false output will be true

When the AND, OR, XOR combined with NOT, the output of the gates will be the opposite of the AND, OR, XOR operations and the resulting gates are NAND, NOR, XNOR respectively. Here the NAND and NOR are called universal gates and any other logic gate can be constructed using combination of any of these two gates.

So keep the operations in mind and remember these are the operation behind any digital device, whether it is computer, mobile, DVD player anything, and in the communication equipments like routers, switches, and your digital TV receiver.

Saturday, July 10, 2010

Dynamic DNS Servers

Sometimes you will get blocked when you try to access remote systems using the IP address itself. May be sometimes you are to check your local web server is running, that you setup in your home and having a dynamic IP address, when you asked your friend to check your server is running properly, and he/she types the url like http://117.193.123.113/mysite/index.php, sometimes he will get blocked from accessing your server, even if you enabled NAT and all done properly.

It is always easy to remember a site name than IP address and also the IP address, if you are having a dynamic IP will change each time (not always) when you reset the modem based on availability of IP addresses. In such cases there are services that provide you the facility of dynamic DNS servers, where you can create your domain, i.e. a sub domain of the service provider's top level domain. You can set the sub domain to point to the IP address you have. You need to update the ip corresponding to the domain each time if it changed (usually if the modem resets).

Suppose the above case, you are having the ip 117.193.123.113 and you want to test your home ftp server then you can create a domain like myhomeftp.dyndns.com and you can set that point to your home PC that is assigned an ip 117.193.123.113 (set up NAT to share the same public ip between modem and PC, so that the service running on your PC will be available to the public).

There are many such providers offering you the dynamic DNS, and i used the same service from dyndns.com for test purpose and also for the company i worked for, to use the ftp server i setup for the company, that I explained in previous article, as it is a static ip no need to update the dns server frequently.

They provides a number of choices for you to select the top level domain, like dyndns.com or homeftp.net etc.

Friday, July 9, 2010

Remote Connect via SSH or Telnet

We can connect to a remote computer using telnet (port 23) or SSH (port 22) protocols based applications. Suppose the server running an ftp service, and the server is based on operating system ubuntu. When you install ubuntu server with default options, it will install the SSH service too, also if you want setup telnet server on ubuntu(if it is not already installed). Check it using the command telnet IP-Address/Name of the system, or if you are already on the terminal of the system running the service use the command telnet 127.0.0.1 (address for the local host). If it asks for the user id and password then is is working fine, else require new installation.

To install telnet follow the steps
  1. Install inetd super server using command sudo apt-get install netkit-inetd
  2. Install telnet using the command sudo apt-get install telnetd
  3. Restart the inetd service using command sudo /etc/init.d/inetd restart
  4. Now the server is ready and can access using the command telnet ip-address/computer-name, can test it from terminal using command telnet 127.0.0.1
  5. Now can use the terminal/command prompt as you work on your terminal itself
  6. Sometimes the telnet server will show you the available menu items that you can select to perform the tasks available(you have permission) to do, for e.g. if you telnet your modem from command prompt (for e.g. telnet 192.168.1.1), you can find a set of menu items you can select it to configure the modem
Telnet and SSH provide almost the same functionality but SSH is secure than telnet.

SSH
In most cases the ubuntu server will install the ssh server when you install ubuntu. If you want access the ssh since telnet is not secure, to access the system using ssh, you can use any ssh client programs like putty. Here is how can use putty to access the system via ssh
  1. Download putty and run it
  2. Enter the host name/computer name/ip address of the system you want connect to
  3. By default, the port address will be 22 and if you are not altered the default setting for ssh on your server leave as it is, otherwise change the port address as you set for the ssh server
  4. Then click open, if it is able to connect to the server via ssh will open the terminal and you can do anything with that server that you have permission to (or can access the programs that you have access to)