Jan 29

First gather all the packages that you want to put in your repository. I normally install a fresh Ubuntu on vmware to start with. Then I update the installation and install the packages I need. Once done, I take all required packages from apt cache and use those (so that I have full upgrade path with required dependencies). For the purposes of this tutorial, let’s pretend we want to mirros apache2 with all dependencies and an upgrade of Ubuntu install (a snapshot you could say).

First install Ubuntu on vmware, then start it, login and perform the following

 # go to root
sudo su -
 # update list and upgrade the installation
aptitude update && aptitude upgrade
aptitude install dpkg-dev
 # install apache2
aptitude install apache2
 # create a tree and move the packages
mkdir -p /tmp/repo/dists/jaunty/main/binary-i386
mv /var/cache/apt/archives/*.deb /tmp/repo/dists/jaunty/main/binary-i386
 # and now a nasty hack to fix the fact that apt cache renamed all colons (:) to %3a string :/
cd /tmp/repo/dists/jaunty/main/binary-i386
ls *.deb |grep '%3a' |while read FN; do NEWFN=`echo $FN |sed 's/%3a/:/g'`; echo $NEWFN; mv $FN $NEWFN; done
ls *.deb |grep '%3A' |while read FN; do NEWFN=`echo $FN |sed 's/%3A/:/g'`; echo $NEWFN; mv $FN $NEWFN; done
 # run dpkg to create the package list (Packages.gz)
cd /tmp/repo
dpkg-scanpackages -m dists/jaunty/main/binary-i386 |gzip -c > dists/jaunty/main/binary-i386/Packages.gz
 # ok, now copy of the repo directory to your webserver
 # if on the same server
cd /tmp
mv repo /var/www
 # if on another server - replace USERRNAME and IP with actual ssh username and IP
scp -r /tmp/repo USERNAME@IP:/var/www
 # if you get problems with scp copy permissions
scp -r /tmp/repo USERNAME@IP:/tmp
#login to the IP server and perform this on it
mv /tmp/repo /var/www

That’s done :) You have a nice basic working repository. Just note that if dependencies don’t resolve, you will have to navigate to the directory where your repositories are on the webserver and perform the nasty %3a hack fix from above there as well. Now, on the machine where you want to use the repository you would do this:

sudo su -
vi /etc/apt/sources.list
 # comment out all the entries here that are not commented out
 # I normally comment out using 3 ### so that I know which lines were the ones I made changes to
 # Now just above the 1st entry you commented out (starting with deb) insert this line:
deb http://IP_OF_REPO_SERVER/repo/ jaunty main

 # now save the file and perform the below to update the packages list
aptitude update
 # and that's done. Now if you do any of the below, aptitude will use your repository
 # 'fraid as this is a basic one, it will have problems with trusting your packages and ask for extra confirmation before install
 # but that shouldn't be a problem ;)
aptitude upgrade
aptitude install apache2

2 Responses to “Simple Ubuntu Web Repository”

  1. unervehance says:

    i genuinely enjoy your writing way, very attractive.
    don’t give up and also keep posting considering the fact that it simply good worth to follow it,
    looking forward to see a whole lot more of your current article content, have a good day ;)

  2. [...] I first created the target directory (server, repository and project informations have been …Simple Ubuntu Web RepositoryThat's done You have a nice basic working repository. Just note that if dependencies don't resolve, [...]

Leave a Reply

*
preload preload preload