Membuat Repository Ubuntu Lokal menggunakan debmirror



Repository adalah istilah dalam Linux yang kira-kira berarti tempat penyimpanan aplikasi Linux. Berbeda dengan Windows atau sistem operasi pada umumnya, di Linux sebagian besar aplikasi telah tertata rapih di repository dan kita dapat dengan mudah menggunakannya jika kita dapat mengakses repository tersebut.
Masalahnya, sebagian besar repository berada di Internet. Jika kita tidak mempunyai bandwidth yang cukup besar maka akan susah bagi kita untuk mengkutak katik Linux tersebut.
Pada kesempatan ini, akan di jelaskan cara untuk membuat repository agar berada di harddisk laptop kita. Dengan cara ini, maka bagi mereka yang tidak mempunyai akses ke Internet dapat tetap mengeksplorasi dengan menggunakan repository yang ada di harddisk.
Berikut adalah langkah membuat repository Ubuntu dari server,
  • id.archive.ubuntu.com
  • dl2.foss-id.web.id atau 125.160.17.22
  • kambing.ui.ac.id atau 152.118.24.30
ke Server lokal di LAN

 

Langkah Mendownload Repostory Menggunakan debmirror

Mendownload repository dapat dilakukan menggunakan debmirror. Aplkasi debmirror dapat di instalasi menggunakan perintah
apt-get install debmirror
Contoh di bawah adalah untuk repository Ubuntu 32 bit. Bagi anda yang ingin mendownload repository 64 bit, yang perlu di ubah hanya paramter
arch=i386
menjadi arsitektur 64 bit, yaitu:
arch=amd64

Asumsi

Versi Ubuntu: 12.04
folder repo : /var/data/repository/repo-12.04
server      : kambing.ac.id
GNUPGHOME   : /var/data/mirrorkeyring
 
Ubah informasi tersebut di sesuaikan dengan kondisi komputer anda

Siapkan

Mirrorkeyring untuk debmirror . caranya:
Buat folder untuk mirror keyring

mkdir /var/data
mkdir /var/data/mirrorkeyring
gpg --no-default-keyring --keyring /var/data/mirrorkeyring/trustedkeys.gpg --import /usr/share/keyrings/ubuntu-archive-keyring.gpg

Mengkonfigurasi debmirror

  • Install debmirror & buat folder tempat repo
apt-get install debmirror
mkdir /var/data
mkdir /var/data/repository
mkdir /var/data/repository/repo-12.04
  • Buatlah script mirror
touch /usr/local/bin/mirrorbuild.12.04.sh
chmod -Rf 777 /usr/local/bin/mirrorbuild*
chown -Rf nobody.nogroup /usr/local/bin/mirrorbuild*
gedit /usr/local/bin/mirrorbuild.12.04.sh
  • Masukan script berikut
#### Start script to automate building of Ubuntu mirror #####
## THE NEXT LINE IS NEEDED THE REST OF THE LINES STARTING WITH A # CAN BE DELETED

#!/bin/bash 

## Setting variables with explanations.

#
# Don't touch the user's keyring, have our own instead
#
export GNUPGHOME=/var/data/mirrorkeyring 

# Arch=         -a      # Architecture. For Ubuntu can be i386, powerpc or amd64.
# sparc, only starts in dapper, it is only the later models of sparc.
#
arch=i386

# Minimum Ubuntu system requires main, restricted
# Section=      -s      # Section (One of the following - main/restricted/universe/multiverse).
# You can add extra file with $Section/debian-installer. ex: main/debian-installer,universe/debian-installer,multiverse/debian-installer,restricted/debian-installer
#
section=main,restricted,universe,multiverse

# Release=      -d      # Release of the system (Dapper, Edgy, Feisty, Gutsy, Hardy, Intrepid), and the -updates and -security ( -backports can be  added if desired)
#
# release=jaunty,jaunty-security,jaunty-updates
# release=maverick,maverick-security,maverick-updates,maverick-backports,maverick-proposed
# release=oneiric,oneiric-backports,oneiric-proposed,oneiric-security,oneiric-updates
release=precise,precise-backports,precise-proposed,precise-security,precise-updates

# Server=       -h      # Server name, minus the protocol and the path at the end
# CHANGE "*" to equal the mirror you want to create your mirror from. au. in Australia  ca. in Canada.
# This can be found in your own /etc/apt/sources.list file, assuming you have Ubuntu installed.
#
# server=opensource.telkomspeedy.com:5432
# server=dl2.foss-id.web.id
server=kambing.ui.ac.id

# Dir=          -r      # Path from the main server, so http://my.web.server/$dir, Server dependant
#
inPath=ubuntu

# Proto=        -e      # Protocol to use for transfer (http, ftp, hftp, rsync)
# Choose one - http is most usual the service, and the service must be avaialbe on the server you point at.
#
proto=http

# Outpath=              # Directory to store the mirror in
# Make this a full path to where you want to mirror the material.
#
outPath=/var/data/repository/repo-12.04

# The --nosource option only downloads debs and not deb-src's
# The --progress option shows files as they are downloaded
# --source \ in the place of --no-source \ if you want sources also.
# --nocleanup  Do not clean up the local mirror after mirroring is complete. Use this option to keep older repository
# Start script
#
debmirror       -a $arch \
                --no-source \
                -s $section \
                -h $server \
                -d $release \
                -r $inPath \
                --progress \
                -e $proto \
                $outPath

#### End script to automate building of Ubuntu mirror ####                                                                                    
Simpan script jika sudah selesai di edit semua-nya.


  • Ubah ijin agar file mirrorbuild.sh & folder repo
chmod -Rf 777 /usr/local/bin/mirrorbuild.12.04.sh 
chown -Rf root.root /var/data/repository/repo-12.04
chmod -Rf 571 /var/data/repository/repo-12.04
  • Jalankan mirrorbuild.sh
sh mirrorbuild.12.04.sh


 Cron supaya secara periodik di update
  • Edit Tabel cron
# crontab -e
  • Agar setiap jam 10 malam di update. Isi dengan kata-kata
0 22 * * * /usr/local/bin/mirrorbuild.sh


  • Aktifkan cron
# /etc/init.d/cron restart

Setup di Sisi Client untuk Lokal Folder

Edit
gedit /etc/apt/sources.list 
 
Isi dengan ini
 
deb file:///var/data/repository/repo-12.04/ precise main multiverse restricted universe
deb file:///var/data/repository/repo-12.04/ precise-backports main multiverse restricted universe
deb file:///var/data/repository/repo-12.04/ precise-proposed main multiverse restricted universe
deb file:///var/data/repository/repo-12.04/ precise-security main multiverse restricted universe
deb file:///var/data/repository/repo-12.04/ precise-updates main multiverse restricted universe



Selesai. tinggal jalankan apt-get update.

referensi :
http://opensource.telkomspeedy.com/wiki/index.php/Membuat_Repository_Ubuntu_Lokal_menggunakan_debmirror
Previous
Next Post »

- Kritik dan saran sangat saya nantikan untuk kemajuan blog ini.
- Silakan report, jika ada link yang mati.
- Mohon untuk berkomentar sesuai dengan tema postingan.
- Dilarang berkomentar yang mencantumkan LINK AKTIF.
ConversionConversion EmoticonEmoticon