linux7.2搭建ftp,RHEL7.2/CentOS7.2配置内网yum源(vsftp方式)

1、准备操作:[root@localhost ~]# systemctl stop firewalld

[root@localhost ~]# systemctl disable firewalld

Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.

[root@localhost ~]# cat /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of three two values:

#     targeted - Targeted processes are protected,

#     minimum - Modification of targeted policy. Only selected processes are protected.

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

[root@localhost ~]# setenforce 0

2、挂载光盘:

上传光盘镜像(centos就上传centos的),并虚拟挂载:[root@localhost ~]# mkdir /haha

[root@localhost ~]# mount -o loop rhel-server-7.4-update-4-x86_64-dvd.iso /haha

[root@localhost ~]# cd /haha/Packages/

[root@localhost Packages]# ls

3、安装vsftp:[root@localhost Packages]# rpm -ivh vsftpd-3.0.2-10.el7.x86_64.rpm

4、拷贝文件到vsftp目录,并进行设置:[root@localhost Packages]# cd /haha

[root@localhost haha]# cp -r * /var/ftp/pub/#以下三行好像可以忽略

[root@localhost haha]# cd /var/ftp/pub/

[root@localhost pub]# rm -f *.html

[root@localhost pub]# rm -f repodata/TRANS.TBL

[root@localhost pub]# cd /haha/Packages/

[root@localhost Packages]# rpm -ivh deltarpm-3.6-3.el7.x86_64.rpm

准备中...                          ################################# [100%]

正在升级/安装...

1:deltarpm-3.6-3.el7               ################################# [100%]

[root@localhost Packages]# rpm -ivh python-deltarpm-3.6-3.el7.x86_64.rpm

准备中...                          ################################# [100%]

正在升级/安装...

1:python-deltarpm-3.6-3.el7        ################################# [100%]

[root@localhost Packages]# rpm -ivh createrepo-0.9.9-23.el7.noarch.rpm

准备中...                          ################################# [100%]

正在升级/安装...

1:createrepo-0.9.9-23.el7          ################################# [100%]

[root@localhost Packages]# createrepo -g /var/ftp/pub/repodata/repomd.xml /var/ftp/pub/

Spawning worker 0 with 4687 pkgs

Workers Finished

Saving Primary metadata

Saving file lists metadata

Saving other metadata

Generating sqlite DBs

Sqlite DBs complete

卸载虚拟光盘:[root@localhost Packages]# umount /haha

[root@localhost Packages]# cd /var/ftp/pub/

[root@localhost pub]# ls

启动vsftp服务:[root@localhost yum.repos.d]# systemctl start vsftpd

[root@localhost yum.repos.d]# systemctl enable vsftpd

Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.

配置yum源:[root@localhost Packages]# cd /etc/yum.repos.d/

[root@localhost yum.repos.d]# vi server.repo

[server]

name=server

baseurl=ftp://192.168.146.129/pub

enabled=1

gpgcheck=0

[root@localhost yum.repos.d]# yum clean all

[root@localhost yum.repos.d]# yum makecache

[root@localhost yum.repos.d]# yum repolist

已加载插件:product-id, search-disabled-repos, subscription-manager

server                                                                                                                                              | 3.6 kB  00:00:00

(1/2): server/group_gz                                                                                                                              | 1.2 kB  00:00:00

(2/2): server/primary_db                                                                                                                            | 3.6 MB  00:00:00

源标识                                                                         源名称                                                                                状态

rhel-7-server-rpms/7Server/x86_64                                              Red Hat Enterprise Linux 7 Server (RPMs)                                              23,922

server                                                                         server                                                                                 4,687

repolist: 28,609

[root@localhost yum.repos.d]# yum search lrzsz

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值