Linux : Tutorial membuat Repository lokal sendiri


Mirror Repository Ubuntu

Selamat pagi bro,oke sekian lama tidak update blog karna sempat mengalami uts yang buruk di kuliah, haha iya kali ini sesuai judul saya akan membuat tutorial cara membuat repository lokal yang artinya kita membuat repository menggunakan server sendiri jadi tidak memakai link lokal repository orang lain.

syaratnya untuk reposirory yaitu harddisk harus besar dan bandwith yang besar juga,disini saya akan membuat repository ubuntu 12.10,oke langgsung saja.

Jika anda belum punya/install webserver ketik perintah:

apt-get install apache2
  • Step 1

login ke server anda,kita akan membuat Mirrorkeyring untuk debmirror. ketik perintah :

mkdir /var/data
mkdir /var/data/mirrorkeyring

Sebelum bisa digunakan dengan baik, kadang kala kita perlu beberapa kali menjalankan perintah

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

oke, sekarang kita menginstall debmirror nya dan membuat folder buat repository nya.

ketik perintah :

apt-get install debmirror
mkdir /var/data
mkdir /var/data/repository
mkdir /var/data/repository/repo-12.10-32
  • Step 3

jika sudah membuat folder untuk reposiroty nya sekarang kita membuat script mirror nya ketik perintah :

touch /usr/local/bin/mirrorbuild.12.10.sh
chmod -Rf 777 /usr/local/bin/mirrorbuild*
chown -Rf nobody.nogroup /usr/local/bin/mirrorbuild*
  • Step 4

oke langkah selanjutnya masukan script mirror nya ketik perintah :

nano /usr/local/bin/mirrorbuild.12.10.sh

Masukan script berikut ini

#### 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
release=quantal,quantal-backports,quantal-proposed,quantal-security,quantal-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=ns1.fahmi.my.id:5432
# server=ns1.fahmi.my.id
server=152.118.24.30

# 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.10-32

# 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 di edit semua.

  • Step 5

jika sudah tinggal mengganti chmod/ijin file mirrorbuild.sh & folder repository nya ketik perintah :

chmod -Rf 777 /usr/local/bin/mirrorbuild.12.10.sh
chown -Rf root.root /var/data/repository/repo-12.10-32
chmod -Rf 571 /var/data/repository/repo-12.10
  • Step 6

kalau semua nya sudah benar,tinggal kita run script nya,jangan lupa masuk ke directory mirrorbuild.12.10.sh nya dulu,jika sudah ketik perintah :

mirrorbuild.12.10.sh

oke,selesai tinggal di tunggu server kita mengambil packet dari mirror yang kita gunakan,agak sedikit lama bro. seperti ini saat sesudah menjalankan/run mirrorbuild.12.1o.sh saya akan jelaskan maksud dari script mirrorbuild.12.1o.sh diatas:

"server=152.118.24.30"
dimana kita akan melakukan mirror
"arch=i386"
arsitek apa yang akan di mirror i386 artinya kita hanya akan melakukan mirror untuk paket-paket 32 bit. jika ingin juga mirror paket-paket 64 bit, cukup tambahkan "arch=i386,amd64" yang artinya kita akan mirror paket 32 bit dan 64 bit. kalo saya kemarin hanya untuk paket 32 bit, soalnya masih jarang user yg menggunakan mesin 64 bit.
"outPath=/var/data/repository/repo-12.10-32"
dimana kita akan meletakkan hasil mirror
"release=quantal,quantal-backports,quantal-proposed,quantal-security,quantal-updates"
ini maksudnya distro/versi Ubuntu apa saja yg ingin dimirror, contoh scrip diatas, saya melakukkan mirror untuk "quantal".

Oke sekian tutorial kali ini,selamat mencoba bro repository ubuntu 12.04 saya

b http://ns1.fahmi.my.id/ubuntu precise main restricted universe multiverse
deb http://ns1.fahmi.my.id/ubuntu precise-updates main restricted universe multiverse
deb http://ns1.fahmi.my.id/ubuntu precise-security main restricted universe multiverse
deb http://ns1.fahmi.my.id/ubuntu precise-backports main restricted universe multiverse
deb http://ns1.fahmi.my.id/ubuntu precise-proposed main restricted universe multiverse

Sumber

Fahmi

We’re still Pioneers, We Barely Begun. Our Greatest Accomplishments cannot be behind us, cause our destiny lies above us.

5 Comments

  • diablo
    November 1, 2013 at 3:06 pm

    om kok repositorynya gk bsa?

    • fahmi
      November 1, 2013 at 3:09 pm

      iya maaf lagi di build ulang,kemaren vpsnya ke format harddisk nya,check nanti lagi iya 🙂

  • dika danny
    February 6, 2014 at 12:09 pm

    om blh tanya, cara ny agar kita bisa membuat source list sendiri bagaimna y ?

    • Fahmi
      February 6, 2014 at 7:49 pm

      maksud nya bro?

  • ardi tri yunansyah
    May 10, 2017 at 10:49 am

    kalo pakai kali bisa gak mas? atau harus ubuntu?

Leave a Reply