Тёмный

How to Create Local Yum Repo on CentOS 7 

LazyAdmin
Подписаться 382
Просмотров 19 тыс.
50% 1

Step 1: Configure Network Access
yum install httpd
Step 2: Create Yum Local Repository
yum install createrepo
yum install yum-utils
Step 3: Create a Directory to Store the Repositories
mkdir -p /var/www/html/repos/{base,centosplus,extras,updates}
Step 4: Synchronize HTTP Repositories
reposync -g -l -d -m --repoid=base --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=centosplus --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=extras --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=updates --newest-only --download-metadata --download_path=/var/www/html/repos/
Step 5: Create the New Repository
createrepo /var/www/html
Step 6: Setup Local Yum Repository on Client System
mv /etc/yum.repos.d/*.repo /tmp/
Create and edit a new config file:
nano /etc/yum.repos.d/remote.repo
In the new file, enter the command (replacing the IP address with the IP address of your server):
[remote]
name=RHEL Apache
baseurl=IP Address
enabled=1
gpgcheck=0
Finally, save the file and exit.
]
Test the Configuration
While still on the client system, run a command to install a package with the yum package manager:
yum install httpd
For NGINX
#yum install nginx -y
#systemctl start nginx
#systemctl enable nginx
#systemctl status nginx
#yum install createrepo yum-utils
#mkdir -p /var/www/html/repos/{base,centosplus,extras,updates}
reposync -g -l -d -m --repoid=base --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=centosplus --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=extras --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=updates --newest-only --download-metadata --download_path=/var/www/html/repos/
createrepo -g comps.xml /var/www/html/repos/base/
createrepo -g comps.xml /var/www/html/repos/centosplus/
createrepo -g comps.xml /var/www/html/repos/extras/
createrepo -g comps.xml /var/www/html/repos/updates/
vim /etc/nginx/conf.d/repos.conf
server {
listen 80;
server_name name or ip for server;
root /var/www/html/repos;
location / {
index index.php index.html index.htm;
autoindex on; #enable listing of directory index
}
}
For Cron Script
#vim /etc/cron.daily/update-localrepos
#!/bin/bash
##specify all local repositories in a single variable
LOCAL_REPOS=”base centosplus extras updates”
##a loop to update repos one at a time
for REPO in ${LOCAL_REPOS}; do
reposync -g -l -d -m --repoid=$REPO --newest-only --download-metadata --download_path=/var/www/html/repos/
createrepo -g comps.xml /var/www/html/repos/$REPO/
done
#chmod 755 /etc/cron.daily/update-localrepos
#vim /etc/yum.repos.d/local-repos.repo
[local-base]
name=CentOS Base
baseurl=name or ip of server/base/
gpgcheck=0
enabled=1
[local-centosplus]
name=CentOS CentOSPlus
baseurl=name or ip of server/centosplus/
gpgcheck=0
enabled=1
[local-extras]
name=CentOS Extras
baseurl=name or ip of server/extras/
gpgcheck=0
enabled=1
[local-updates]
name=CentOS Updates
baseurl=name or ip of server/updates/
gpgcheck=0
enabled=1
Test the configuration
#yum repolist
#yum repolist all

Опубликовано:

 

7 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 20   
@yani.e
@yani.e 3 года назад
You’re awesome homez!!! You saved me an hour of headache…
@lazyadmin3760
@lazyadmin3760 3 года назад
Glad you have liked the video
@juanotecruz
@juanotecruz 3 года назад
thank you LazyAdmin great video!!!!!!
@lazyadmin3760
@lazyadmin3760 3 года назад
You are welcome Juan
@arkanjo7509
@arkanjo7509 3 года назад
thanks
@lazyadmin3760
@lazyadmin3760 3 года назад
You are welcome
@1989Michelito
@1989Michelito 2 года назад
I would like to add epel repository also , i'm wondering how I can add this , I imagine I have to create another folder for example epel but my question is : do I have to download epel packages to a folder "epel" or I have this in the folder "extras " ?
@lazyadmin3760
@lazyadmin3760 2 года назад
Yes you have to download epel packages and reference them
@amrelkhedewy
@amrelkhedewy 2 года назад
Hello How to add remi repository on the server? And how could i install package on the client side from specific repo For Example: I need to install php72 which located in remi repo..how this could be done on the client side?
@lazyadmin3760
@lazyadmin3760 2 года назад
# nano /etc/yum.repos.d/remi.repo Set the enabled field to 1 [remi] name=Les RPM de remi pour Enterprise Linux $releasever - $basearch #baseurl=rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/ mirrorlist=rpms.famillecollet.com/enterprise/$releasever/remi/mirror enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi failovermethod=priority [remi-test] name=Les RPM de remi en test pour Enterprise Linux $releasever - $basearch #baseurl=rpms.famillecollet.com/enterprise/$releasever/test/$basearch/ mirrorlist=rpms.famillecollet.com/enterprise/$releasever/test/mirror enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
@samiulhaqmalik7591
@samiulhaqmalik7591 2 года назад
Hello, How to Verify that this package can be installed from your repo?
@jefinshaji4598
@jefinshaji4598 3 года назад
I have created a folder called packages In /var/www/html/ and copied some .rpm packages to it. Then changed selinux context to httpd_sys_content_t. Also added http in firewall. On the client machine I created a repo file "new.repo" in /etc/yum.repos.d/ The repo file contains [new] name = newrepo enabled = 1 gpgcheck = 0 baseurl= 192.168.10.54/Packages/ Then I cleaned the yum cache using Yum clean all And then I tried to list repos using Yum repolist all But it says the repo file is disabled. I tried everything but it's still disabled Please help
@ahmedjarral8923
@ahmedjarral8923 3 года назад
hey lazy admin... why we do gpgcheck= 0 can you tell me... i am sorta new to this thing..
@lazyadmin3760
@lazyadmin3760 3 года назад
Gpgcheck is to verify they signatures if they are signed or not setting it 0 meand do not check or verify the digital signatures
@ahmedjarral8923
@ahmedjarral8923 3 года назад
@@lazyadmin3760 when i am installing the pakages for updates after 800 they just fails.. i dont know why.. :(
@salmanzafar1949
@salmanzafar1949 3 года назад
you are best , what best time to talk to you.
@senghimeith9780
@senghimeith9780 3 года назад
Your screen is smallest
@lazyadmin3760
@lazyadmin3760 3 года назад
Will try to be better
Далее
Linux Crash Course - The dnf Command
28:01
Просмотров 42 тыс.
لدي بط عالق في أذني😰🐤👂
00:17
Creating an offline REPO for offline RedHat machines
21:33
SSH Keys
10:12
Просмотров 112 тыс.
Syncthing Made EASY
28:30
Просмотров 151 тыс.
RHEL 8 Creating Local Repositories
5:55
Просмотров 24 тыс.