Linux Remote YUM Warehouse and NFS Service

Keywords: Linux yum ftp CentOS RPM

Overview of YUM

  • Software Update Mechanism Based on RPM Package Construction

  • Automatically resolving dependencies

  • All packages are provided by a centralized YUM software repository

The Way of Providing Software Warehouse

  • FTP service: ftp://...

  • HTTP service: http://...

  • Local directory: file://...

Sources of RPM Packages

  • Collection of RPM Packets Published by Centos

  • RPM Packet Collection Published by Third Party Organizations

  • User-defined RPM package set

Software package query

  • yum list [software name]

  • yum info [software name]

  • Yum search < keywords >

Software package upgrade

  • yum update updates software packages, software and system kernels

  • yum upgrade only updates packages

Case: Build a remote YUM repository, a server as a Yum server, and a client as a client to access.

1. Connect centos7 image to server and mount it

[root@server ~]#mount/dev/cdrom/mnt
[root@server ~]#df-hT

2. Install vsftpd service software on server side and create site

[root@server ~]#yum install vsftpd-y install ftp service
[root@server ~]# cd /var/ftp
[root@server ftp]#mkdir centos7 Create centos7 site
[root@server ftp]#cp-rf/mnt/* centos7/& Copy the mirror to the site
[1] 2891
[root@server ftp]# jobs
[1]+  In operation               cp -i -rf /mnt/* centos7/ &
[root@server ftp]#Create a custom site
[root@server ftp]# createrepo -g /mnt/repodata/repomd.xml other/
[root@server repodata]#System CTL start vsftpd Open vxftpd service
[root@server repodata]#System CTL stop firewalld.service Close the firewall
[root@server repodata]# setenforce 0


3. Install ftp service software on client and create yum configuration file

[root@client ~]# yum install ftp -y

[root@client ~]#cd/etc/yum.repos.d/ Back up all files in the configuration file directory of Yum
[root@client yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
[root@client yum.repos.d]# mkdir bak
[root@client yum.repos.d]# mv Cen* bak
[root@client yum.repos.d]# ls
bak
[root@client yum.repos.d]#vim centos7.repo. Reedit a yum configuration file
[base]
name=centos7.packages   centos7 Of yum Access path information
baseurl=ftp://192.168.109.133/centos7
enabled=1
gpgcheck=1
gpgkey=ftp://192.168.109.133/centos7/RPM-GPG-KEY-CentOS-7

[other]
name=other.packages    Other yum information
baseurl=ftp://192.168.109.133/other
enabled=1
gpgcheck=0

4. Clear the yum cache and install using remote yum

[root@client yum.repos.d]#yum clean all clears yum cache
[root@client yum.repos.d]# yum install httpd -y

NFS Shared Storage Service

Network File System

  • Dependent on RPC (remote procedure call)

  • nfs-utils, rpcbind package needs to be installed

  • System Services: nfs, rpcbind

  • Shared Profile: / etc/exports

List:

1. Add a hard disk as shared storage on the server side, create and format / dev/sdb1, and set up automatic mounting

[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# mount -a
[root@localhost ~]# df -hT


2. Install nfs-utils, rpcbind package on server

[root@localhost ~]# yum install nfs-utils rpcbind -y
[root@localhost ~]#System CTL enable nfs
[root@localhost ~]# systemctl enable rpcbind

3. Edit Server / etc/exports Shared Profile Information

[root@localhost ~]#vim/etc/exports Edit configuration file
[root@localhost ~]#System CTL start nfs Open Services
[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]#System CTL stop firewalld.service closes the firewall
[root@localhost ~]# setenforce 0
[root@localhost ~]#showmount-e to view sharing


4. Mount the server's / mnt on the client to the local website

[root@localhost ~]#System CTL stop firewalld.service closes the firewall
[root@localhost ~]# setenforce 0
[root@client ~]#Mount 192.168.109.133:/mnt/var/www/html/mount
[root@client ~]# df -hT

Or set it to automount

5. Install the httpd website service on the client, edit a web page information and view it

[root@client ~]# cd /var/www/html
[root@client html]#vim index.html Editing web page information
[root@client html]#System CTL start httpd.service opens httpd service


6. In the mnt directory of the server, we can find the files of a website we created.

If the server goes down, we must not be able to complete tab when we unmount it. We must input all by ourselves, otherwise you will regret it.


Thank you for reading!!!


Posted by ShiloVir on Mon, 09 Sep 2019 03:24:40 -0700