ConoHa WingでGoogle cloud SDKを使う

前回の記事でConoha WingでGoogle cloud SDKを使う為に、python2.7のインストールについて書きました。
その続きです。

Google cloud SDKはpython2.7より上のバージョンでは動いてくれないので、先にpython2.7を導入しておいてください。

$ gsutil version
ERROR: Python 3 and later is not compatible with the Google Cloud SDK. Please use Python version 2.7.x.

If you have a compatible Python interpreter installed, you can use it by setting
the CLOUDSDK_PYTHON environment variable to point to it.

続きを読む

ConoHa WingでPython2.7を導入する

清楚可愛いこのはちゃんの最強最速レンサバConoHa Wingでgcloud(Google cloud SKD)が使いたかったんですが、gcloudのやつが相変わらずPython2.7より上のバージョンは対応してくれないのでPython2.7.16をConoHa Wingにインストールすることにしました。

便利なaptなど使えないので仕方なくソースコードをビルドして$HOME/local/にpython2.7を導入します。

なお、Google cloud SDKを導入予定の方は、sqlite3が必要になるので先にビルドしておくのがお勧めです。sqlite3のインストール

続きを読む

[Time4VPS] Storage VPSのUnix Bench

コスパ最強とも言われてる(ような)リトアニアのTime4VPSでStorage VPSを借りたのでとりあえずUnix Bench採ってみました。
初期でインストールされているCentOSではなくDebian Stretchで再インストールしてからUnix Benchを走らせました。
Debianは正義です。

契約したプランは0.5 TB Plan。
CPU: 1 vCPU
RAM: 512MB (Swapなし、作成・追加は不可)
Storage: 512GB
Bandwidth: 4TB

それとWebページからReboot時に出るログを見る感じ、
iolimit: 52Mb/s,
iops: 200 iops
なんですね。

Stopping container ...
Container was stopped
Container is unmounted
Starting container...
Container is mounted
Adding IP address(es): 
Setting CPU limit: 0
Setting CPU units: 512
Setting CPUs: 1
Setting devices
Setting iolimit: 52428800 bytes/sec
Setting iopslimit: 200 iops
Container start in progress...

続きを読む

[Debian] CoderでVS CodeなオンラインLaTeX環境を作る

オンラインでVisual Studio Codeが使用できるCoderが最近、OSS化しました。
そこでCode-serverを用いてVPS上に快適な個人LaTeXエディタの環境を整えることにしました。

備忘録です。

今回のVPSの環境は
・ASW – Lightsail 2GB
・Debian Stretch
です。

Coderの導入に関しては、正直バイナリファイルを落としてくるだけなので簡単です。
LaTeXの導入に若干の時間がかかります。

ただ問題点が、
・PDFのプレビューが見れない
・拡張機能のインストールと使用に若干の難がある
の2つがあります。
今後のアップデートに期待です。

続きを読む

WLinuxのapt updateが遅い

WLinux

$ sudo apt-get update

が異様に遅い。upgradeやinstallは速いんです。

普段はaptのリポジトリを変更しないのですが、updateがとんでもなく遅いので日本のサーバーに変更しました。

$ sudo vim /etc/apt/sources.list
# sources.list
deb http://cdn.debian.or.jp/debian testing main contrib non-free
# deb-src http://cdn.debian.or.jp/debian testing main

deb http://cdn.debian.or.jp/debian testing-updates main
# deb-src http://cdn.debian.or.jp/debian testing-updates main

deb https://deb.debian.org/debian-security testing/updates main
# deb-src http://cdn.debian.or.jp/debian-security testing/updates main

deb http://cdn.debian.or.jp/debian/ unstable main contrib non-free
# deb-src http://cdn.debian.or.jp/debian/ unstable main contrib non-free

deb http://apt.patrickwu.space/ stable main
# obtain source from http://github.com/wslutilities/wslu

$ sudo vim /etc/apt/sources.list.d/stretch-backports.list
# stretch-backports.list
deb http://cdn.debian.or.jp/debian stretch-backports main

これでストレスフリーです・ω・

debianのミラーサーバーはhttps://www.debian.or.jp/using/mirror.htmlに、日本の一覧があります。

[AWS – Lightsail] SSHのセキュア設定

なんか謎にGCEのf1-microが課金されだしたので、去年の夏頃に半額になりすごくお得感のあるAWSのLightsailに乗り換えました。

一番安いプランで$3.5! 素晴らしい。
加えて一番安いプランは一ヶ月無料なんですね!

3.50 USD にて Lightsail プランを 1 か月間 (750 時間まで) 無料で ご利用いただけます。Microsoft Windows Server をご利用の場合は、8 USD のプランを 1 か月間無料でご利用いただけます。また、マネージドデータベースプランをご利用の場合には、15 USD のプランを 1 か月無料でご利用いただけます。最初の Lightsail サーバーを起動する際に適切なプランを選択すると、お客様のアカウントに 1 か月間無料のクレジットが付与されます。*
https://aws.amazon.com/jp/lightsail/pricing/

Lightsailは実質T2インスタンスのCPUクレジットを絞ったバージョンと聞いたので、CPUをよく使う用途には向いてませんが個人のブログとかでは十分でしょう。


今回は大好きなDebian Stretchを使用しています。UbuntuでもSSHの設定はほぼ変わらないです。CentOSは知らないです(´・ω・`)

続きを読む

GCE f1-microで課金?

2019/03/29追記

いつの間にか若干Always freeの内容が変わっていてf1-microが無料で使えるリージョンが3箇所のみになってました。
us-west1 (Oregon), us-central1(Iowa), us-east1(South Carolina)です。

1 non-preemptible f1-micro VM instance per month in one of the following US regions:
Oregon: us-west1
Iowa: us-central1
South Carolina: us-east1
https://cloud.google.com/free/docs/gcp-free-tier

これのせいですね。


VPSに極力お金を使いたくない人の強い味方のGoogle Cloud PlatformのCompute Engine, f1-microさん。
f1-microはAlways free((Always Free, which provides limited access to many common GCP resources, free of charge.
https://cloud.google.com/free/docs/gcp-free-tier
))に毎月1ヶ月分無料の枠があります。
1つのインスタンスはただで使えるわけですね。嬉しいです!

おさらいですが、GCEのAlways freeは

1 f1-micro instance per month (US regions only – Excluding Northern Virginia [us-east4])

30 GB-months HDD, 5 GB-months snapshot

1 GB network egress from North America to all region destinations per month (excluding China and Australia)
https://cloud.google.com/free/

となっています。

しかし、久しぶりに「料金の履歴」を見てみると…

Compute Engine Micro Instance with burstable CPU running in Los Angeles: 151.138 時間 [通貨換算: USD から JPY(レート 109.43 を使用)]

はて、これは一体…?今までなかったぞ…(´・ω・`)

f1-microはus-east4のヴァージニアを除いた米国リージョンで無料のはずなんですが…
f1-microのインスタンスは一つしか立ってないし無料時間分を超えたとも思えない…

構成は、
us-west2, HDD 30GB, debian
と無料枠に収まっています。

不思議ですねえ。

一応Always freeの利用資格「Program eligibility」に
Have an account in good standing.
なんて文言があるので、もしかしたら何かに引っかかったんでしょうか。

しばらく様子見です。

ConoHa WINGにさくっとNextCloudを導入

The Web Installer is the easiest way to install Nextcloud on a web space. It checks the dependencies, downloads Nextcloud from the official server, unpacks it with the right permissions and the right user account. Finally, you will be redirected to the Nextcloud installer.

Right-click here and save the file to your computer
Upload setup-nextcloud.php to your web space
Point your web browser to setup-nextcloud.php on your webspace
Follow the instructions and configure Nextcloud
Login to your newly created Nextcloud instance!
You can find further instructions in the Nextcloud Admin Manual.

Note that the installer uses the same Nextcloud version as available for the built in updater in Nextcloud. After a major release it can take up to a month before it becomes available through the web installer and the updater. This is done to spread the deployment of new major releases out over time.

https://nextcloud.com/install/#instructions-server

1.setup-nextcloud.phpの設置
NexeCloudがsetup-nextcloud.phpという便利なものを用意してくれているのでサクっと使ってしまいましょう。
ssh使うか、ブラウザでsetup-nextcloud.phpをダウンロードしてConoHaのファイルマネージャーからpublic_html/domainフォルダにアップロードします。

$ cd publich_html/xxxxxx
$ wget https://download.nextcloud.com/server/installer/setup-nextcloud.php

2.setup-nextcloud.phpにアクセスして指示に従う。
setup-nextcloud.phpの設置後に設置場所にアクセスします。https://domain.xxx/setup-nextcloud.phpのような感じで。
MySQLのデータベースはConoHa WINGの管理画面から作成出来るものを使っておけば問題ないでしょう。
 

 
 
非常に簡単ですね!!
やり方次第ではSSHを用いらずに導入できるので、CLIアレルギーの方も安心!
200GBの容量を何とか活用できそうです。

[Jupyter Notebook] ValueError: … does not appear to be an IPv4 or IPv6 address

jupyter,notebookをアップデートすると

does not appear to be an IPv4 or IPv6 address

こんなエラーに…

.jupyter/jupyter_notebook_config.pyの

c.NotebookApp.ip = '*'

をきちんとしたIPアドレスで入力してあげると今回は解決。

c.NotebookApp.ip = '0.0.0.0'

アップデートを行うと、何回かに一回は何かしらエラー起きてたいぎい