http://eloraculodelpinguino.blogspot.com/2014/07/linux-rhel-crear-un-repositorio-yum-con.html
En esta oportunidad explicaré cómo agregar un repositorio para Centos.
Los datos técnicos del server:
[root@centos-testing02 ~]# uname -a
Linux centos-testing02 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@centos-testing02 ~]# cat /etc/redhat-release
CentOS release 6.4 (Final)
[root@centos-testing02 ~]#
Los pasos son los siguientes:
1. Montar el CD/DVD en un directorio del S.O.
Los siguientes DVD se encuentran instalados como unidades externas a través de una virtual machine oracle.
CentOS-6.4-x86_64-bin-DVD1.iso en sr0
CentOS-6.4-x86_64-bin-DVD2.iso en sr1
[root@centos-testing02 ~]# ls -l /dev/cdrom*
lrwxrwxrwx. 1 root root 3 May 13 15:49 /dev/cdrom2 -> sr1
lrwxrwxrwx. 1 root root 3 May 13 15:49 /dev/cdrom3 -> sr0
[root@centos-testing02 ~]#
Teniendo claro la ubicación de las imágenes iso, crear los directorios de montaje y montar las iso en estos directorios.
[root@centos-testing02 ~]# mount -o loop /dev/cdrom3 /mnt/cdrom
[root@centos-testing02 ~]# mount -o loop /dev/cdrom2 /mnt/cdrom2
De esta forma se visualiza el contenido de las unidades de DVD
[root@centos-testing02 ~]# ls -al /mnt/cdrom/
total 685
dr-xr-xr-x. 7 root root 4096 Mar 5 2013 .
drwxr-xr-x. 4 root root 4096 May 13 12:17 ..
-r--r--r--. 2 root root 14 Mar 5 2013 CentOS_BuildTag
-r--r--r--. 1 root root 31 Mar 5 2013 .discinfo
dr-xr-xr-x. 3 root root 2048 Mar 4 2013 EFI
-r--r--r--. 2 root root 212 Mar 2 2013 EULA
-r--r--r--. 2 root root 18009 Mar 2 2013 GPL
dr-xr-xr-x. 3 root root 2048 Mar 4 2013 images
dr-xr-xr-x. 2 root root 2048 Mar 4 2013 isolinux
dr-xr-xr-x. 2 root root 649216 Mar 5 2013 Packages
-r--r--r--. 2 root root 1354 Mar 2 2013 RELEASE-NOTES-en-US.html
dr-xr-xr-x. 2 root root 4096 Mar 5 2013 repodata
-r--r--r--. 2 root root 1706 Mar 2 2013 RPM-GPG-KEY-CentOS-6
-r--r--r--. 2 root root 1730 Mar 2 2013 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r--. 2 root root 1730 Mar 2 2013 RPM-GPG-KEY-CentOS-Security-6
-r--r--r--. 2 root root 1734 Mar 2 2013 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r--. 1 root root 3380 Mar 5 2013 TRANS.TBL
-r--r--r--. 1 root root 338 Mar 5 2013 .treeinfo
[root@centos-testing02 ~]# ls -al /mnt/cdrom2/
total 415
dr-xr-xr-x. 3 root root 2048 Mar 5 2013 .
drwxr-xr-x. 4 root root 4096 May 13 12:17 ..
-r--r--r--. 1 root root 14 Mar 5 2013 CentOS_BuildTag
-r--r--r--. 1 root root 31 Mar 5 2013 .discinfo
-r--r--r--. 1 root root 212 Mar 2 2013 EULA
dr-xr-xr-x. 2 root root 405504 Mar 5 2013 Packages
-r--r--r--. 1 root root 1706 Mar 2 2013 RPM-GPG-KEY-CentOS-6
-r--r--r--. 1 root root 1730 Mar 2 2013 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r--. 1 root root 1730 Mar 2 2013 RPM-GPG-KEY-CentOS-Security-6
-r--r--r--. 1 root root 1734 Mar 2 2013 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r--. 1 root root 2056 Mar 5 2013 TRANS.TBL
-r--r--r--. 1 root root 399 Mar 4 2013 .treeinfo
[root@centos-testing02 ~]#
También es posible verificar las unidades de DVD revisando el archivo de información de disco:
[root@centos-testing02 ~]# ls -al /mnt/cdrom/.discinfo
-r--r--r--. 1 root root 31 Mar 5 2013 /mnt/cdrom/.discinfo
[root@centos-testing02 ~]# cat /mnt/cdrom/.discinfo
1362445555.957609
6.4
x86_64
1
[root@centos-testing02 ~]# cat /mnt/cdrom2/.discinfo
1362445555.957609
6.4
x86_64
2
[root@centos-testing02 ~]#
2. Modificar archivo CentOS-Media.repo
A través de este archivo se define la información necesaria para utilizar los recursos de DVD o CDROM como un repositorio válido para el Sistema.La ubicación del archivo es: /etc/yum.repos.d/CentOS-Media.repo
Editar el archivo CentOS-Media.repo en los siguientes parámetros:
baseurl=file:///mnt/cdrom/ # en esta sección se añaden las rutas donde se encuentran los repositorios añadidos
[root@centos-testing02 ~]# cat /etc/yum.repos.d/CentOS-Media.repo
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-6. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/cdrom/
file:///mnt/cdrom2/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[root@centos-testing02 ~]#
3. Realizar una prueba
Se va a instalar el package ssh client para conectarse via ssh a un servidor remoto.En esta prueba se forzará a utilizar sólo el repositorio de media, para ello se utiliza los parámetros "--disablerepo=\* --enablerepo=c6-media"
[root@centos-testing02 ~]# yum --disablerepo=\* --enablerepo=c6-media search ssh
Loaded plugins: fastestmirror
Determining fastest mirrors
* c6-media:
c6-media | 4.0 kB 00:00 ...
c6-media/primary_db | 4.4 MB 00:00 ...
================================================================= N/S Matched: ssh ==================================================================
ksshaskpass.x86_64 : A KDE version of ssh-askpass with KWallet support
libssh2.i686 : A library implementing the SSH2 protocol
libssh2.x86_64 : A library implementing the SSH2 protocol
libssh2-devel.i686 : Development files for libssh2
libssh2-devel.x86_64 : Development files for libssh2
libssh2-docs.x86_64 : Documentation for libssh2
openssh.x86_64 : An open source implementation of SSH protocol versions 1 and 2
openssh-askpass.x86_64 : A passphrase dialog for OpenSSH and X
openssh-clients.x86_64 : An open source SSH client applications
openssh-ldap.x86_64 : A LDAP support for open source SSH server daemon
openssh-server.x86_64 : An open source SSH server daemon
pam_ssh_agent_auth.i686 : PAM module for authentication with ssh-agent
pam_ssh_agent_auth.x86_64 : PAM module for authentication with ssh-agent
trilead-ssh2.noarch : SSH-2 protocol implementation in pure Java
trilead-ssh2-javadoc.noarch : Javadoc for trilead-ssh2
jsch.noarch : Pure Java implementation of SSH2
python-paramiko.noarch : A SSH2 protocol library for python
python-twisted-conch.x86_64 : SSH and SFTP protocol implementation together with clients and servers
Name and summary matches only, use "search all" for everything.
[root@centos-testing02 ~]#
Una vez identificado el nombre correcto del utilitario, se instala,
[root@centos-testing02 ~]# yum --disablerepo=\* --enablerepo=c6-media install openssh-clients.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* c6-media:
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package openssh-clients.x86_64 0:5.3p1-84.1.el6 will be installed
--> Processing Dependency: libedit.so.0()(64bit) for package: openssh-clients-5.3p1-84.1.el6.x86_64
--> Running transaction check
---> Package libedit.x86_64 0:2.11-4.20080712cvs.1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================
Installing:
openssh-clients x86_64 5.3p1-84.1.el6 c6-media 355 k
Installing for dependencies:
libedit x86_64 2.11-4.20080712cvs.1.el6 c6-media 74 k
Transaction Summary
=====================================================================================================================================================
Install 2 Package(s)
Total download size: 429 k
Installed size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
-----------------------------------------------------------------------------------------------------------------------------------------------------
Total 3.1 MB/s | 429 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libedit-2.11-4.20080712cvs.1.el6.x86_64 1/2
Installing : openssh-clients-5.3p1-84.1.el6.x86_64 2/2
Verifying : libedit-2.11-4.20080712cvs.1.el6.x86_64 1/2
Verifying : openssh-clients-5.3p1-84.1.el6.x86_64 2/2
Installed:
openssh-clients.x86_64 0:5.3p1-84.1.el6
Dependency Installed:
libedit.x86_64 0:2.11-4.20080712cvs.1.el6
Complete!
[root@centos-testing02 ~]#
Probar el utilitario recién instalado:
[root@centos-testing02 ~]# ssh -l root 192.168.56.102
The authenticity of host '192.168.56.102 (192.168.56.102)' can't be established.
RSA key fingerprint is 54:24:31:f2:db:6b:da:37:8a:3e:f9:ad:f5:a7:fc:89.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.56.102' (RSA) to the list of known hosts.
root@192.168.56.102's password:
Last login: Thu May 14 14:16:40 2015
[root@lala ~]#
4. Anexar el montaje de las imágenes ISO DVD en el archivo de arranque fstab
Para que cada que se reinicie el servidor no sea necesario montar en forma manual los directorios donde se ubican las imágenes DVD, se puede anexar este paso en el archivo fstab, encargado de levantar los filesystems durante el booteo.Editar el archivo /etc/fstab anexando las siguientes líneas:
[root@centos-testing02 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed May 13 10:52:18 2015
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VG-LogVolRoot / ext4 defaults 1 1
UUID=69179590-9f00-41f4-a540-91c6bbe17009 /boot ext2 defaults 1 2
/dev/mapper/VG-LogVolHome /home ext4 defaults 1 2
/dev/mapper/VG-LogVolVar /var ext4 defaults 1 2
/dev/mapper/VG-LogVolSwap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sr0 /mnt/cdrom iso9660 ro,user,auto 0 0
/dev/sr1 /media/cdrom iso9660 ro,user,auto 0 0
[root@centos-testing02 ~]#
Antes del reinicio es aconsejable realizar testing al comportamiento del archivo fstab.
Un método de testing consiste en:
1. desmontar los directorios añadidos recientemente
2. montar los directorio utilizando el archivo fstab como parámetro.
Para desmontar los directorios:
[root@centos-testing02 ~]# umount /dev/sr0
[root@centos-testing02 ~]# umount /dev/sr1
[root@centos-testing02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VG-LogVolRoot
5.8G 753M 4.8G 14% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/md0 485M 25M 436M 6% /boot
/dev/mapper/VG-LogVolHome
2.0G 67M 1.9G 4% /home
/dev/mapper/VG-LogVolVar
2.0G 147M 1.8G 8% /var
[root@centos-testing02 ~]#
Con el utlitario "mount" ejecutar
[root@centos-testing02 ~]# mount -av
mount: UUID=69179590-9f00-41f4-a540-91c6bbe17009 already mounted on /boot
mount: /dev/mapper/VG-LogVolHome already mounted on /home
mount: /dev/mapper/VG-LogVolVar already mounted on /var
mount: tmpfs already mounted on /dev/shm
mount: devpts already mounted on /dev/pts
mount: sysfs already mounted on /sys
mount: proc already mounted on /proc
mount: /dev/sr1 already mounted on /mnt/cdrom2
mount: you didn't specify a filesystem type for /dev/sr0
I will try type iso9660
mount: block device /dev/sr0 is write-protected, mounting read-only
mount: you didn't specify a filesystem type for /dev/sr0
I will try type iso9660
/dev/sr0 on /mnt/cdrom type iso9660 (ro,nosuid,nodev)
[root@centos-testing02 ~]#
[root@centos-testing02 ~]#
De esta forma será posible ver los directorios como filesystems.[root@centos-testing02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VG-LogVolRoot
5.8G 753M 4.8G 14% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/md0 485M 25M 436M 6% /boot
/dev/mapper/VG-LogVolHome
2.0G 67M 1.9G 4% /home
/dev/mapper/VG-LogVolVar
2.0G 146M 1.8G 8% /var
/dev/sr1 5.8G 753M 4.8G 14% /mnt/cdrom2
/dev/sr0 4.1G 4.1G 0 100% /mnt/cdrom
[root@centos-testing02 ~]#
mount: UUID=69179590-9f00-41f4-a540-91c6bbe17009 already mounted on /boot
mount: /dev/mapper/VG-LogVolHome already mounted on /home
mount: /dev/mapper/VG-LogVolVar already mounted on /var
mount: tmpfs already mounted on /dev/shm
mount: devpts already mounted on /dev/pts
mount: sysfs already mounted on /sys
mount: proc already mounted on /proc
mount: /dev/sr1 already mounted on /mnt/cdrom2
mount: you didn't specify a filesystem type for /dev/sr0
I will try type iso9660
mount: block device /dev/sr0 is write-protected, mounting read-only
mount: you didn't specify a filesystem type for /dev/sr0
I will try type iso9660
/dev/sr0 on /mnt/cdrom type iso9660 (ro,nosuid,nodev)
[root@centos-testing02 ~]#
[root@centos-testing02 ~]#
De esta forma será posible ver los directorios como filesystems.[root@centos-testing02 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VG-LogVolRoot
5.8G 753M 4.8G 14% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/md0 485M 25M 436M 6% /boot
/dev/mapper/VG-LogVolHome
2.0G 67M 1.9G 4% /home
/dev/mapper/VG-LogVolVar
2.0G 146M 1.8G 8% /var
/dev/sr1 5.8G 753M 4.8G 14% /mnt/cdrom2
/dev/sr0 4.1G 4.1G 0 100% /mnt/cdrom
[root@centos-testing02 ~]#
Proceder al reinicio del server y testing!
Fuente:
http://www.unixmen.com/add-dvd-to-yum-repository-in-centos-6/https://serverfault.com/questions/174181/how-do-you-validate-fstab-without-rebooting
http://pclosmag.com/html/issues/200709/page07.html
http://linoxide.com/file-system/understanding-each-entry-of-linux-fstab-etcfstab-file/
No hay comentarios:
Publicar un comentario