Setting Up Repository

The nexenta developed utilities ndmkrepo, ndput and ndget provide a simple method of creating and maintaining your own repository.

Prerequisites

  • NexentaStor or Nexenta Core Platform installed
  • Plugin/Package files.

The plugin/package files refer to the debian package files ( .dsc, .tar.gz, .changes, .diff.gz, .debs). If your package does not provide the sources, then .tar.gz and .diff.gz may not be present.

For this tutorial we'll use the example package devscripts. We will setup an empty NexentaStor compatible repository, and upload the package into it. This directory can then be made available via a webserver to anyone else.

The devscript package consists of

devscripts_2.10.11nexenta7.dsc  
devscripts_2.10.11nexenta7.tar.gz 
devscripts_2.10.11nexenta7_solaris-i386.changes
devscripts_2.10.11nexenta7_solaris-i386.deb

Initial setup

The debarchiver package provides the tools required for setting up repository. This is not installed by default, so you'll need to install this. Run:

$ sudo apt-get update
$ sudo apt-get install debarchiver

Now let is goto login to our home directory (/root). We'll use this directory for this example, but you are free to use any other.

root@nza304:~# ls -l
total 2
drwxr-xr-x 2 root root 6 Jan 11 05:38 devscripts-2.10.11nexenta7
root@nza304:~# ls devscripts-2.10.11nexenta7
devscripts_2.10.11nexenta7.dsc  devscripts_2.10.11nexenta7.tar.gz  devscripts_2.10.11nexenta7_solaris-i386.changes  devscripts_2.10.11nexenta7_solaris-i386.deb

We have the package files present in the directory devscripts-2.10.11nexenta7. Let us know initialize an empty repository using the ndmkrepo command. It takes 2 arguments: the path of the repo, and a path for the upload script. The latter is not a big concern for our scenario, so we'll just use a temporary path.

root@nza304:~# ndmkrepo /root/repo /tmp/scr
Creating new APT repository at /root/repo ...done
Local APT repository configured: /etc/apt/sources.list.d/nexenta-on-local.list
Upload script created: /tmp/scr

Let's look at the structure of /root/repo:

/root/repo
|-- dists
|   |-- hardy-stable
|   |   |-- contrib
|   |   |   |-- binary-all
|   |   |   |-- binary-solaris-i386
|   |   |   |   |-- Packages
|   |   |   |   |-- Packages.gz
|   |   |   |   `-- Release
|   |   |   |-- override
|   |   |   |-- override.src
|   |   |   `-- source
|   |   |       |-- Release
|   |   |       |-- Sources
|   |   |       `-- Sources.gz
|   |   |-- main
|   |   |   |-- binary-all
|   |   |   |-- binary-solaris-i386
|   |   |   |   |-- Packages
|   |   |   |   |-- Packages.gz
|   |   |   |   `-- Release
|   |   |   |-- override
|   |   |   |-- override.src
|   |   |   `-- source
|   |   |       |-- Release
|   |   |       |-- Sources
|   |   |       `-- Sources.gz
|   |   `-- non-free
|   |       |-- binary-all
|   |       |-- binary-solaris-i386
|   |       |   |-- Packages
|   |       |   |-- Packages.gz
|   |       |   `-- Release
|   |       |-- override
|   |       |-- override.src
|   |       `-- source
|   |           |-- Release
|   |           |-- Sources
|   |           `-- Sources.gz
|   |-- hardy-testing
 ..
|   |-- hardy-testing
 ..

The repo created is setup to upload packages into hardy-unstable. If you need to put packages into hardy-stable, simply create that incoming directory via:

#mkdir /root/repo/incoming/hardy-stable 

Next, let us upload the package using ndput. ndput takes the path of the repo and optional distribution type (via -d) as arguments. If distribution type is not provided, hardy-unstable is assumed. All packages files in the current directory are moved into the repository (not copied, but moved, so if you need to, you should backup). For more information on ndput run ndput -h. Let us upload:

root@nza304:~# cd devscripts-2.10.11nexenta7/
root@nza304:~/devscripts-2.10.11nexenta7# ls
devscripts_2.10.11nexenta7.dsc  
devscripts_2.10.11nexenta7.tar.gz  
devscripts_2.10.11nexenta7_solaris-i386.changes  
devscripts_2.10.11nexenta7_solaris-i386.deb
root@nza304:~/devscripts-2.10.11nexenta7# ndput /root/repo -d hardy-stable
Trying to obtain '/root/repo' repository lock ...success!
ndrm: devscripts: not found
Repository '/root/repo': package(s) uploaded.

The package has been uploaded and the repository is now prepared! Let's take a look at the directory now.

/root/repo/
|-- dists
|   |-- hardy-stable
|   |   |-- Contents-solaris-i386
|   |   |-- Contents-solaris-i386.gz
|   |   |-- Release
|   |   |-- contrib
|   |   |   |-- binary-all
|   |   |   |-- binary-solaris-i386
|   |   |   |   |-- Packages
|   |   |   |   |-- Packages.gz
|   |   |   |   `-- Release
|   |   |   |-- override
|   |   |   |-- override.src
|   |   |   `-- source
|   |   |       |-- Release
|   |   |       |-- Sources
|   |   |       `-- Sources.gz
|   |   |-- installed
|   |   |   `-- devscripts_2.10.11nexenta7_solaris-i386.changes
|   |   |-- main
|   |   |   |-- binary-all
|   |   |   |-- binary-solaris-i386
|   |   |   |   |-- Packages
|   |   |   |   |-- Packages.gz
|   |   |   |   |-- Release
|   |   |   |   `-- devel
|   |   |   |       `-- devscripts_2.10.11nexenta7_solaris-i386.deb
|   |   |   |-- override
|   |   |   |-- override.src
|   |   |   `-- source
|   |   |       |-- Release
|   |   |       |-- Sources
|   |   |       |-- Sources.gz
|   |   |       `-- devel
|   |   |           |-- devscripts_2.10.11nexenta7.dsc
|   |   |           `-- devscripts_2.10.11nexenta7.tar.gz
|   |   `-- non-free
|   |       |-- binary-all
|   |       |-- binary-solaris-i386
|   |       |   |-- Packages
|   |       |   |-- Packages.gz
|   |       |   `-- Release
|   |       |-- override
|   |       |-- override.src
|   |       `-- source
|   |           |-- Release
|   |           |-- Sources
|   |           `-- Sources.gz
|   |-- hardy-testing
..

There it is! You can now copy over the directory to anyplace that requires this repository. You can make it available to the public at large by copying the directory into the web root.

Apart from the above two, you also can use ndget to grab a package from a repository. It takes 2 arguments: path of repository, and package name, and optional distribution type. Ex:

root@nza304:~# ls
repo
root@nza304:~# ndget /root/repo devscripts -d hardy-stable
root@nza304:~# ls
devscripts-2.10.11nexenta7  repo
root@nza304:~# ls devscripts-2.10.11nexenta7/
devscripts_2.10.11nexenta7.dsc  
devscripts_2.10.11nexenta7.tar.gz  
devscripts_2.10.11nexenta7_solaris-i386.changes  
devscripts_2.10.11nexenta7_solaris-i386.deb

Also available in: HTML TXT