Linux Unix help !!

"Give respect to Time, One day at right Time, Time will respect You"

Friday, September 16, 2016

Setup SUSE Local Repository

Description: There are many situation where internet access not available on server and it's being required to install packages as need with dependencies. The solution is simple to create local repository and publish to servers within network .

Here below are simple minimal steps required to setup a local repository on SUSE operating system 

Steps :
1. Mount iso/dvd
mount /dev/cdrom/ /mnt

2. Disable all existing repos
zypper mr  -d -a

3. Set enable DVD repo temporary 
zypper ar dir:///mnt/ OpensuseDVD

4. Install createrepo
zypper -n install createrepo

5. Install apache
zypper -n install apache2

6. Copy rpms
mkdir -p /srv/www/myrepo/Suse13
rsync -avp /mnt/suse/ /srv/www/myrepo/Suse13/

#copy gpg keys
cp -rp /mnt/gpg-pubkey-* /srv/www/myrepo/Suse13/

7. Create apache config for repo
# cat /etc/apache2/conf.d/mrepo.conf
Alias /repo /srv/www/myrepo/
<Directory /srv/www/myrepo/>
        Options Indexes FollowSymlinks SymLinksifOwnerMatch IncludesNOEXEC
        IndexOptions NameWidth=* DescriptionWidth=*
          AllowOverride None
          Order deny,allow
          Allow from all

8. Restart/reload enable apache2
rcapache2 start
chkconfig -a apache2

9. Createrepo "It will take bit time .."
createrepo -v /srv/www/myrepo/Suse13/

Spawning worker 0 with 5187 pkgs
        Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

ls -l /srv/www/myrepo/Suse13/repodata/

10. Add Repo (ar)
#zypper addrepo -t <repository type> <path> <repository name>
zypper addrepo -t YUM  SLES13.2

# Test "First time run ask to assign repo metadata"
zypper se test

File 'repomd.xml' from repository 'SLES13.2' is unsigned, continue? [yes/no] (no): yes
Building repository 'SLES13.2' cache ......................

#Change priority  
zypper mr -p 1 SUSE13.2

zypper lr SUSE13.2

#Validate repo config file
vi  /etc/zypp/repos.d/SLES13.2.repo

priority=1   # 0-99, 0 -higher
#Added below this line gpg keys

11. View repositry detials 
# zypper lr SUSE13.2
Alias          : SUSE13.2
Name           : SLES13.2
URI            :
Enabled        : Yes
Priority       : 1
Auto-refresh   : Off
Keep Packages  : Off
Type           : rpm-md
GPG Check      : On
GPG Key URI    :,
Path Prefix    :
Parent Service :
MD Cache Path  : /var/cache/zypp/raw/SUSE13.2

12. Install a package
zypper install  nmap

Keyword/TAG: SUSE 13.2, Local, Repository, http, apache2


Pls LIKE my Story !!!