Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build remote yum Warehouse in Centos7

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Yum warehouse theory introduces that the predecessor of YUM is YUP, which was originally developed by TSS Company using Python language, and later modified by the Linux development team of Duke University, named YUM. With the help of YUM software warehouse, we can complete the tasks of installing, uninstalling and automatically upgrading rpm software packages, and can automatically find and solve the dependencies between rpm packages, without the need for administrators to install each rpm package one by one, manually, which makes it easier for administrators to maintain Linux. Especially in the local network with a large number of Linux hosts, building a resource server can greatly alleviate the dependence of software installation, upgrade and other experimental environment on Internet:

Two virtual machines with Linux Centos7 system are installed, one as the client and the other as the server.

Practical part:

Because in this experiment we will use two servers, one as the server and the other as the client. In order to facilitate the distinction, we first modify the host name of the server.

Hostnamectl set-hostname sever (change the server hostname to server)

Hostnamectl set-hostname client (rename client host to client)

After that, I mount the CD image to the server and view the mount result.

Mount / dev/sr0 / mnt/ (mount the CD and image it to the server's / mnt directory)

Df / hT (view the mount result)

When you enter the var directory, there is no ftp service that we will use, so you also need to install the vsftpd service using yum.

At this point we look at the var directory, and then we have the ftp service we need.

Then we create a centos7 directory under the server's ftp directory, copy everything under the mnt directory to centos7, create a "other" directory, and use the createrepo tool to create a warehouse data file in the "other" directory.

Then go to the centos7 and other directories to see if the files have been added successfully.

Cd / var/ (enter the var directory)

Yum install vsftpd-- y (install ftp service)

Ls (View Catalog)

Mkdir centos7 (create directory centos7)

Cp-rf / mnt/* centos7/ & (copy all the contents of the mnt directory to centos7, which takes a long time to execute. It is recommended to run in the background)

Mkdir other (create directory other)

Createrepo-g / mnt/repodata/repomd.xml other/ (create a warehouse data file in the other directory)

Cd centos7/

Ls

Cd.. / other/

Ls

Cd / repodata/

Ls

Start the vsftpd service, verify that the vsftpd service is running, and then turn off the firewall and enhanced security features. The server configuration is complete at this time.

Install the ftp service in the client.

Let's use the ftp command to verify that the client and server can be connected through the ftp service. You can enter your user name directly into ftp for anonymous access, and enter directly without a password.

Go to the "/ etc/yum.repos.d/" directory, create a "bak" directory, and move all the original system yum configuration files of the client to the "bak" directory.

Then clear all yum caches and use the vim editor to create a new file "centos7.repo" and edit it.

At this point, we take the httpd service as an example to try to install the service on the client using a remote yum repository.

Systemctl start vsftpd (start fvstpd service)

Netstat-ntap | grep 21 (verify whether the vsftpd service is already running)

Systemctl stop firewalld.service (turn off the firewall)

Setenforce 0 (turn off enhanced security features)

Yum install ftp-y (install ftp service)

Ftp 192.168.131.133 (connect server)

Ftp (remote user name, anonymous access with ftp)

Ls (View Catalog)

Bye (exit)

Cd / etc/yum.repos.d/ (enter the "/ etc/yum.repos.d/" directory)

Mkdir bak (create directory bak)

Mv CentOS* bak/ (all original system yum configuration files of the client are moved to the "bak" directory)

Yum clean all (clear yum cache)

Vim centos7.repo (create a new file "centos7.repo" using the vim editor)

Configuration content:

[base]

Name=centos7.Packages

Baseurl= ftp://192.168.52.131/centos7

Enabled=1

Gpgcheck=1

Gpgkey= ftp://192.168.52.131/centos7/RPM-GPG-KEY-CentOS-7

[other]

Name=other.Packages

Baseurl= ftp://192.168.52.131/other

Enabled=1

Gpgcheck=0

Yum install httpd-y (install httpd service)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report