FTPサイトからファイルをダウンロードする際に使うことが出来るwgetの逆で、FTPサイトへファイルをアップする機能でwputという機能がある。
ここでは、CentOS 6.xにおける実装方法を記載します。
他のバージョンについても基本的に同じなのですが、RPMForgeリポジトリだけ異なりますので気を付けてください。
あまりメジャーではないが、ftpでスクリプトを書いてゴチャゴチャするより手っ取りくファイルを転送出来るので便利です。
リポジトリを追加する前に、リポジトリの優先度を指定できるプラグインを追加しておきます。
それを実現するためのプラグインはyum-prioritiesです。
インストール方法について記載します。
<<リポジトリ優先度指定用プラグインのインストールと設定>>
# yum install yum-plugin-priorities # yum install yum-priorities # vi /etc/yum.repos.d/CentOS-Base.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. # # [base] name=CentOS-$releasever - Base mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=https://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 priority=1 ← ここ #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates #baseurl=https://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 priority=1 ← ここ #additional packages that may be useful [extras] name=CentOS-$releasever - Extras mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras #baseurl=https://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 priority=1 ← ここ
<<RPMforgeリポジトリの追加>>
wputをインストールするには、RPMSearchでRPMをダウンロードしてインストールする方法もありますが、やはりCentOSであればyumでインストールを行いたいと思います。
RPMforgeリポジトリの追加にもyumを使用します。
やり方は、CentOS 6.xに関する方法です。
他のバージョンの時には別のファイルになるので注意してください。
# wget https://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm # rpm -ivh rpmforge-release-* # yum -y update rpmforge-release
<<wputのインストール>>
やっとインストールする準備が完了しました。
ということで、wputをインストールしちゃいます(^^♪
# yum install wput
最後に確認してみましょう。
# wput -V wput version: 0.6.1
こんな感じでバージョンが表示されれば完成です。
使い方は至って簡単です。
# wput hogehoge ftp://username:passwd@111.222.333.444/
wgetにも色々なオプションがあります。詳しくはヘルプを参照してください。