用centos7.6arm版本的镜像搭建局域网yum服务(ftp)

  • 步骤1、挂载镜像和安装vsftpd服务
  • 步骤2、将挂载镜像的目录里面的文件拷贝到新的目录下,并且卸载挂载目录
  • 步骤3、修改配置文件,测试

下面展示在bash界面上操作的过程:

[root@test98 Packages]# cd /var/ftp/pub/
[root@test98 pub]# pwd
/var/ftp/pub

[root@test98 pub]# ll
total 2
dr-xr-xr-x. 7 root root 2048 Nov 27  2018 centos7u6
drwxr-xr-x. 2 root root    6 Mar  4 10:20 test
drwxrwxrwx. 3 root root   23 Mar  5 10:25 yum
[root@test98 pub]# 
[root@test98 ~]# mount -o loop /root/CentOS-7-aarch64-Everything-1810.iso /var/ftp/pub/yum/

mount: /dev/loop1 is write-protected, mounting read-only
[root@test98 ~]# cd /var/ftp/pub/yum/
[root@test98 yum]# cd Packages/
[root@test98 Packages]# ls | grep ftp
ftp-0.17-67.el7.aarch64.rpm
lftp-4.4.8-11.el7.aarch64.rpm
lftp-scripts-4.4.8-11.el7.noarch.rpm
tftp-5.2-22.el7.aarch64.rpm
tftp-server-5.2-22.el7.aarch64.rpm
vsftpd-3.0.2-25.el7.aarch64.rpm
vsftpd-sysvinit-3.0.2-25.el7.aarch64.rpm
[root@test98 Packages]# rpm -ivh *ftp* --nodeps --force
warning: ftp-0.17-67.el7.aarch64.rpm: Header V4 RSA/SHA1 Signature, key ID 305d49d6: NOKEY
warning: lftp-scripts-4.4.8-11.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:vsftpd-3.0.2-25.el7              ################################# [ 14%]
   2:lftp-4.4.8-11.el7                ################################# [ 29%]
   3:lftp-scripts-4.4.8-11.el7        ################################# [ 43%]
   4:vsftpd-sysvinit-3.0.2-25.el7     ################################# [ 57%]
   5:tftp-server-5.2-22.el7           ################################# [ 71%]
   6:tftp-5.2-22.el7                  ################################# [ 86%]
   7:ftp-0.17-67.el7                  ################################# [100%]

[root@test98 pub]# grep -v ^# /etc/vsftpd/vsftpd.conf
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/xferlog
xferlog_std_format=YES
listen=NO
listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
[root@test98 pub]# systemctl start vsftpd
[root@test98 pub]# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-03-05 10:26:50 CST; 3h 56min ago
  Process: 67491 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 67493 (vsftpd)
    Tasks: 1
   CGroup: /system.slice/vsftpd.service
           └─67493 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

Mar 05 10:26:50 test98 systemd[1]: Starting Vsftpd ftp daemon...
Mar 05 10:26:50 test98 systemd[1]: Started Vsftpd ftp daemon.
[root@test98 pub]# 

[root@test98 pub]# cp -a yum/* centos7u6/
[root@test98 centos7u6]# cd /var/ftp/pub/centos7u6
[root@test98 centos7u6]# pwd
/var/ftp/pub/centos7u6
[root@test98 centos7u6]# ll
total 564
-rwxrwxrwx. 1 root root   2048 Nov 27  2018 boot.catalog
-rwxrwxrwx. 1 root root     14 Nov 27  2018 CentOS_BuildTag
drwxrwxrwx. 3 root root     35 Nov 27  2018 EFI
-rwxrwxrwx. 1 root root    227 Aug 30  2017 EULA
-rwxrwxrwx. 1 root root  18009 Dec 10  2015 GPL
drwxrwxrwx. 3 root root     57 Nov 27  2018 images
drwxrwxrwx. 2 root root     43 Nov 27  2018 LiveOS
drwxrwxrwx. 2 root root 434176 Nov 27  2018 Packages
drwxrwxrwx. 2 root root   4096 Mar  5 10:57 repodata
-rwxrwxrwx. 1 root root   1690 Dec 10  2015 RPM-GPG-KEY-CentOS-7
-rwxrwxrwx. 1 root root   1065 Sep  8  2017 RPM-GPG-KEY-CentOS-7-aarch64
-rwxrwxrwx. 1 root root   2887 Nov 27  2018 TRANS.TBL
[root@test98 centos7u6]# cat /etc/yum.repos.d/CentOS-arm7.6.repo 
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
[CentOS-ARM-7.6]
name= CentOS-ARM-7.6
baseurl=ftp://192.168.1.98/pub/centos7u6
enabled=1
gpgcheck=0
gpgkey=
[root@test98 centos7u6]# systemctl restart vsftpd
[root@test98 centos7u6]# 
[root@test98 centos7u6]# 
[root@test98 centos7u6]# yum clean all 
Loaded plugins: aliases, auto-update-debuginfo, changelog, copr, fastestmirror, filter-data, fs-snapshot, keys, langpacks, list-data, local, merge-conf, ovl, post-transaction-actions, pre-transaction-actions,
              : priorities, protectbase, ps, remove-with-leaves, rpm-warm-cache, show-leaves, tmprepo, tsflags, upgrade-helper, verify, versionlock
Cleaning repos: CentOS-ARM-7.6
Cleaning up list of fastest mirrors
[root@test98 centos7u6]# yum makecache
Loaded plugins: aliases, auto-update-debuginfo, changelog, copr, fastestmirror, filter-data, fs-snapshot, keys, langpacks, list-data, local, merge-conf, ovl, post-transaction-actions, pre-transaction-actions,
              : priorities, protectbase, ps, remove-with-leaves, rpm-warm-cache, show-leaves, tmprepo, tsflags, upgrade-helper, verify, versionlock
Determining fastest mirrors
CentOS-ARM-7.6                                                                                                                                                                             | 2.9 kB  00:00:00     
(1/3): CentOS-ARM-7.6/filelists_db                                                                                                                                                         | 6.1 MB  00:00:00     
(2/3): CentOS-ARM-7.6/primary_db                                                                                                                                                           | 4.8 MB  00:00:00     
(3/3): CentOS-ARM-7.6/other_db                                                                                                                                                             | 2.1 MB  00:00:00     
Metadata Cache Created
[root@test98 centos7u6]# 

若执行yum makecache报ftp的550错误,则可能是目录配置错误,需要修改配置文件:/etc/yum.repos.d/CentOS-arm7.6.repo

ftp://192.168.1.98/centos7u6/repodata/repomd.xml: [Errno 14] FTP Error 550 - Server denied you to change to the given directory

用centos7.6arm版本的镜像搭建局域网yum服务(ftp)_第1张图片

确保yum配置文件:/etc/yum.repos.d/CentOS-arm7.6.repo上配置的地址和路径在浏览器打开如下图所示一样即可。
用centos7.6arm版本的镜像搭建局域网yum服务(ftp)_第2张图片

你可能感兴趣的:(运维)