Membuat Repository Ubuntu Lokal menggunakan NAS

From SpeedyWiki

Jump to: navigation, search

Asumsi kita akan menempelkan sebuah NAS

  • IP Address NAS : 10.150.5.240
  • Folder Share  : share
  • username  : usernamenas
  • password  ; passwordnas
  • Folder Repo  : share/repository/
  • Repo 9.10  : share/repository/repo-9.10
  • Repo 10.04  : share/repository/repo-10.4
  • Repo 10.10  : share/repository/repo-10.10
  • Repo 11.04  : share/repository/repo-11.04
  • Repo 11.10  : share/repository/repo-11.10
  • Repo 12.04  : share/repository/repo-12.04

Contents

[edit] Mount Folder NAS ke PC / laptop

Siapkan samba & smbfs

sudo apt-get install samba smbfs debmirror

Mount share folder NAS ke folder /mnt/nas di PC / laptop

mkdir /mnt/nas
mount -t cifs //10.150.5.240/share /mnt/nas/ -o password=passwordnas -o username=usernamenas

Jika tidak ada username & password gunakan

mkdir /mnt/nas
mount -t cifs //10.150.5.240/share /mnt/nas/ -o password=

[edit] Mount Repo NAS ke /var/data/repository

Tempelkan Tempat Repository di NAS ke /var/data/repository

mkdir /mnt/nas/repository
mkdir /var/data
mkdir /var/data/repository
mount --bind /mnt/nas/repository/ /var/data/repository/

[edit] Mengubah /etc/apt/sources.list

Edit

vi /etc/apt/sources.list

Isi dengan

deb file:///var/data/repository/repo-9.10/ karmic main multiverse restricted universe
deb file:///var/data/repository/repo-9.10/ karmic-updates main multiverse restricted universe
deb file:///var/data/repository/repo-9.10/ karmic-security main multiverse restricted universe
deb file:///var/data/repository/repo-9.10/ karmic-backports main multiverse restricted universe
deb file:///var/data/repository/repo-9.10/ karmic-proposed main multiverse restricted universe

deb file:///var/data/repository/repo-10.4/ lucid main multiverse restricted universe
deb file:///var/data/repository/repo-10.4/ lucid-updates main multiverse restricted universe
deb file:///var/data/repository/repo-10.4/ lucid-security main multiverse restricted universe
deb file:///var/data/repository/repo-10.4/ lucid-backports main multiverse restricted universe
deb file:///var/data/repository/repo-10.4/ lucid-proposed main multiverse restricted universe

deb file:///var/data/repository/repo-10.10/ maverick main multiverse restricted universe
deb file:///var/data/repository/repo-10.10/ maverick-updates main multiverse restricted universe
deb file:///var/data/repository/repo-10.10/ maverick-security main multiverse restricted universe
deb file:///var/data/repository/repo-10.10/ maverick-backports main multiverse restricted universe
deb file:///var/data/repository/repo-10.10/ maverick-proposed main multiverse restricted universe

deb file:///var/data/repository/repo-11.04/ natty main multiverse restricted universe
deb file:///var/data/repository/repo-11.04/ natty-backports main multiverse restricted universe
deb file:///var/data/repository/repo-11.04/ natty-proposed main multiverse restricted universe
deb file:///var/data/repository/repo-11.04/ natty-security main multiverse restricted universe
deb file:///var/data/repository/repo-11.04/ natty-updates main multiverse restricted universe

deb file:///var/data/repository/repo-11.10/ oneiric main multiverse restricted universe
deb file:///var/data/repository/repo-11.10/ oneiric-backports main multiverse restricted universe
deb file:///var/data/repository/repo-11.10/ oneiric-proposed main multiverse restricted universe
deb file:///var/data/repository/repo-11.10/ oneiric-security main multiverse restricted universe
deb file:///var/data/repository/repo-11.10/ oneiric-updates main multiverse restricted universe

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

Jangan lupa setelah mengubah /etc/apt/sources.list lakukan

apt-get update

[edit] Mensharing Repo Lokal ke Komputer Lain Menggunakan Web

Install Apache

sudo apt-get install lamp-server^

Mount Repository ke Folder Web

mkdir /var/www/ubuntu-9.10
mkdir /var/www/ubuntu-10.04
mkdir /var/www/ubuntu-10.10
mkdir /var/www/ubuntu-11.04
mkdir /var/www/ubuntu-11.10
mkdir /var/www/ubuntu-12.04
mount --bind /mnt/nas/repository/repo-9.10 /var/www/ubuntu-9.10
mount --bind /mnt/nas/repository/repo-10.4 /var/www/ubuntu-10.04
mount --bind /mnt/nas/repository/repo-10.10 /var/www/ubuntu-10.10
mount --bind /mnt/nas/repository/repo-11.04 /var/www/ubuntu-11.04
mount --bind /mnt/nas/repository/repo-11.10 /var/www/ubuntu-11.10
mount --bind /mnt/nas/repository/repo-12.04 /var/www/ubuntu-12.04

Di komputer client di jaringan, file /etc/apt/sources.list perlu di ubah sesuai contoh berikut,

[edit] Mengupdate Isi Repository & Cron malam hari

Install debmirror

apt-get install debmirror

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

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

Buat file mirrorbuild.sh untuk masing-masing versi repository

Pastikan agar mirrorbuild* bisa di execute

chmod -Rf 777 /usr/local/bin/mirrorbuild*
chown -Rf nobody.nogroup /usr/local/bin/mirrorbuild*

Jika kita ingin mengupdate sekaligus misalnya setiap jam 7 malam maka kita perlu,

  • buat file misalnya
touch /usr/local/bin/mirrorbuildall.sh
chmod +x /usr/local/bin/mirrorbuildall.sh
vi /usr/local/bin/mirrorbuildall.sh

isi dengan

/usr/local/bin/mirrorbuild.9.10.sh
/usr/local/bin/mirrorbuild.10.04.sh
/usr/local/bin/mirrorbuild.10.10.sh
/usr/local/bin/mirrorbuild.11.04.sh
/usr/local/bin/mirrorbuild.11.10.sh
/usr/local/bin/mirrorbuild.12.04.sh

Masukan ke crontab & matikan setiap jam 7 pagi

crontab -e
0 19 * * * /usr/local/bin/mirrorbuildall.sh
0 7 * * * killall debmirror
2 7 * * * killall debmirror
4 7 * * * killall debmirror
8 7 * * * killall debmirror
10 7 * * * killall debmirror
12 7 * * * killall debmirror
14 7 * * * killall debmirror


[edit] Pranala Menarik

Personal tools