Building Repository - aptly

Web server

  • /root/http/default.conf

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    server {
        listen       80;
        server_name  localhost;
    
        location / {
            autoindex on;
            root   /usr/share/nginx/html;
        }
    }
    
  • Start nginx:

    1
    2
    
    cd /root/http
    docker run -tid -p 80:80 -v $PWD:/usr/share/nginx/html:ro -v $PWD/default.conf:/etc/nginx/conf.d/default.conf nginx
    

GPG Key

1
2
3
4
5
6
# export private key
gpg --list-secret-keys --keyid-format LONG
gpg --export-secret-keys ACDE1233 > ACDE1233.asc

# import private key
gpg --import ACDE1233.asc

APTLY

  • Useful aptly commands:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    aptly repo create xenial
    aptly repo create artful
    
    aptly repo add artful *.deb
    aptly repo add xenial *.deb
    
    aptly publish repo -distribution="artful" artful prefixaa
    aptly publish repo -distribution="xenial" xenial
    
    aptly publish update xenial
    aptly publish update artful prefixaa
    
    aptly repo show -with-packages artful
    
    aptly repo create bionic
    aptly repo add bionic *.deb
    aptly publish repo -distribution="bionic" bionic bb
    aptly publish update bionic bb
    
  • Commands:

    1
    2
    3
    4
    5
    
    # Update commands
    for deb in `ls`; do aptly repo remove artful $deb; done
    
    # tty issue
    stty rows 50 && stty cols 150
    
  • Server side:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    docker run  -tid \
      -e FULL_NAME="Shihta Kuan" \
      -e EMAIL_ADDRESS="Shihta.Kuan@gmail.com" \
      -e GPG_PASSWORD="YOURPASSWORD" \
      -e HOSTNAME=debs.shida.info \
      -v /opt/aptly:/opt/aptly \
      -v $PWD:/debs \
      -p 81:80 \
      bryanhong/aptly:latest
    
  • sources.list on client side:

    • xenial

      1
      2
      3
      4
      
      wget -qO - http://debs.shida.info:81/aptly_repo_signing.key | apt-key add -
      
      # my.list
      deb http://debs.shida.info:81 xenial main
      
    • artful

      1
      2
      3
      4
      
      wget -qO - http://debs.shida.info:81/aptly_repo_signing.key | apt-key add -
      
      # my.list
      deb http://debs.shida.info:81/prefixaa artful main
      
    • bionic

      1
      2
      3
      
      wget -qO - http://debs.shida.info:81/aptly_repo_signing.key | apt-key add -
      
      deb http://debs.shida.info:81/bb bionic main
      

RPM repository

  • download rpms:

    1
    2
    3
    4
    5
    6
    
    base=ftp://free.nchc.org.tw/centos/7/virt/x86_64/libvirt-latest/
    set -x; \
    for n in `curl $base |grep 4.3.0| awk '{print $9}'`; do \
      wget -q $base$n; \
    done; \
    set +x
    
  • Server side:

    1
    2
    3
    4
    5
    6
    
    # prepare tools
    apt-get install createrepo
    
    # generate the "repomd.xml"
    cd /root/http
    createrepo ./rpm
    
comments powered by Disqus