Purpose of this chapter: Client Centos7-1 can enjoy the YUM repository of remote server Centos7
This chapter environment: a server Centos7, a client
Centos7-1, VM Virtual Machine
1. Install vsftpd service
[root@localhost ~]# yum install vsftpd -y
Loaded plug-ins: fastest mirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: centos.ustc.edu.cn
* updates: mirrors.aliyun.com
Resolving dependencies
--> Inspecting business
The package vsftpd.x86_64.0.3.0.2-25.el7 will be installed
--> Resolving Dependency Completion
2. Mounting Mirror
[root@localhost ~]# Mount/dev/sr0/mnt///mount to the MNT directory
mount: /dev/sr0 Write protection will be mounted as read-only
[root@localhost ~]# df -hT
//File System Type Capacity Used Available% Mount Points
/dev/sda2 xfs 10G 3.9G 6.2G 39% /
devtmpfs devtmpfs 898M 0 898M 0% /dev
tmpfs tmpfs 912M 0 912M 0% /dev/shm
tmpfs tmpfs 912M 9.0M 903M 1% /run
tmpfs tmpfs 912M 0 912M 0% /sys/fs/cgroup
/dev/sda5 xfs 10G 37M 10G 1% /home
/dev/sda1 xfs 6.0G 174M 5.9G 3% /boot
tmpfs tmpfs 183M 20K 183M 1% /run/user/0
/dev/sr0 iso9660 4.3G 4.3G 0 100% /mnt
[root@localhost ~]# cd /var/
[root@localhost var]# ls // / See our ftb file under the var directory
account crash ftp kerberos lock nis run tmp
adm db games lib log opt spool yp
cache empty gopher local mail preserve target
3. Under the ftp site directory, create the directory centos7 and put our YUM source below.
[root@localhost var]# cd ftp/
[root@localhost ftp]# ls
pub
[root@localhost ftp]# mkdir centos7 // Create a directory
[root@localhost ftp]# ls
centos7 pub
[root@localhost ftp]# Cp-rf/mnt/* centos7/&// We put all the files in the mount point under the directory we just created.
[1] 2705
[root@localhost ftp]# jobs // View processes running in the background
[1]+ In operation cp -i -rf /mnt/* centos7/ &
4. Create a directory other and place our extension source under the directory
[root@localhost ftp]# mkdir other// Create an Extended Directory
[root@localhost ftp]# ls
centos7 other pub
[root@localhost ftp]# Createrepo-g/mnt/repodata/repomd.xml other///extended directory for unofficial packages, third-party organizations
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[1]+ complete cp -i -rf /mnt/* centos7/
5. View our processes, YUM sources and extension sources
[root@localhost ftp]# jobs // View the status of the process. The image we just had has been copied.
[root@localhost ftp]# cd centos7/
[root@localhost centos7]# ls
CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
EULA isolinux repodata TRANS.TBL
[root@localhost centos7]# cd ../other/
[root@localhost other]# ls
repodata
[root@localhost other]# cd repodata / / / our unofficial software package is in this configuration file
[root@localhost repodata]# ls
01a3b489a465bcac22a43492163df43451dc6ce47d27f66de289756b91635523-filelists.sqlite.bz2
401dc19bda88c82c403423fb835844d64345f7e95f5b9835888189c03834cc93-filelists.xml.gz
5dc1e6e73c84803f059bb3065e684e56adfc289a7e398946574d79dac6643945-primary.sqlite.bz2
5f62201963ee83e178738d9f88078560377cc06f972a4c0094ab3be00cae515f-repomd.xml
6bf9672d0862e8ef8b8ff05a2fd0208a922b1f5978e6589d87944c88259cb670-other.xml.gz
7c36572015e075add2b38b900837bcdbb8a504130ddff49b2351a7fc0affa3d4-other.sqlite.bz2
c48538ac0f65ece36eb71d41b76f1eb1f98c58cc26777348490feaed8f38ab56-repomd.xml.gz
dabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9-primary.xml.gz
repomd.xml
6. Open the service and close the firewall
[root@localhost repodata]# cd ~
[root@localhost ~]# System CTL start vsftpd // open vsftpd service
[root@localhost ~]# Netstat-ntap | grep 21 looks at port 21 and is responsible for connection
tcp6 0 0 :::21 :::* LISTEN 3244/vsftpd
[root@localhost ~]# netstat -ntap | grep 20
[root@localhost ~]# System CTL stop firewalld. service // / close firewall
[root@localhost ~]# setenforce 0//Turn off Enhancement
[root@localhost ~]#
7. Install ftp service in client Centos 7
[root@client ~]# Yum-install ftp-y installation FTP service
//Loaded plug-ins: fastest mirror, langpacks
Usage: yum [options] COMMAND
List of Commands:
8. Connect ftp server
[root@client ~]# ftp 192.168.17.128//The address where we connect to the ftp input server
Connected to 192.168.17.128 (192.168.17.128).
220 (vsFTPd 3.0.2)
Name (192.168.17.128:root): ftp //Anonymous login
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
ftp>
9. Put our original yum repository files in the directory we created
root@client ~]# Cd/etc/yum.repos.d/// / View the YUM repository configuration file for our client
[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]# vim centos-Base.repo
[root@client yum.repos.d]# mkdir bak // Create a directory
[root@client yum.repos.d]# mv *.repo bak / put all the configuration files under our directory just now
[root@client yum.repos.d]# ls
bak
[root@client yum.repos.d]# ls bak/
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.rep
10. Clear Yum Cache
[root@client yum.repos.d]# yum clean all // clear yum cache
//Loaded plug-ins: fastest mirror, langpacks
Loading mirror speeds from cached hostfile
11. Let's assign a path to client Centos7
[root@client yum.repos.d]# vim centos7.repo
[base]
name=centos7.Packages //software package
baseurl=ftp://192.168.17.128/centos7//Input server address and directory
enabled=1 //Opening service
gpgcheck=1 //Key validation, because we are using YUM repository remotely
gpgkey=ftp://192.168.17.128/centos7/RPM-GPG-KEY-CentOS-7
//RPM-GPG-KEY-CentOS-7//This key is server-side
[other]
name=other.Packages
baseurl=ftp://192.168.17.128/other
enabled=1
gpgcheck=0
~
~
wq
[root@localhost ftp]# cd centos7 / // Assist our server's key to our client's path profile
[root@localhost centos7]# ls
CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
EULA isolinux repodata TRANS.TBL
12. Verify that YUM sources are available
[root@client yum.repos.d]# yum list
yum-plugin-remove-with-leaves.noarch 1.1.31-50.el7 base
yum-plugin-rpm-warm-cache.noarch 1.1.31-50.el7 base
yum-plugin-show-leaves.noarch 1.1.31-50.el7 base
yum-plugin-tmprepo.noarch 1.1.31-50.el7 base
yum-plugin-tsflags.noarch 1.1.31-50.el7 base
yum-plugin-upgrade-helper.noarch 1.1.31-50.el7 base
yum-plugin-verify.noarch 1.1.31-50.el7 base
yum-plugin-versionlock.noarch 1.1.31-50.el7 base
yum-rhn-plugin.noarch 2.0.1-10.el7 base
yum-updateonboot.noarch
That's all we have.
Thank you for watching.