createrepo and smart channel

1. createrepo is python script to setup rpm repositories.

mkdir ~/repo and copy your rpms into the directory.

2. createrepo ~/repo, then there will be repomd(meta data)

bash-4.3> ls ~/repo/repodata/
2d6fe7e0c5060befbe00b6767da7d009f6efd165af7d46976b47ab69cf089b21-primary.sqlite.bz2
487f80da6e2c0ddf70c841d19027478b590c1f70f6b55ec77df88f5ba3837b2a-primary.xml.gz
4c9f6c5213785b05175639c53e5ad2c84921b9cf61730b5ae4960d36e452ee62-filelists.xml.gz
8379480a2469b14c5734066b437d0eef06277bee21b781d84aedf18c08ed527b-filelists.sqlite.bz2
b8c7ef799f45acd12a2a4897b1e6fce0d5d1efe9b00f88f885f9c2a01557731e-other.xml.gz
d61750ab5ec7d815953ecd8af7565d0afe0e224517ebed02a0c6c31447e4dd47-other.sqlite.bz2
repomd.xml
bash-4.3> ls ~/repo/repodata/
2d6fe7e0c5060befbe00b6767da7d009f6efd165af7d46976b47ab69cf089b21-primary.sqlite.bz2
487f80da6e2c0ddf70c841d19027478b590c1f70f6b55ec77df88f5ba3837b2a-primary.xml.gz
4c9f6c5213785b05175639c53e5ad2c84921b9cf61730b5ae4960d36e452ee62-filelists.xml.gz
8379480a2469b14c5734066b437d0eef06277bee21b781d84aedf18c08ed527b-filelists.sqlite.bz2
b8c7ef799f45acd12a2a4897b1e6fce0d5d1efe9b00f88f885f9c2a01557731e-other.xml.gz
d61750ab5ec7d815953ecd8af7565d0afe0e224517ebed02a0c6c31447e4dd47-other.sqlite.bz2
repomd.xml
3. Add it to apache server.

cat /etc/apach2/site-avaiable/001-repo.conf

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that  
    # the server uses to identify itself. This is used when creating            
    # redirection URLs. In the context of virtual hosts, the ServerName         
    # specifies what hostname must appear in the request's Host: header to      
    # match this virtual host. For the default virtual host (this file) this    
    # value is not decisive as it is used as a last resort host regardless.     
    # However, you must set it for any further virtual host explicitly.         
    #ServerName www.example.com                                                 
        ServerName test.com
        ServerAlias www.test.com
    DocumentRoot /var/www/repo

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,      
    # error, crit, alert, emerg.                                                
    # It is also possible to configure the loglevel for particular              
    # modules, e.g.                                                             
    #LogLevel info ssl:warn                                                     

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are 
    # enabled or disabled at a global level, it is possible to                  
    # include a line for only one particular virtual host. For example the      
    # following line enables the CGI configuration for this host only           
    # after it has been globally disabled with "a2disconf".                     
    #Include conf-available/serve-cgi-bin.conf                                  
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
4. setup web Document root

ln -s ~/repo /var/www/repo/

5. enable the website

ln -s /etc/apache2/site-available/0001-repo.conf /etc/apache2/site-enable/

6. service apache2 restart

on the client:

smart channel --add mysource type=rpm-md baseurl=http://www.test.com/repo/

then smart update

smart install your_pkg


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章