ftp的yum的搭建步骤
第一步:安装vsftpd程序包(系统已经安装)
[root@station40 ~]# rpm -qa |grep vsftpd
vsftpd-2.2.2-21.el6.x86_64
第二步:安装完成后需要启动他例:
先找打vsftpd中的文件中有 vsftpd.service结尾的文件然后启动这个文件服务例;
systemctl start vsftpd.service (CentOS7使用这个)
service vsftpd start (CentOS6使用这个)
注:因为我的文件中未找到该文件所以我使用的是下面这个启动命令:
[root@station40 ~]# service vsftpd start
[root@station40 ~]#
第三步:因为刚才的启动为实时启动,关机后就不再启动所以还需要将其改成开机启动,但是我尚明的那条命令就是开机启动,正常的开机启动使用下面的这条命令:
[root@station40 ~]# systemctl enable vsftpd.service (CentOS7使用这个)
chkconfig vsftpd on (CentOS6使用这个)
第四步:找到该程序的目录文件例:
[root@station40 ~]# rpm -ql vsftpd |tail
/usr/share/doc/vsftpd-2.2.2/SECURITY/TRUST
/usr/share/doc/vsftpd-2.2.2/SIZE
/usr/share/doc/vsftpd-2.2.2/SPEED
/usr/share/doc/vsftpd-2.2.2/TODO
/usr/share/doc/vsftpd-2.2.2/TUNING
/usr/share/doc/vsftpd-2.2.2/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp
/var/ftp/pub
注:红色标注就是ftp默认的共享目录。该目录就是日后第三方的软件放置目录,很明显该目录是个空目录没有任何文件的
例:
第五步:现在可以尝试将光盘的程序包复制到该目录下现在可以将tree这个文件复制到 /var/ftp/pub里面
例:
注:可以看出目前的目录下有了tree这个文件
第六步:现在需要确认防火墙有没有关掉,没有则需要将其关掉
[root@station40 ~]# chkconfig
NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
dnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:off
haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
kdump 0:off 1:off 2:off 3:on 4:on 5:on 6:off
mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off
messagebus 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfs-rdma 0:off 1:off 2:off 3:off 4:off 5:off 6:off
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
pppoe-server 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rdma 0:off 1:off 2:off 3:off 4:off 5:off 6:off
restorecond 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
udev-post 0:off 1:on 2:on 3:on 4:on 5:on 6:off
vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
winbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
wpa_supplicant 0:off 1:off 2:off 3:off 4:off 5:off 6:off
可以看出防火墙是打开状态,所以现在需要将他关掉
例:
[root@station40 ~]# iptables -F (CentOS7使用这个)
[root@station40 ~]# chkconfig iptable off (CentOS6使用这个)
NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
dnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:off
haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
kdump 0:off 1:off 2:off 3:on 4:on 5:on 6:off
mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off
messagebus 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfs-rdma 0:off 1:off 2:off 3:off 4:off 5:off 6:off
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
pppoe-server 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rdma 0:off 1:off 2:off 3:off 4:off 5:off 6:off
restorecond 0:off 1:off 2:off 3:off 4:off 5:off 6:off
rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
udev-post 0:off 1:on 2:on 3:on 4:on 5:on 6:off
vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
winbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
wpa_supplicant 0:off 1:off 2:off 3:off 4:off 5:off 6:off
可以看出防火墙关掉了
第七步:现在再次确认ftp的服务端口是否打开
例:[root@station40 ftp]# netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:25 :::* LISTEN
tcp 0 0 ::1:6010 :::* LISTEN
tcp 0 0 ::1:6011 :::* LISTEN
可以看出ftp的21号端口没有打开。所以需要打开
例:[root@station40 ftp]# service vsftpd start (实时启动vsftpd 服务)
Starting vsftpd for vsftpd: [ OK ] (显示vsftpd服务启动ok)
[root@station40 ftp]# netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:25 :::* LISTEN
tcp 0 0 ::1:6010 :::* LISTEN
tcp 0 0 ::1:6011 :::* LISTEN
先在我们在pub目录下在创建一个app目录用来放置第三方的程序例:
[root@station40 pub]# mkdir app
[root@station40 pub]# ls
app tree-1.6.0-10.el7.x86_64.rpm
[root@station40 pub]# mv tree-1.6.0-10.el7.x86_64.rpm app
[root@station40 pub]# ls
app
第八步:需要生成repodata元数据,就要用到一个命令工具createrepo,如果系统上没有则需要使用yum去安装。
例:
[root@station40 ~]# yum install createrepo
Loaded plugins: fastestmirror, refresh-packagekit
Setting up Install Process
Determining fastest mirrors
base | 4.0 kB 00:00
base/primary_db | 4.7 MB 00:00
epel | 4.3 kB 00:00
epel/primary_db | 5.9 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package createrepo.noarch 0:0.9.9-24.el6 will be installed
--> Processing Dependency: python-deltarpm for package: createrepo-0.9.9-24.el6.noarch
--> Processing Dependency: libxml2-python for package: createrepo-0.9.9-24.el6.noarch
--> Running transaction check
---> Package libxml2-python.x86_64 0:2.7.6-21.el6 will be installed
---> Package python-deltarpm.x86_64 0:3.5-0.5.20090913git.el6 will be installed
--> Processing Dependency: deltarpm = 3.5-0.5.20090913git.el6 for package: python-deltarpm-3.5-0.5.20090913git.el6.x86_64
--> Running transaction check
---> Package deltarpm.x86_64 0:3.5-0.5.20090913git.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
createrepo noarch 0.9.9-24.el6 base 96 k
Installing for dependencies:
deltarpm x86_64 3.5-0.5.20090913git.el6 base 71 k
libxml2-python x86_64 2.7.6-21.el6 base 323 k
python-deltarpm x86_64 3.5-0.5.20090913git.el6 base 27 k
Transaction Summary
===============================================================================================================================================================================================
Install 4 Package(s)
Total download size: 517 k
Installed size: 2.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm | 27 kB 00:00
(2/4): deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm | 71 kB 00:00
(3/4): libxml2-python-2.7.6-21.el6.x86_64.rpm | 323 kB 00:00
(4/4): createrepo-0.9.9-24.el6.noarch.rpm | 96 kB 00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 7.6 MB/s | 517 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libxml2-python-2.7.6-21.el6.x86_64 1/4
Installing : deltarpm-3.5-0.5.20090913git.el6.x86_64 2/4
Installing : python-deltarpm-3.5-0.5.20090913git.el6.x86_64 3/4
Installing : createrepo-0.9.9-24.el6.noarch 4/4
Verifying : python-deltarpm-3.5-0.5.20090913git.el6.x86_64 1/4
Verifying : deltarpm-3.5-0.5.20090913git.el6.x86_64 2/4
Verifying : libxml2-python-2.7.6-21.el6.x86_64 3/4
Verifying : createrepo-0.9.9-24.el6.noarch 4/4
Installed:
createrepo.noarch 0:0.9.9-24.el6
Dependency Installed:
deltarpm.x86_64 0:3.5-0.5.20090913git.el6 libxml2-python.x86_64 0:2.7.6-21.el6 python-deltarpm.x86_64 0:3.5-0.5.20090913git.el6
Complete!
安装ok后接下来我们就可以生成repodata源数据:
例:
[root@station40 ~]# createrepo /var/ftp/pub/app/ (这里是给清楚路径)
Spawning worker 0 with 1 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
生成ok后我们可以检查app目录下是否生成repodata的程序包:
例;
[root@station40 pub]# ls app
repodata tree-1.6.0-10.el7.x86_64.rpm
[root@station40 repodata]# ls
071e46baa6ee3c0474a0669687e3375b7c584e6962695adb514c6f6d24f332fd-other.xml.gz b7890e6fa4115385c9e0048e5ffcc239eeac5cf3cd01fe1b886d5afb20005561-filelists.sqlite.bz2 repomd.xml
357a4ca8c47ad11440a849c65297e2f8d416e7e30fdef185b676c8909a36b1f1-primary.sqlite.bz2 d4382535accd33ed1f7382b6f4d3756c7e17c32fadcd1e46624afb81a2e0974d-primary.xml.gz
69c6cdbff7a010cb2ed854f62d2a7b23cccd8dbb6f50a359e0a7e374b98d5ec5-other.sqlite.bz2 dc14d23bfeb8d245da30b365014ae911633d5f264d234e53429eab28a9b3e1b0-filelists.xml.gz