Deploying Linux Repositories

Without synchronization, etc., in the option “there is a hosting” or “file trash” and you need to quickly roll out the package repository for the Linux distribution (so that you can connect to this repository and put everything you need from there). Sometimes updated manually - by copying to the same address with rewriting. Once every six months or a year. The task is typical and I will describe it in a semi-automatic mode.

RHEL repository
1. Create the key RPM-GPG-KEY. Standardly.
$ cd ~
$ gpg --gen-key
$ gpg --export -a 'Name Surname (repo)' > RPM-GPG-KEY

2. Create a ~ / .rpmmacros file with the following contents:
%_signature gpg
%_gpg_path ~/.gnupg
%_gpg_name Name Surname (repo)

3. We create the repo directory, and in it the directories i386, i686 and x86_64. Transfer the RPM-GPG-KEY key there
$ mkdir -p repo repo/i386 repo/i686 repo/x86_64
$ mv RPM-GPG-KEY repo/RPM-GPG-KEY

4. Download and lay out directories packages for the respective architectures. For i386 and i686 in most cases there will be identical packages. For x86_64, a package (for example, TeamViewer) may not exist, in this case the corresponding i686 package is placed and in most cases it works in RHEL.

5. We put a script in the repo directory to prepare the repository .

6. Run the script and respond with the passphrase of the key to the request.
$ chmod a+x
$ ./repo_rhel.sh

7. Upload the repo directory to the hosting and describe the repository in /etc/yum.repos.d/nobody.repo
[nobody]
name=nobody repo
baseurl=http:///repo/$basearch
gpgkey=http:///repo/RPM-GPG-KEY
enabled=1
gpgcheck=1
priority=1

8. Checking the operation of the repository
# yum clean all
# yum list | grep nobody
Debian repository
1. Create the key DEB-GPG-KEY. Standardly.
$ cd ~
$ gpg --gen-key
$ gpg --export -a 'Name Surname (repo)' > DEB-GPG-KEY

2. Create a ~ / .rpmmacros file with the following contents:
%_signature gpg
%_gpg_path ~/.gnupg
%_gpg_name Name Surname (repo)

3. Create the repo directory and the dists and pool directories in it. They will already have a directory system. Transfer the DEB-GPG-KEY key there
$ mkdir -p repo/dists/nobody/soft/binary-i386
$ mkdir -p repo/dists/nobody/soft/binary-x86_64
$ mkdir -p repo/pool/soft/binary-i386/t/teamviewer
$ mkdir -p repo/pool/soft/binary-x86_64/t/teamviewer
$ mv DEB-GPG-KEY repo/DEB-GPG-KEY

4. In the dists directory, we will store data about the packages, and in the pool directory - the packages themselves. Moreover, it can already be seen from the name / binary-i386 / t / teamviewer that the packages are decomposed by architecture, then by letter directories and then by directories with names derived from the name of the software contained in them (they may contain a dozen packages necessary for a specific software according to its dependencies ) Those. There is a given hierarchy.

5. We put a script in the repo directory to prepare the repository . In the first line of the script we change the key_pass = "password" to the password of your key.

6. Run the script and wait for it to work.
$ chmod a+x
$ ./repo_debian.sh

7. Upload the repo directory to the hosting and describe the repository in /etc/apt/sources.list
deb http:///repo nobody soft

8. Checking the operation of the repository
$ wget http:///repo/DEB-GPG-KEY
$ sudo apt-key add DEB-GPG-KEY
$ sudo apt-get clean
$ sudo apt-get update


Also popular now: