📜 ⬆️ ⬇️

Deploying Linux Repositories

Without synchronization, etc., in the option "there is a hosting" or "file dump" 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 overwriting. Every six months or a year. The task is typical and I will describe it in semi-automatic mode.

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

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

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

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

5. Put in the repo directory script to prepare the repository .

6. Run the script and respond with the key phrase with the request key.
 $ 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://<IP->/repo/$basearch gpgkey=http://<IP->/repo/RPM-GPG-KEY enabled=1 gpgcheck=1 priority=1 

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

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

3. Create the repo directory, and in it the dists and pool directories. They will already have a directory system. We transfer there key DEB-GPG-KEY
 $ 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. And from the name / binary-i386 / t / teamviewer, it is already clear that the packages are arranged according to architecture, then by letter directories and then by directories with names originating from the name of the software they contain (they can contain a dozen packages needed by the specific software ). Those. there is a given hierarchy.
')
5. Put in the repo directory script to prepare the repository . Change the first line of the script 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://<IP->/repo nobody soft 

8. Check repository operation
 $ wget http://<IP->/repo/DEB-GPG-KEY $ sudo apt-key add DEB-GPG-KEY $ sudo apt-get clean $ sudo apt-get update 

Source: https://habr.com/ru/post/168635/


All Articles