Sharing files between gnu/linux and Windows using samba

Posted in Debian, Free Software at 11:31 am by Pirate Praveen

Install Samba package

# apt-get install samba

Samba configuration file is /etc/samba/smb.conf

You can add directories for sharing at the end like this

comment = Debian Cache
read only = yes
locking = no
path = /mirrors/debian
guest ok = yes

If you want to be able to share directories from nautilus file manager install nautilus-share and add your user to sambashare group

# apt-get install nautilus-share
# gpasswd -a <user> sambashare

Log out and login back for group change to take effect.

For mounting a samba share you have to install cifs-utils

# apt-get install cifs-utils

To mount a samba share now run

# mount -t cifs -o guest //<server>/<share> /<mount point>
# mount -t cifs -o guest // /mnt


Setting up a local package repository with apt-move

Posted in Debian, Free Software at 12:38 pm by Pirate Praveen

apt-move can be used to create a repository layout from /var/cache/apt/archives (which contains all packages downloaded by apt).

1. Install apt-move:

# apt-get install apt-move

2. Setup apt-move:

# apt-move get

3. Create repository layout:

# apt-move move

4. Generate packages list:

# apt-move packages

5. Setup apache2:

apt-move will create repository in /mirrors/debian by default (this can be changed in /etc/apt-move.conf)

5.1 Install apache web server:

# apt-get install apache2

5.2 Create a virtual host:
copy ‘default” in /etc/apache2/sites-available to “repo”

# cd /etc/apache2/sites-available
# cp default repo

Edit repo and change DocumentRoot from /var/www to /mirrors/debian
Also change to

Enable the new site.

# a2ensite repo

# /etc/init.d/apache2 restart

This will give you a repository in your machine.

If you have more than one site in your server you can configure NameVirtualHost.

Add “NameVirtualHost *:80” in /etc/apache2/ports.conf

and add ServerName for each virtual hosts in sites-available/<site>

If you just want to test your setup without a proper dns server you can edit /etc/hosts file to point your desired domains to repository’s ip address.

If you want to sign your repository follow these steps

1. Create a gpg key:

# gpg --gen-key

(choose RSA RSA, no expiration) or follow these more detailed steps

2: Sign the Release file (apt-move has an option to sign automatically, but it seems to be broken)

# gpg -o /mirrors/debian/dists/stable/Release.gpg -a -b -s /mirrors/debian/dists/stable/Release

3. Export your public key

# gpg --export --armour <key id or pattern> > repo.key.sc
# cp repo.key.asc /mirrors/debian

In client systems download the key with wget and run

# apt-key add repo.key.asc