http://eloraculodelpinguino.blogspot.com/2015/05/linux-centos-crear-un-repositorio-yum.html
El método para Centos 7.x minimal es muy similar, pero contiene mínimas diferencias. Además este método prueba ser más ordenado y con menos pasos que el anteriormente publicado.
Para este laboratorio se tiene el siguiente Escenario:
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
[root@localhost ~]#
1. Montar el CD/DVD en un directorio del S.O.
[root@localhost ~]# ls -ltr /dev/sr0
brw-rw----. 1 root cdrom 11, 0 Jun 22 11:56 /dev/sr0
Crear un directorio de montaje para el contenido de CentOS-7-x86_64-DVD
[root@localhost ~]# mkdir -p /media/cdrom/
[root@localhost ~]# ls -ltr /media/cdrom/
total 0
[root@localhost ~]#
Montar la unidad de CDROM en el directorio
[root@localhost ~]# mount -o loop /dev/sr0 /media/cdrom/
2. Instalar rpm createrepo y sus dependencias:
Centos 7.x minimal no tiene incluído el package createrepo, el cual es necesario para la instalación del repositorio de cdrom.
Si se intanta instalar el rpm aparece el siguiente error de dependencias:
[root@localhost ~]# rpm -ivh /media/cdrom/Packages/createrepo-0.9.9-23.el7.noarch.rpm
warning: /media/cdrom/Packages/createrepo-0.9.9-23.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
deltarpm is needed by createrepo-0.9.9-23.el7.noarch
libxml2-python is needed by createrepo-0.9.9-23.el7.noarch
python-deltarpm is needed by createrepo-0.9.9-23.el7.noarch
[root@localhost ~]#
Los rpm necesarios para la instalación de createrepo se encuentran dentro del DVD montado en el sistema:
[root@localhost ~]# rpm -ivh /media/cdrom/Packages/deltarpm-3.6-3.el7.x86_64.rpm
warning: /media/cdrom/Packages/deltarpm-3.6-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:deltarpm-3.6-3.el7 ################################# [100%]
[root@localhost ~]# rpm -ivh /media/cdrom/Packages/python-deltarpm-3.6-3.el7.x86_64.rpm
warning: /media/cdrom/Packages/python-deltarpm-3.6-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:python-deltarpm-3.6-3.el7 ################################# [100%]
[root@localhost ~]# rpm -ivh /media/cdrom/Packages/libxml2-python-2.9.1-5.el7_0.1.x86_64.rpm
warning: /media/cdrom/Packages/libxml2-python-2.9.1-5.el7_0.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:libxml2-python-2.9.1-5.el7_0.1 ################################# [100%]
Con las dependencias instaladas, continuar con la instalación de createrepo
[root@localhost ~]# rpm -ivh /media/cdrom/Packages/createrepo-0.9.9-23.el7.noarch.rpm
warning: /media/cdrom/Packages/createrepo-0.9.9-23.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:createrepo-0.9.9-23.el7 ################################# [100%]
[root@localhost ~]#
3. Crear archivo cdrom.repo
[root@localhost ~]# cat /etc/yum.repos.d/cdrom.repo
[cdrom]
name=Unixmen Repository
baseurl=file:///media/cdrom
gpgcheck=0
enabled=1
[root@localhost ~]# ls -ltr /etc/yum.repos.d/cdrom.repo
-rw-r--r--. 1 root root 81 Jun 20 18:36 /etc/yum.repos.d/cdrom.repo
[root@localhost ~]#
4. Crear metadatos del repositorio cdrom.repo
Ejecutar el comando createrepo con los siguientes parámetros:
/media/cdrom/ -> siendo el directorio de montaje del DVD
/etc/yum.repos.d/ -> siendo el directorio donde se crea el archivo de metadata del repo.
[root@localhost ~]# createrepo -v /media/cdrom/ -o /etc/yum.repos.d/
Spawning worker 0 with 3576 pkgs
Worker 0: reading Packages/389-ds-base-1.3.3.1-13.el7.x86_64.rpm
Worker 0: reading Packages/389-ds-base-libs-1.3.3.1-13.el7.x86_64.rpm
...
Worker 0: reading Packages/zsh-5.0.2-7.el7.x86_64.rpm
Worker 0: reading Packages/zziplib-0.13.62-5.el7.x86_64.rpm
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Starting other db creation: Mon Jun 22 12:04:01 2015
Ending other db creation: Mon Jun 22 12:04:02 2015
Starting filelists db creation: Mon Jun 22 12:04:02 2015
Ending filelists db creation: Mon Jun 22 12:04:05 2015
Starting primary db creation: Mon Jun 22 12:04:05 2015
Ending primary db creation: Mon Jun 22 12:04:07 2015
Sqlite DBs complete
[root@localhost ~]#
Verificar que se crea el siguiente directorio:
[root@localhost ~]# ls -ltr /etc/yum.repos.d/repodata/
total 11816
-rw-r--r--. 1 root root 872337 Jun 22 12:04 ef04b6dc0b5b437bed9e05a44e5f9978d62781d640ebcf09dc4098a806c774fd-other.xml.gz
-rw-r--r--. 1 root root 1383625 Jun 22 12:04 bdfd37b128ce895899df488764fee463d589986ba41fc399b5766865961a4ea4-primary.xml.gz
-rw-r--r--. 1 root root 2902099 Jun 22 12:04 65666f9c4ae025e8363f203bc436b6f8810ca6eeb92a9674945e9401846f400b-filelists.xml.gz
-rw-r--r--. 1 root root 1189885 Jun 22 12:04 d683b9a986e59a7b0347c34b28137c89611b4013d1f569f22e79f014e83bfb74-other.sqlite.bz2
-rw-r--r--. 1 root root 2882134 Jun 22 12:04 9df0dccbf380d7af65397d20846942062c7e270dd81a6c36824dd360caad464f-filelists.sqlite.bz2
-rw-r--r--. 1 root root 2858319 Jun 22 12:04 0fb2b626d7c1358e95936fb4f0087696b010caaafc27ec0f3942b299d2c3c8c1-primary.sqlite.bz2
-rw-r--r--. 1 root root 3008 Jun 22 12:04 repomd.xml
[root@localhost ~]#
5. Limpiar cache y testing
Para limpiar la cache, ejecutar los siguientes comandos:
[root@localhost ~]# yum clean all
[root@localhost ~]# yum update
Con el comando yum repolist, se observa el repositorio cdrom considerado dentro del Sistema.
[root@localhost ~]# yum repolist
...
repo id repo name status
base/7/x86_64 CentOS-7 - Base 0
cdrom Unixmen Repository 3576
extras/7/x86_64 CentOS-7 - Extras 0
updates/7/x86_64 CentOS-7 - Updates 0
repolist: 3576
[root@localhost ~]#
Para el testeo, se propone instalar el utilitario ifconfig, el cual no se encuentra dentro de la instalación minimal
[root@localhost ~]# yum search --disablerepo="*" --enablerepo="cdrom" ifconfig
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
cdrom | 3.6 kB 00:00:00
(1/2): cdrom/group_gz | 154 kB 00:00:00
(2/2): cdrom/primary_db | 2.7 MB 00:00:00
Determining fastest mirrors
====================================================================================== Matched: ifconfig =======================================================================================
net-tools.x86_64 : Basic networking tools
[root@localhost ~]#
[root@localhost ~]# yum install --disablerepo="*" --enablerepo="cdrom" net-tools.x86_64
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================================================================================
Installing:
net-tools x86_64 2.0-0.17.20131004git.el7 cdrom 304 k
Transaction Summary
================================================================================================================================================================================================
Install 1 Package
Total download size: 304 k
Installed size: 917 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : net-tools-2.0-0.17.20131004git.el7.x86_64 1/1
Verifying : net-tools-2.0-0.17.20131004git.el7.x86_64 1/1
Installed:
net-tools.x86_64 0:2.0-0.17.20131004git.el7
Complete!
[root@localhost ~]#
Finalmente ejecutar ifconfig para chequear:
[root@localhost ~]# ifconfig -a
enp0s3: flags=4163 mtu 1500
inet 192.168.56.101 netmask 255.255.255.0 broadcast 192.168.56.255
inet6 fe80::a00:27ff:fed9:c202 prefixlen 64 scopeid 0x20
ether 08:00:27:d9:c2:02 txqueuelen 1000 (Ethernet)
RX packets 3673 bytes 270967 (264.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3406 bytes 1142411 (1.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 0 (Local Loopback)
RX packets 68 bytes 5908 (5.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68 bytes 5908 (5.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]#
Fuentes:
http://www.unixmen.com/setup-local-yum-repository-centos-7/
No hay comentarios:
Publicar un comentario