How to Create Local Yum Repo on CentOS 7

  Рет қаралды 19,024

LazyAdmin

LazyAdmin

Күн бұрын

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

Пікірлер: 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
@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
@arkanjo7509
@arkanjo7509 3 жыл бұрын
thanks
@lazyadmin3760
@lazyadmin3760 3 жыл бұрын
You are welcome
@samiulhaqmalik7591
@samiulhaqmalik7591 2 жыл бұрын
Hello, How to Verify that this package can be installed from your repo?
@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
@lifeinframesd7t
@lifeinframesd7t 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
Configure local yum repository and Using FTP in Redhat7  | CentOS7
22:11
Creating an offline REPO for offline RedHat machines
21:33
FTS_tuts
Рет қаралды 8 М.
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 3 МЛН
Smart Sigma Kid #funny #sigma
00:14
CRAZY GREAPA
Рет қаралды 28 МЛН
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
SIDELNIKOVVV
Рет қаралды 4,2 МЛН
Nginx Load balancing / Reverse Proxy / Configuration / Demo
19:48
Local YUM REPO on CentOS 7 / RHEL 7 using DVD ISO
12:42
Linux Academy
Рет қаралды 68 М.
How to create a valid self signed SSL Certificate?
25:01
Christian Lempa
Рет қаралды 364 М.
OpenSSH for Absolute Beginners
23:00
Veronica Explains
Рет қаралды 112 М.
Configuring Kernel Based Virtual Machine (KVM)  on  RHEL or  CentOS 7
29:43
Fix Error yum install packages Centos 7
8:25
Linux-Fix
Рет қаралды 855
RHEL 8 Creating Local Repositories
5:55
theurbanpenguin
Рет қаралды 24 М.
Linux Crash Course - The dnf Command
28:01
Learn Linux TV
Рет қаралды 42 М.
Zabbix Client Autoregistration / Active Client
23:47
LazyAdmin
Рет қаралды 1,2 М.