{"id":1591,"date":"2012-01-07T22:09:15","date_gmt":"2012-01-07T14:09:15","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=1591"},"modified":"2023-06-22T22:46:37","modified_gmt":"2023-06-22T22:46:37","slug":"how-to-setup-local-yum-repository-from-cd-romdvd-rom-image-on-centos-6-2","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-setup-local-yum-repository-from-cd-romdvd-rom-image-on-centos-6-2\/","title":{"rendered":"How to Setup Local Yum Repository from CD-ROM\/DVD-ROM image on CentOS 6.2"},"content":{"rendered":"<p>In this guide, we will delve into the process of updating and installing RPM packages from a CD-ROM\/DVD-ROM image on CentOS 6.2. This method proves to be particularly beneficial when dealing with a slow internet connection. By utilizing your local CD\/DVD-ROM as a yum repository, you can bypass the need for an internet connection entirely.<\/p>\n<p>We will explore two distinct methods to install and configure a local CentOS 6.2 yum repository. Both methods have been tested and confirmed to work on a CentOS 6.2 Linux server.<\/p>\n<p>You can choose the method that best suits your preferences.<\/p>\n<h2>Method 1: Using DVD\/ISO<\/h2>\n<p>Insert the DVD\/ISO into the DVD-Drive.<br \/>\nMount the ISO from the DVD-ROM into the \/mnt directory using the following command:<\/p>\n<pre>\r\nmount \/dev\/cdrom \/mnt\r\n<\/pre>\n<p>You should see a message indicating that the block device is write-protected and is mounting as read-only.<\/p>\n<p>Create a text file named centos62.repo in the \/etc\/yum.repos.d\/ directory with the following content:<\/p>\n<pre>\r\nvi \/etc\/yum.repos.d\/centos62.repo\r\n\r\n[CentOS6.2-Repository]\r\nname=DVD-CentOS6.2 repository\r\nbaseurl=file:\/\/\/mnt\r\nenabled=1\r\ngpgcheck=0\r\n<\/pre>\n<p>You can now start installing, removing, and updating using the yum command. For example, to install httpd, you would use:<\/p>\n<pre>\r\nyum install httpd -y\r\n<\/pre>\n<h2>Method 2: Using Existing Partition<\/h2>\n<p>Check the existing partition on your CentOS 6.2 server using the df command:<\/p>\n<pre>\r\ndf\r\n<\/pre>\n<p>Create a directory named localrepo in the \/mnt directory:<\/p>\n<pre>\r\nmkdir \/mnt\/localrepo\r\n<\/pre>\n<p>Create directories named 1, 2, and 3 in the \/mnt\/localrepo directory:<\/p>\n<pre>\r\nmkdir -p \/mnt\/localrepo\/{1,2,3}\r\n<\/pre>\n<p>Mount the ISO from the DVD-ROM into the \/mnt\/localrepo\/1 directory:<\/p>\n<pre>\r\nmount -o loop \/dev\/cdrom \/mnt\/localrepo\/1\r\ndf -lh\r\n<\/pre>\n<p>Create a Temporary repo folder under \/tmp to store the required rpm\u2019s packages for the createrepo installation:<\/p>\n<pre>\r\nmkdir \/tmp\/repo\r\n<\/pre>\n<p>Copy the required packagesto install create repo:<\/p>\n<pre>\r\ncp \/mnt\/localrepo\/1\/Packages\/createrepo* \/tmp\/repo\r\ncp \/mnt\/localrepo\/1\/Packages\/deltarpm* \/tmp\/repo\r\ncp \/mnt\/localrepo\/1\/Packages\/libxml2-python* \/tmp\/repo\r\ncp \/mnt\/localrepo\/1\/Packages\/python-deltarpm* \/tmp\/repo\r\n<\/pre>\n<p>You can verify the copied packages with the ls command:<\/p>\n<pre>\r\nls \/tmp\/repo\r\n<\/pre>\n<p>Install the rpm packages using the following command:<\/p>\n<pre>\r\nrpm -ivh \/tmp\/repo\/*\r\n<\/pre>\n<p>Navigate to the \/mnt\/localrepo directory:<\/p>\n<pre>\r\ncd \/mnt\/localrepo\/\r\n<\/pre>\n<p>Run the createrepo command:<\/p>\n<pre>\r\ncreaterepo .\r\n<\/pre>\n<p>Clean up the repo:<\/p>\n<pre>\r\nyum clean all\r\n<\/pre>\n<p>Create a repo config file in the \/etc\/yum.repos.d\/ directory:<\/p>\n<pre>\r\nvi \/etc\/yum.repos.d\/local.repo\r\n\r\n[CentOS6.2-Repository]\r\nname=CentOS6.2 repository\r\nbaseurl=file:\/\/\/mnt\/localrepo\r\nenabled=1\r\ngpgcheck=0\r\n<\/pre>\n<h2>Commands Mentioned<\/h2>\n<ul>\n<li><span class=\"fw-bold\">mount<\/span> \u2013 This command is used to mount a filesystem or storage device.<\/li>\n<li><span class=\"fw-bold\">vi<\/span> \u2013 A text editor command used to create or edit files.<\/li>\n<li><span class=\"fw-bold\">yum<\/span> \u2013 The package management tool for installing, updating, and removing packages in CentOS.<\/li>\n<li><span class=\"fw-bold\">mkdir<\/span> \u2013 This command is used to create directories.<\/li>\n<li><span class=\"fw-bold\">cp<\/span> \u2013 The copy command used to copy files from one location to another.<\/li>\n<li><span class=\"fw-bold\">rpm<\/span> \u2013 The RPM Package Manager tool for installing, uninstalling, and managing software packages in CentOS.<\/li>\n<li><span class=\"fw-bold\">createrepo<\/span> \u2013 This command is used to create a repository of RPM packages.<\/li>\n<li><span class=\"fw-bold\">df<\/span> \u2013 The disk filesystem command used to display disk space usage.<\/li>\n<li><span class=\"fw-bold\">ls<\/span> \u2013 The list command used to list files and directories.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>In this tutorial, we have explored two methods to set up a local yum repository from a CD-ROM\/DVD-ROM image on CentOS 6.2. This process is particularly beneficial when dealing with a slow internet connection, as it allows you to bypass the need for an internet connection entirely. Both methods have been tested and confirmed to work on a CentOS 6.2 Linux server, and may also be applicable to other versions of CentOS server.<\/p>\n<p>Remember, understanding the different types of web servers and hosting services is crucial to making the best decisions for your specific needs.<\/p>\n<p>Whether you&#8217;re using <a href=\"https:\/\/webhostinggeeks.com\/blog\/apache-http-server-explained\/\">Apache<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/nginx-server-explained\/\">Nginx<\/a>, or <a href=\"https:\/\/webhostinggeeks.com\/blog\/litespeed-web-server-explained\/\">LiteSpeed<\/a> on a <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-dedicated-server-hosting\/\">dedicated server<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-vps-hosting\/\">VPS server<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-cloud-hosting\/\">cloud hosting<\/a>, or <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-shared-hosting\/\">shared hosting<\/a>, these methods can help you manage your software packages more efficiently.<\/p>\n<p>We hope this guide has been informative and helpful in setting up your local yum repository.<\/p>\n<h2>FAQ<\/h2>\n<ol itemscope itemtype=\"https:\/\/schema.org\/FAQPage\">\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the purpose of the yum command?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">The yum command is a package management tool used in CentOS and other RPM-based Linux distributions. It is used to install, update, and remove software packages.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What does the mount command do?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">The mount command is used to mount a filesystem or storage device to a specific directory, making it accessible to the system.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the purpose of the createrepo command?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">The createrepo command is used to create a repository of RPM packages. This repository can then be used by package managers like yum for installing software.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What does the df command do?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">The df command, short for disk filesystem, is used to display the amount of disk space used and available on the filesystems in your system.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the function of the cp command?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">The cp command, short for copy, is used to copy files and directories from one location to another on a Linux system.<\/span>\n            <\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we will delve into the process of updating and installing RPM packages from a CD-ROM\/DVD-ROM image on CentOS 6.2. This method proves to be particularly beneficial when&#8230;<\/p>\n","protected":false},"author":6,"featured_media":1554,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055,2062],"tags":[1253,1536,1944],"class_list":["post-1591","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-yum","tag-centos-6-2","tag-linux","tag-yum-repositories"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1591","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=1591"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1591\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/1554"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=1591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=1591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=1591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}