まとめアプリ「まとめたDE!!」を公開します。
記事を読んでいる時に他の記事を先読みするので超快適に見ることが出来ます。
お気に入りとして、オフラインに保存する機能もつけてみました。
http://matome.iijuf.net/apk/42.mde.apk
まとめアプリ「まとめたDE!!」を公開します。
記事を読んでいる時に他の記事を先読みするので超快適に見ることが出来ます。
お気に入りとして、オフラインに保存する機能もつけてみました。
http://matome.iijuf.net/apk/42.mde.apk
onScrollで下に移動すると自動的にロードするプログラムをここを参考に書いていた
http://kernhack.hatenablog.com/entry/2013/10/25/211637
しかし、場合によってnotifyDataSetChangedやinvalidateViewsを呼んでも更新されないことがあるように気づいた。
AsyncTaskでonPostExecute内でnotifyDataSetChangedで呼んだ場合だけ更新されるようだ。
特に理由はわからないが、
AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void… params) {
// TODO Auto-generated method stub
return null;
}
@Override
protected void onPostExecute(Void result) {
adapter.notifyDataSetChanged();
listView.invalidateViews();
}
};
task.execute();
これで正しく更新されるようになった。onScroll内で呼ぶとダメなのかもしれない
VPSを自宅ネットワーク配下におくために、前回PPTPを導入した。
しかし、PPTPは暗号化アルゴリズムに不備があり、安全ではない。
そこで、別のVPNを導入しようと考えた。
VPNといえば SoftEther VPN でしょ。
という天の声が聞こえた気がした。
ちなみに他の候補としてはOpenVPNがある。
SoftEther VPNが優位であることを調べないことにはSoftEtherVPNを入れる気がしない。
https://ja.softether.org/
なるほど。SoftEtherは高スループットで他のプロトコルにも対応しているとな。
ではあらためてSoftEther VPNをRaspberryPiに入れよう。
まずはhttp://jp.softether-download.com/files/softether/ ここからARM EABIのServerバージョンをいれる。
1 2 3 4 |
wget http://jp.softether-download.com/files/softether/v4.04-9412-rtm-2014.01.15-tree/Linux/SoftEther%20VPN%20Server/32bit%20-%20ARM%20legacy%20ABI/softether-vpnserver-v4.04-9412-rtm-2014.01.15-linux-arm-32bit.tar.gz tar zxvf softether-vpnserver-v4.04-9412-rtm-2014.01.15-linux-arm-32bit.tar.gz cd vpnserver make |
1 2 |
/usr/bin/ld: failed to merge target specific data of file lib/libz.a(crc32.o) collect2: ld returned 1 exit status |
はい、順調にエラーですね。
結論からいうと、EABI Legacy ARM ではなく、ARM EABIのほうを選ぶと問題なくいけました。
1 2 3 4 5 6 7 8 9 10 11 |
wget http://jp.softether-download.com/files/softether/v4.04-9412-rtm-2014.01.15-tree/Linux/SoftEther%20VPN%20Server/32bit%20-%20ARM%20EABI/softether-vpnserver-v4.04-9412-rtm-2014.01.15-linux-arm_eabi-32bit.tar.gz tar zxvf softether-vpnserver-v4.04-9412-rtm-2014.01.15-linux-arm_eabi-32bit.tar.gz cd vpnserver make cd .. mv vpnserver /usr/local/ cd /usr/local/vpnserver chmod 600 * chmod 700 vpncmd chmod 700 vpnserver |
vpncmdで動作チェック
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
root@raspberrypi:/usr/local/vpnserver# ./vpncmd vpncmd command - SoftEther VPN Command Line Management Utility SoftEther VPN Command Line Management Utility (vpncmd command) Version 4.04 Build 9412 (English) Compiled 2014/01/15 17:48:18 by yagi at pc25 Copyright (c) SoftEther VPN Project. All Rights Reserved. By using vpncmd program, the following can be achieved. 1. Management of VPN Server or VPN Bridge 2. Management of VPN Client 3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool) Select 1, 2 or 3: 3 VPN Tools has been launched. By inputting HELP, you can view a list of the commands that can be used. VPN Tools>check Check command - Check whether SoftEther VPN Operation is Possible --------------------------------------------------- SoftEther VPN Operation Environment Check Tool Copyright (c) SoftEther VPN Project. All Rights Reserved. If this operation environment check tool is run on a system and that system passes, it is most likely that SoftEther VPN software can operate on that system. This check may take a while. Please wait... Checking 'Kernel System'... Pass Checking 'Memory Operation System'... Pass Checking 'ANSI / Unicode string processing system'... Pass Checking 'File system'... Pass Checking 'Thread processing system'... Pass Checking 'Network system'... Pass All checks passed. It is most likely that SoftEther VPN Server / Bridge can operate normally on this system. The command completed successfully. VPN Tools>exit |
起動スクリプトに追加
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
root@raspberrypi:/usr/local/vpnserver# emacs /etc/init.d/vpnserver #!/bin/sh ### BEGIN INIT INFO # Provides: vpnserver # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: SoftEther VPN 1.0 RC2 # Description: Start vpnserver daemon SoftEther VPN 1.0 Server ### END INIT INFO DAEMON=/usr/local/vpnserver/vpnserver LOCK=/var/lock/vpnserver . /lib/lsb/init-functions test -x $DAEMON || exit 0 case "$1" in start) sleep 3 log_daemon_msg "Starting SoftEther VPN 1.0 Server" "vpnserver" $DAEMON start >/dev/null 2>&1 touch $LOCK log_end_msg 0 sleep 3 ;; stop) log_daemon_msg "Stopping SoftEther VPN 1.0 Server" "vpnserver" $DAEMON stop >/dev/null 2>&1 rm $LOCK log_end_msg 0 sleep 2 ;; restart) $DAEMON stop sleep 2 $DAEMON start sleep 5 ;; status) if [ -e $LOCK ] then echo "vpnserver is running." else echo "vpnserver is not running." fi ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac exit 0 |
1 2 3 4 |
chmod +x /etc/init.d/vpnserver apt-get install chkconfig chkconfig vpnserver on /etc/init.d/vpnserver start |
Raspberry PIのtypeBを購入した。
なんだかMade in Chinaはよくないという書き込みが多かったので、Made in UK を探して Amazonで購入した。
OSはRaspbianをインストール
http://d.hatena.ne.jp/zqwell-ss/20130623/1372009506
こちらを参考にした。
最初のセットアップも含め、驚くほど簡単だった。
しかし、SSHの設定ではまった。
初期設定画面のアドバンスオプションから設定できるはずだが
Initial ssh key generation still running. Please wait and try again.
とでてきて、SSHを設定できない。
http://raspberrypi.stackexchange.com/questions/1303/do-ssh-failing-in-initial-setup
に近いことが書いてあるが、そもそもssh_host*等はない。
しかたなくSSHの設定はせずにターミナルでssh-keygen -A を行ってみると
ssh: symbol lookup error: /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0: undefined symbol: _gmon_start__, version OPENSSL_1.0.0
とでてにっちもさっちもいかない。
困った。
OSを再インストールして、初期設定画面のAdvanced OptionsでSSHをEnableしようとしたが、同様に
Initial ssh key generation still running. Please wait and try again.
だった。その後、Advanced Optionsのところでupdateしたら、なんとSSHをEnableできるようになった!
どうやら、updateでライブラリを最新版にしないといけなかったようだ。めでたしめでたし。
VPSから自宅のルータにPPTPをして、自宅ネットワークにあるNASをVPSにマウントしようとしている。
マウントはOK。
NAS→VPSへのファイルコピーもOK
しかし、VPS→NASへのファイルコピーを行うと、PPTPが切断されて、コピーもできない。
うーーーーーん
VPSのHDD容量は少なく高いので、なんとかお安く拡張する方法はないかと頑張ります。
Ubuntuから自宅のdd-wrtにVPNで接続して、自宅ネットワーク(192.168.11.0)のNAS(1921.68.11.111)をマウントしたい
1. UbuntuをPPTPクライアントにして、dd-wrtにPPTPに接続する
2. NASをマウント
という手順でチャレンジしてみようと思います。
まず1. UbuntuをPPTPクライアントに
こちらを参考にしました。http://linux2.g.hatena.ne.jp/lnznt/20120708/1341713045
1 2 |
$ sudo apt-get install pptp-linux $ sudo pptpsetup --create VPN1 --server 111.222.33.44 --usernaem lnznt --password hoge --encrypt |
/etc/ppp/peers/VPN1 にpersistを追加すると、切断時に再接続されるようです。
PPTPの接続の仕方。
1 |
pppd call VPN1 updetach 192.168.11.123:192.168.11.124 |
リモートIPとローカルIPを設定しないと、VPSのグローバルIPになってしまいルーティングもうまく行きませんでした。自動的に切断もされる様子でした。(多分IPの競合で)
ルーティングの仕方。/etc/ppp/ip-up.d/myrouteを作成し、
1 2 |
#!/bin/sh /sbin/route add -net 192.168.11.0 netmask 255.255.255.0 gw 192.168.11.123 ppp0 |
としておきます。こすることで、pptp確立時に自動的にrouteコマンドが呼ばれて、ルーティング設定がされます。
サーバ起動時に自動起動にするには
/etc/init.d/にvpn-homeという名前で
1 2 |
#!/bin/sh pppd call VPN1 updetach 192.168.11.123:192.168.11.124 |
とでも作成しておいて、 chmod +x vpn-home としておきましょう。
ランレベルにシンボリックリンクを貼る。S+数字二桁+文字にしないと実行されないらしい。
1 2 |
$ cd /etc/rc2.d $ ln -s ../init.d/vpn-home S99vpnhome |
これでping 192.168.11.1およびping 192.168.11.111で応答が返ってきました。
マウントは次の記事で。
blog作成してみた
wordpressのubuntu12.04の設定方法は
http://www.nekotricolor.com/blog/2013/04/05/934/
を参考にしました。
まずはMySQLのユーザとデータベース作成
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 42 Server version: 5.5.29-0ubuntu0.12.04.2 (Ubuntu) Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> CREATE DATABASE wp; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON wp.* TO "wpadmin"@"localhost" -> IDENTIFIED BY "password"; Query OK, 0 rows affected (0.01 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye |
次に、WordPressのダウンロードと設定
1 2 3 4 5 6 |
$ cd /var/www/html $ wget http://ja.wordpress.org/wordpress-3.8-ja.zip $ unzip wordpress-3.8-ja.zip $ chown www-data:www-data wordpress $ cd wordpress $ cp wp-config-sample.php wp-config.php |
wp-config.phpの 設定を変更
1 2 3 4 5 6 7 8 |
/** WordPress のためのデータベース名 */ define('DB_NAME', 'database_name_here'); /** MySQL データベースのユーザー名 */ define('DB_USER', 'username_here'); /** MySQL データベースのパスワード */ define('DB_PASSWORD', 'password_here'); |
以下の部分はこちらから作成
1 2 3 4 5 6 7 8 |
define('AUTH_KEY', 'put your unique phrase here'); define('SECURE_AUTH_KEY', 'put your unique phrase here'); define('LOGGED_IN_KEY', 'put your unique phrase here'); define('NONCE_KEY', 'put your unique phrase here'); define('AUTH_SALT', 'put your unique phrase here'); define('SECURE_AUTH_SALT', 'put your unique phrase here'); define('LOGGED_IN_SALT', 'put your unique phrase here'); define('NONCE_SALT', 'put your unique phrase here'); |
1 |
define('FORCE_SSL_ADMIN', true); |
ログインや管理ページを SSLにするため、上記も追加
その後、wp-admin/install.phpにアクセスしてインストール
管理画面に入り、プラグインの追加から、Crayon Syntax Highlighterをインストール