Tag Archives: client

How to Configure Vyatta as DHCP Server for LAN

vyatta

Scenario:

Vyatta dhcp server with 2 network cards (eth0 & eth1), eth0 is connected to Internet, while eth1 is connected to the LAN and serve as dhcp server for 10.10.10.0/24 subnet.

Configuring the LAN–facing Ethernet interface:

Connect to the Vyatta Firewall, then enter the configuration mode and list the configuration of eth1 interface(which will serve the ip address(es) to the LAN hosts):

configure
show interfaces ethernet eth1

1

Read more of this post

SVN Server on Ubuntu with https access

To install SVN server, run this command at the command prompt:

sudo apt-get install subversion apache2 libapache2-svn

Verify the installed version of Subversion software:

svn --version

Read more of this post

Access Control in SVN with authz_svn

In this post I will show you, how to control access in SVN using builtin moudle called authz_svn.It allows you to control the access in such a way that who can access the repository and what they can do on the repository (read or read-write), it even allows you to make groups and define access permission for groups. Above than that, you don’t need to change the underlay structure of your svn server.

Note: If you want to install the SVN Server then, please refer this post:

These are the same usernames that we created in previous tutorial, using this command:

sudo htpasswd -m /etc/apache2/dav_svn.passwd arbab

For this post, we will use these repositories :

cd /svn
ls -l

Read more of this post

Mercurial Server on Ubuntu 12.04 LTS with Web Access

First we shall verify the version of the Ubuntu server that is running on our machine!

lsb_release -a

Install the Apache if you haven’t it already on your server!

sudo apt-get install apache2

Test the apache directly from the shell by doing a wget to the localhost. You will see the 200 OK response code.

Now install the Mercurial using the following command:

sudo apt-get install mercurial

Check the version of installed mercurial server:

hg --version

Let’s configure the master hgrc configuration file in order to remove the SSL restriction, allow to push the repository through web and trust the apache user (www-data).

sudo nano /etc/mercurial/hgrc

Add these lines to the hgrc file:

[web]
allow_push = *
push_ssl = false
allow_archive = gz, zip, bz2
[trusted]
users = www-data

Now configure the directory where Mercurial will keep all its repositories and serve them through Apache!

cd /
sudo mkdir mercurial
sudo mkdir mercurial/repositories
sudo chown -R www-data:www-data /mercurial

Let’s configure the hgweb.config!

cd /mercurial
sudo nano hgweb.config

Enter the following lines:

[web]
style = gitweb
[collections]
/mercurial/repositories = /mercurial/repositories

Let’s configure the hgweb.cgi script in order to serve the repositories via Apache:

sudo cp /usr/share/doc/mercurial/examples/hgweb.cgi /mercurial
cd /mercurial
sudo chmod a+x hgweb.cgi

Open hgweb.cgi with nano:

sudo nano hgweb.cgi

Find the line that reads config=”…..” and replace with the following line:

Now we shall configure the Apache so it runs the hgweb.cgi when the /mercurial virtual directory is requested.

cd /etc/apache2
sudo mkdir mercurial
cd mercurial
sudo nano mercurial.conf

Type the following in the mercurial.conf file:

Move to the apache sites directory and edit the default file:

cd /etc/apache2/sites-available
sudo nano default

Enter the command in order to link the mercurial.conf file to Apache:

Include /etc/apache2/mercurial/mercurial.conf

Restart the apache server:

sudo apache2ctl restart

Now create a first repository as test, inside the /mercurial/repositories:

cd /mercurial/repositories
sudo mkdir first_repo
cd first_repo
sudo hg init

Change the owner of the repository to the Apache user:

sudo chown -R www-data:www-data /mercurial

To configure the security, we have to tell the Apache that allow only those users who are registered in the password file.

cd /mercurial
sudo htpasswd -mc hgusers arbab 
sudo chown www-data:www-data hgusers

Note: repeat command for more users without adding c.

Time to Test, Launch your browser pointing to http://servername/mercurial:

In order to add the “Description” and “Contact” detail, do the following steps:

cd /mercurial/repositories/first_repo/
cd .hg
sudo nano hgrc

Add these lines to hgrc:

[web]
contact = Arbab Nazar
description = First Mercurial Repository!

Refresh your browser, now you will see the contact and the descriptio 🙂

To solve the push permission denied error:

cd /mercurial/repositories
cd first_repo
sudo chmod -R 777 .hg

Again do it!!!

sudo chown -R www-data:www-data /mercurial

Congrats! now we have a working Mercurial server on Ubuntu 12.04 :-)

Hope this will help you!

Please Remember me in your prayers!

SVN Server on Ubuntu 12.04 LTS with Web Access

To install SVN server, run this command at the command prompt:

sudo apt-get install subversion libapache2-svn apache2

Make the directory where you want to keep the svn repositories and edit the dav_svn.conf file:

sudo mkdir /svn
sudo nano /etc/apache2/mods-enabled/dav_svn.conf

Delete all the data and make it simple like this 🙂

<Location /svn>
DAV svn
SVNParentPath /svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>

To create a svn user , use the following command:

sudo htpasswd -cm /etc/apache2/dav_svn.passwd arbab

We only need to use the –c option for the FIRST TIME, when you create a user, after that you will only use the -m option.

Move to the folder, where you want to keep your repositories and create your first repository:

cd /svn
sudo svnadmin create test_repo

Make sure you set the permissions of the /svn directory to apache with the following command:

sudo chown -R www-data:www-data /svn

Restart the apache2 service:

sudo /etc/init.d/apache2 restart

On Windows machine, Right-Click  and select the SVN Checkout, inside the directory where we want to store the working copy (In my case, it’s on desktop).

Enter the repository’s URL and click OK, it will be prompted for a login and password.  Enter the login information and click OK.

We shall receive a screen that looks like this:

Create some test file inside the checkout repository, Right-Click and Select the SVN Commit:

Enter the comments that describe the purpose of this commit:

It will be prompted for a login and password.  Enter the login information and click OK.

The result of the commit will appear in a dialog window.

Congrats! now we have a working SVN server on Ubuntu 12.04 🙂

Hope this will help you!

Please Remember me in your prayers!

How to Install the DHCP Server on Ubuntu 12.04LTS

Ubuntu as DHCP Server:

To install dhcp server, enter the following command at a terminal prompt:

sudo apt-get install isc-dhcp-server

If there is more than one network card(s) in your Ubuntu server, then you have to select the network card on which your server will be listen for dhcp request. (By default, it listens on eth0).

You can change this by editing  /etc/default/isc-dhcp-server file:

sudo nano /etc/default/isc-dhcp-server

Change “eth0” to the interface on which you want that your server will listen for dhcp request (In my case, it is eth1):

It’s always a good practice to make a backup copy of /etc/dhcp/dhcpd.conf file:

sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak 

Now we will change the default configuration by editing /etc/dhcp/dhcpd.conf, I normally delete everything inside the file and manually add the configuration that suits my needs 🙂

sudo nano /etc/dhcp/dhcpd.conf

Here is my dhcpd.conf file, you need to change it according to your needs:

ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
option subnet-mask 255.255.255.0;
option broadcast-address 10.10.1.255;
option routers 10.10.1.1;
option domain-name-servers 10.10.1.1;
option domain-name "ubuntu.internal";
subnet 10.10.1.0 netmask 255.255.255.0 {
range 10.10.1.50 10.10.1.200;
}

Restart dhcp service using the following command:

sudo service isc-dhcp-server restart 

Configure Windows as DHCP Client:

Just follow these steps, in order to configure your Windows machine as DHCP client (In my case, it’s Windows 7):

To check the IP Address on Windows 7:

To Check the DHCP Leases on Ubuntu Server:
sudo tail /var/lib/dhcp/dhcpd.leases

Hope this will help you!

Please Remember me in your prayers!

%d bloggers like this: