Difference between revisions of "SchoolOnffLine: Menyiapkan Server Repository Ubuntu Lokal"

From OnnoWiki
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
  chown -Rf nobody.nogroup /var/data
 
  chown -Rf nobody.nogroup /var/data
 
  chmod -Rf 777 /var/data
 
  chmod -Rf 777 /var/data
 
+
 
  mkdir /home/ftp/pub
 
  mkdir /home/ftp/pub
 
  mkdir /home/ftp/pub/repo
 
  mkdir /home/ftp/pub/repo
 
  chown -Rf ftp.nogroup /home/ftp/pub
 
  chown -Rf ftp.nogroup /home/ftp/pub
 +
 +
chown -Rf root.root /var/data/repo
 +
chmod -Rf 571 /var/data/repo
  
 
  mkdir /var/www/ubuntu
 
  mkdir /var/www/ubuntu
Line 15: Line 18:
 
  mount --bind /var/data/repo /var/www/ubuntu
 
  mount --bind /var/data/repo /var/www/ubuntu
 
  mount --bind /var/data/repo /home/ftp/pub/repo
 
  mount --bind /var/data/repo /home/ftp/pub/repo
 +
 +
mkdir /var/data/mirrorkeyring
 +
gpg --no-default-keyring --keyring /var/data/mirrorkeyring/trustedkeys.gpg --import /usr/share/keyrings/ubuntu-archive-keyring.gpg
  
 
==Menyiapkan Update Mirror Automatis setiap malam==
 
==Menyiapkan Update Mirror Automatis setiap malam==
  
Beberapa Asumsi:
+
* Install debmirror
 
 
Folder Repository  : /var/data/repo
 
GNUPGHOME          : /var/data/mirrorkeyring
 
Server Repository  : dl2.foss-id.web.id atau 125.160.17.22
 
User akses lokal    : Melalui Web di /var/www/ubuntu (http://192.168.0.254/ubuntu)
 
  
 
+
apt-get install debmirror
==Copy Repository dari Teman==
 
 
 
Sebaiknya sebelum melalukan sinkronisasi secara periodik di Internet.
 
Copy Repository dari teman misalnya
 
  
 
  mkdir /var/data/repo
 
  mkdir /var/data/repo
cp /media/usbharddisk/repo/* /var/data/repo
 
 
  chown -Rf nobody.nogroup /var/data/repo
 
  chown -Rf nobody.nogroup /var/data/repo
 
==Mengkonfigurasi debmirror==
 
 
* Install debmirror
 
 
# apt-get install debmirror
 
 
* Buatlah folder untuk menempatkan [[repository]], misalnya /home/media/repo-9.10
 
 
# mkdir /var/data/repo
 
  
 
* Buatlah script mirror
 
* Buatlah script mirror
  
  # vi /usr/local/bin/mirrorbuild.sh
+
  vi /usr/local/bin/mirrorbuild.sh
  
 
* Masukan script berikut
 
* Masukan script berikut
Line 54: Line 40:
 
  ## THE NEXT LINE IS NEEDED THE REST OF THE LINES STARTING WITH A # CAN BE DELETED
 
  ## THE NEXT LINE IS NEEDED THE REST OF THE LINES STARTING WITH A # CAN BE DELETED
 
   
 
   
  #!/bin/bash  
+
  #!/bin/bash
 
   
 
   
 
  ## Setting variables with explanations.
 
  ## Setting variables with explanations.
Line 79: Line 65:
 
  # release=karmic
 
  # release=karmic
 
  # release=karmic,karmic-security,karmic-updates
 
  # release=karmic,karmic-security,karmic-updates
  release=karmic,karmic-security,karmic-updates,karmic-backports,karmic-proposed
+
  # release=karmic,karmic-security,karmic-updates,karmic-backports,karmic-proposed
 +
# release=lucid,lucid-security,lucid-updates,lucid-backports,lucid-proposed
 +
release=maverick,maverick-security,maverick-updates,maverick-backports,maverick-proposed
 +
# release=natty,natty-backports,natty-proposed,natty-security,natty-updates
 
   
 
   
 
  # Server=      -h      # Server name, minus the protocol and the path at the end
 
  # Server=      -h      # Server name, minus the protocol and the path at the end
Line 87: Line 76:
 
  # server=opensource.telkomspeedy.com:5432
 
  # server=opensource.telkomspeedy.com:5432
 
  # server=dl2.foss-id.web.id
 
  # server=dl2.foss-id.web.id
  server=125.160.17.22
+
  # server=125.160.17.22
 +
# server=192.168.0.2
 +
# server=kambing.ui.edu
 +
server=152.118.24.30
 
   
 
   
 
  # Dir=          -r      # Path from the main server, so http://my.web.server/$dir, Server dependant
 
  # Dir=          -r      # Path from the main server, so http://my.web.server/$dir, Server dependant
Line 119: Line 111:
 
                 $outPath
 
                 $outPath
 
   
 
   
  #### End script to automate building of Ubuntu mirror ####                                                                                   
+
  #### End script to automate building of Ubuntu mirror ###                                                              
  
  
 
Simpan script jika sudah selesai di edit semua-nya.
 
Simpan script jika sudah selesai di edit semua-nya.
  
 
+
  chmod -Rf 777 /usr/local/bin/mirrorbuild.sh
* Ubah ijin agar file mirrorbuild.sh dapat di jalankan
 
 
 
  # chmod -Rf 777 /usr/local/bin/mirrorbuild.sh  
 
 
 
* Ubah ijin dari folder mirror
 
 
 
# chown -Rf root.root /var/data/repo
 
# chmod -Rf 571 /var/data/repo
 
 
 
* Buat folder untuk mirror keyring
 
 
 
# mkdir /var/data/mirrorkeyring
 
# gpg --no-default-keyring --keyring /var/data/mirrorkeyring/trustedkeys.gpg --import /usr/share/keyrings/ubuntu-archive-keyring.gpg
 
 
 
* Jalankan mirrorbuild.sh
 
 
 
# mirrorbuild.sh
 
 
 
* 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
 
# mirrorbuild.sh
 
 
 
==Membuat Repository di Web==
 
 
 
* Pertama-tama [[Instalasi Apache]]
 
 
 
* Buat link statik antara download repository ke Web
 
 
 
# mkdir /var/www/ubuntu
 
# mount --bind /var/data/repo /var/www/ubuntu
 
  
 
==Cron supaya secara periodik di update==
 
==Cron supaya secara periodik di update==
Line 162: Line 123:
 
* Edit Tabel cron
 
* Edit Tabel cron
  
  # crontab -e
+
  crontab -e
  
 
* Agar setiap jam 1 malam di update. Isi dengan kata-kata
 
* Agar setiap jam 1 malam di update. Isi dengan kata-kata
  
  0 1 * * * /usr/local/bin/mirrorbuild.sh
+
  # 0 1 * * * /usr/local/bin/mirrorbuild.sh
 
 
 
 
* Aktifkan cron
 
 
 
# /etc/init.d/cron restart
 
 
 
==Setup di sisi Client==
 
 
 
* Edit /etc/apt/sources.list dan isi sebagai berikut
 
 
 
Untuk 9.04
 
 
 
deb http://mirrorbox/ubuntu jaunty main restricted universe multiverse
 
deb http://mirrorbox/ubuntu jaunty-updates main restricted universe multiverse
 
deb http://mirrorbox/ubuntu jaunty-security main restricted universe multiverse
 
 
 
Ubuntu 9.10
 
 
 
deb http://mirrorbox/ubuntu/ karmic main restricted universe multiverse
 
deb http://mirrorbox/ubuntu/ karmic-updates main restricted universe multiverse
 
deb http://mirrorbox/ubuntu/ karmic-security main restricted universe multiverse
 
deb http://mirrorbox/ubuntu/ karmic-backports main restricted universe multiverse
 
deb http://mirrorbox/ubuntu/ karmic-proposed main restricted universe multiverse
 
  
  

Latest revision as of 18:37, 17 November 2010

mkdir /var/data
mkdir /var/data/public
mkdir /var/data/repo
chown -Rf nobody.nogroup /var/data
chmod -Rf 777 /var/data

mkdir /home/ftp/pub
mkdir /home/ftp/pub/repo
chown -Rf ftp.nogroup /home/ftp/pub
chown -Rf root.root /var/data/repo
chmod -Rf 571 /var/data/repo
mkdir /var/www/ubuntu
mkdir /home/ftp/pub/repo
mount --bind /var/data/repo /var/www/ubuntu
mount --bind /var/data/repo /home/ftp/pub/repo
mkdir /var/data/mirrorkeyring
gpg --no-default-keyring --keyring /var/data/mirrorkeyring/trustedkeys.gpg --import /usr/share/keyrings/ubuntu-archive-keyring.gpg

Menyiapkan Update Mirror Automatis setiap malam

  • Install debmirror
apt-get install debmirror
mkdir /var/data/repo
chown -Rf nobody.nogroup /var/data/repo
  • Buatlah script mirror
vi /usr/local/bin/mirrorbuild.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=karmic
# release=karmic,karmic-security,karmic-updates
# release=karmic,karmic-security,karmic-updates,karmic-backports,karmic-proposed
# release=lucid,lucid-security,lucid-updates,lucid-backports,lucid-proposed 
release=maverick,maverick-security,maverick-updates,maverick-backports,maverick-proposed
# release=natty,natty-backports,natty-proposed,natty-security,natty-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=125.160.17.22
# server=192.168.0.2
# server=kambing.ui.edu
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/repo

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

chmod -Rf 777 /usr/local/bin/mirrorbuild.sh

Cron supaya secara periodik di update

  • Edit Tabel cron
crontab -e
  • Agar setiap jam 1 malam di update. Isi dengan kata-kata
# 0 1 * * * /usr/local/bin/mirrorbuild.sh


Pranala Menarik