I’m using CentOS-Stream-9 for my Linux VM.
/ is the directory I have my localrepo(which includes everything I have copied from my CentOS dvd.
Now, I want to create a local repository as thus
[root@MyFirstLinuxOS yum.repos.d]# vi local.repo
[centos-stream-9]
name=CentOS-Stream-9
baseurl=file:///localrepo/
enabled=1
gpgcheck=0
However, I get the errror
bash: createrepo: command not found ….
Failed to search for file: reposdata local was not complete: Cannot open /localrepo/repdata/repomd.xml: No such file or directory
What do I need to do to create the local repository, please?
You have a chicken and egg scenario here. It appears you are trying to setup a local repository from a CentOS stream image. It looks like you are creating a REPO file and pointing to a directory on your machine called localrepo.
It then looks like you are attempting to install the createrepo command so you can use it to create a repo. Unfortunately, when you create a <something.repo> file in /etc/yum.repos.d/<something.repo> and it is invalid, it prevents any installation from happening as you have corrupted repos (especially if that is the repo you are trying to use).
It would be best to install the createrepo command from the DVD ISO and then run the createrepo command on the directory before creating the REPO configuration file.
The error message you have above also indicates that for your BASEOS that you also possbily have some issues and I would guess spelling as it is looking for morrors and not mirrors for the DNS name, so there is no way to resolve that, again, preventing you from installing the createrepo command.
It might be possible to mount the CentOS DVD ISO and then recursively copy all the contents to your local system in the /localrepo directory and then it should already be setup like the DVD which *should* already have the repo metadata files created. As the file in your original post shows, you should have all RPMs and packages in the /localrepo directory and it should already have the REPO and REPO Metadata present.
I would suggest using the "tree" command on localrepo and seeing the directory structure and all the files. You can use grep to search for a specific name/file along with the tree command, but no matter what (even if createrepo.rpm exists) if the /localrepo directory isn't formatted as a REPO and containing the metadata YUM/DNF will not be able to read or install the applications as it isn't viewed as a valid repository.
Hope this helps.
https://access.redhat.com/solutions/1355683
https://www.tecmint.com/create-local-yum-repository-on-centos-8/
The above links have pretty decent tutorials on how this can be done for additional information.
@Taoheedene check for createrepo rpm in your localrepo dir and install it using rpm -ivh. Then you can create the repo using createrepo command.
using the ls -ltr | grep createrepo command
I got three different createrepo rpm, which I believe confirms the presence of the createrepo in the localrepo directory
However, running the command;
ls /localrepo/Packages/createrepo. gave me this error;
ls: cannot access’/localrepo/Packages/createrepo’: No such file or directory
Hence, I was unable to install the createrepo(using the rpm -ivh createrepo command)
Please, what do I do next?
I don’t mind getting on a video call and sharing my screen to get this resolved.
I’m currently learning Linux and don’t want to miss any details in the learning process.
Thank you.
Refer this doc : https://upspir.com/setting-up-a-local-yum-repository/
You have a chicken and egg scenario here. It appears you are trying to setup a local repository from a CentOS stream image. It looks like you are creating a REPO file and pointing to a directory on your machine called localrepo.
It then looks like you are attempting to install the createrepo command so you can use it to create a repo. Unfortunately, when you create a <something.repo> file in /etc/yum.repos.d/<something.repo> and it is invalid, it prevents any installation from happening as you have corrupted repos (especially if that is the repo you are trying to use).
It would be best to install the createrepo command from the DVD ISO and then run the createrepo command on the directory before creating the REPO configuration file.
The error message you have above also indicates that for your BASEOS that you also possbily have some issues and I would guess spelling as it is looking for morrors and not mirrors for the DNS name, so there is no way to resolve that, again, preventing you from installing the createrepo command.
It might be possible to mount the CentOS DVD ISO and then recursively copy all the contents to your local system in the /localrepo directory and then it should already be setup like the DVD which *should* already have the repo metadata files created. As the file in your original post shows, you should have all RPMs and packages in the /localrepo directory and it should already have the REPO and REPO Metadata present.
I would suggest using the "tree" command on localrepo and seeing the directory structure and all the files. You can use grep to search for a specific name/file along with the tree command, but no matter what (even if createrepo.rpm exists) if the /localrepo directory isn't formatted as a REPO and containing the metadata YUM/DNF will not be able to read or install the applications as it isn't viewed as a valid repository.
Hope this helps.
https://access.redhat.com/solutions/1355683
https://www.tecmint.com/create-local-yum-repository-on-centos-8/
The above links have pretty decent tutorials on how this can be done for additional information.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.