過去にLinux(CentOS)のサーバに、NTFSのディスクをマウントする必要があったので、その時の解決策をメモする。
例えば、CentOSのサーバから、WindowsPCにデータを外付けHDDで移行するために、
NTFSの外付けHDDをCentOSのサーバでも認識させる必要があるシーンにおいて活用できる。
CentOSサーバ — 外付けHDD — WindowsPC が構成のイメージだ。
1. 前提
CentOSのバージョン
1 2 |
$cat /etc/redhat-release<br> CentOS release 5.6 (Final) |
カーネルのバージョン
1 2 |
$cat /proc/version<br> Linux version 2.6.18-238.9.1.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) |
ディスクの状態
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$sudo fdisk -l Disk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1305 10377990 8e Linux LVM Disk /dev/sdb: 2116 MB, 2116550656 bytes 255 heads, 63 sectors/track, 257 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 * 1 258 2066880 7 HPFS/NTFS Partition 1 has different physical/logical endings: phys=(256, 254, 63) logical=(257, 82, 17) |
/dev/sdb1がusbdiskでNTFSファイルシステム。今回、このusbdiskをCentOSにマウントしてみる。
とりあえず、何もパッケージを入れない状態でマウントしてみると、失敗する。
1 2 |
$sudo mount -t ntfs /dev/sdb1 /mnt/usbdisk mount: unknown filesystem type \'ntfs\'; |
2. 解決方法
必要なパッケージをインストール
必要なパッケージは以下の5つである。
- dkms-2.1.1.2-1.el5.rf.noarch.rpm
- dkms-fuse-2.7.3-1.el5.rf.noarch.rpm
- fuse-2.7.4-8_12.el5.i386.rpm
- fuse-ntfs-3g-2013.1.13-2.el5.rf.i386.rpm
- kernel-devel.i686 0:2.6.18-406.el5
※5は、1に必要。5を先に入れないと、次のようなエラーが出る。5は、yumでインストールできる。
1 |
kernel-devel is needed by dkms-2.1.1.2-1.el5.rf.noarch |
※4をインストールする前に、3を先にインストールする必要がある。
1 2 3 4 |
$ sudo rpm -ivh fuse-ntfs-3g-2013.1.13-2.el5.rf.i386.rpm warning: fuse-ntfs-3g-2013.1.13-2.el5.rf.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6 error: Failed dependencies: fuse >= 2.6.3 is needed by fuse-ntfs-3g-2013.1.13-2.el5.rf.i386 |
マウントする。
1 2 3 |
$ sudo mount -t ntfs /dev/sdb1 /mnt/usbdisk The disk contains an unclean file system (0, 0). The file system wasn\'t safely closed on Windows. Fixing. |
マウントできているか確認する。
1 2 3 4 5 6 7 8 9 |
$ mount /dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) /dev/sdb1 on /mnt/usbdisk type fuseblk (rw,allow_other,blksize=4096) |
1 2 3 4 5 6 7 |
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 8.6G 1.4G 6.8G 18% / /dev/sda1 99M 19M 76M 20% /boot tmpfs 188M 0 188M 0% /dev/shm /dev/sdb1 2.0G 34M 2.0G 2% /mnt/usbdisk |
-> /mnt/usbdiskにマウントできた。
ファイルシステムタイプを確認する。
1 2 3 4 5 6 7 8 |
$ sudo fdisk /dev/sdb -l Disk /dev/sdb: 2116 MB, 2116550656 bytes 255 heads, 63 sectors/track, 257 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 258 2066880 7 * HPFS/NTFS Partition 1 has different physical/logical endings: phys=(256, 254, 63) logical=(257, 82, 17) |
-> ちゃんと、NTFSとして認識していることが確認できた。
CentOS 6.7 に PostgreSQL 9.5 を yumでインストールする手順
はじめに
CentOSの初期設定では、PostgreSQLはbaseリポジトリからインストールされるようになっている。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
$ yum list postgresql* 読み込んだプラグイン:fastestmirror Determining fastest mirrors * base: ftp.tsukuba.wide.ad.jp * extras: ftp.tsukuba.wide.ad.jp * updates: ftp.tsukuba.wide.ad.jp 利用可能なパッケージ postgresql.i686 8.4.20-5.el6_7 updates postgresql.x86_64 8.4.20-5.el6_7 updates postgresql-contrib.x86_64 8.4.20-5.el6_7 updates postgresql-devel.i686 8.4.20-5.el6_7 updates postgresql-devel.x86_64 8.4.20-5.el6_7 updates postgresql-docs.x86_64 8.4.20-5.el6_7 updates postgresql-jdbc.noarch 8.4.704-2.el6 base postgresql-libs.i686 8.4.20-5.el6_7 updates postgresql-libs.x86_64 8.4.20-5.el6_7 updates postgresql-odbc.x86_64 08.04.0200-1.el6 base postgresql-plperl.x86_64 8.4.20-5.el6_7 updates postgresql-plpython.x86_64 8.4.20-5.el6_7 updates postgresql-pltcl.x86_64 8.4.20-5.el6_7 updates postgresql-server.x86_64 8.4.20-5.el6_7 updates postgresql-test.x86_64 8.4.20-5.el6_7 updates |
PostgreSQLのyumリポジトリの追加
PostgreSQLは、公式の yum リポジトリを提供しているので、そのリポジトリを指定してインストールするように設定を変更する。
Continue reading “CentOS 6.7 に PostgreSQL 9.5 を yumでインストールする手順”
Vagrant1.7.2 が VirtualBox5に対応していなくてErrorが出る
Vagrantのコマンドを叩くとエラーになる。
VirtualBoxをアップデートしていたら、いつの間にかVagrantに対応していないバージョンに上がった模様。
1 2 3 4 5 6 7 8 9 10 |
$ vagrant status The provider 'virtualbox' that was requested to back the machine 'default' is reporting that it isn't usable on this system. The reason is shown below: Vagrant has detected that you have a version of VirtualBox installed that is not supported. Please install one of the supported versions listed below to use Vagrant: 4.0, 4.1, 4.2, 4.3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$ vagrant version Installed Version: 1.7.2 Latest Version: 1.8.1 To upgrade to the latest version, visit the downloads page and download and install the latest version of Vagrant from the URL below: http://www.vagrantup.com/downloads.html If you're curious what changed in the latest release, view the CHANGELOG below: https://github.com/mitchellh/vagrant/blob/v1.8.1/CHANGELOG.md |
調べると、Vagrantのバージョンをあげれば、対応可能になりそうとの事で、
上記のvagrantのダウンロードサイト
にアクセスし、最新版の1.8.1をダウンロード・インストールする。
再度vagrantコマンドを叩いてみる。
1 2 3 4 5 6 |
$ vagrant status Current machine states: default poweroff (virtualbox) The VM is powered off. To restart the VM, simply run `vagrant up` |
今度はコマンドを認識し、解決した。
iPhoneでGmailのプッシュ通知をリアルタイムで受信する方法
iPhoneのgmailは、残念ながらプッシュ通知に対応しておらず、
最短でも15分間隔でのフェッチでしか取得出来ない。
メールが来たらすぐに確認したい場合は、プッシュで知らせて欲しいときもあるだろう。
そんな時の方法を紹介しようと思う。
結論から言うと、
gmailから外部のメールサービス(※)に転送し、
そのメールサービスからプッシュ通知をして貰えば良い。
(※)
メールサービスが、iPhoneでのプッシュに対応している必要がある。
筆者が確認できているのは、yahoo.comとoutlook.com
outlook.comについてはこちらのリンクを参照
iPhoneでGmailをリアルタイム受信する方法[Outlook版]
yahoo.comでは、
yahooメール(恐らく配信サーバはU.S.)のログインアカウントがある前提で、
yahoo mailにログイン- [Settings]- [Accounts]
にて、gmailアカウントを登録する。
すると、しばらくしてgmailのメールがyahoo mailでも表示される。
あとはiPhoneでyahoo.comのメールアカウントを設定し、プッシュ通知にすれば、
gmailのメールもプッシュ通知となる。
なお、yahooのアドレスでgmailのメールを受信して、
返信はgmailのアドレスからしたい場合は、
iPhoneのメール設定から、yahoo.comのsmtpサーバをgmail(smtp.gmail.com)にする必要があるが詳細は割愛する。
gmail->yahoo.com->iPhoneという経路でタイムラグが発生するのではないかと思うが、
相手の送信から2秒以内(ほぼリアルタイム)に受信できたことを確認した。
ただ、まれに9分くらい遅延して受信したこともあったので、残念ながら常にリアルタイムというわけではないようである…。
それでもフェッチよりは早いと割り切って、使ってみても良いだろう。