Google Compute Engine は バーチャルなサーバーをクラウド上に作成できるGoogleのサービスです。 有料ですが無料で300ドルぶんお試しで利用できます(要クレジットカード)
#1. Google Compute Engine へ登録してサーバを起動する
(インストール中に簡単な英語で何か聞かれるが、もしよくわからない場合は, そのまま「return」でOK。)
curl https://sdk.cloud.google.com | bash
いったんターミナルを終了して再度起動させます
下記コマンドを入力してGoogleアカウントを設定します。
gcloud auth login
インスタンス名はWEBサイト「Google Cloud Platform」から 左メニュー > Compute Engine > VMインスタンス の 画面に一覧表示されます。
そこの接続したいインスタンスの項目の「接続:SSH」の横のボタンから「gcloudコマンドを表示」でSSHの接続コマンドが表示されます。
それをターミナルから入力するとSSHログインできます。
gcloud compute instances list
とします
参考 : http://bit.ly/1Y406U2 に記述がありました。とても便利です。
.bash_profile に 以下を追加
alias gcp='gcloud compute copy-files'
alias glist='gcloud compute instances list'
alias gsh='gcloud compute ssh'
alias gup='gcloud compute instances start'
alias gdown='gcloud compute instances stop'
としておいて 以下のように操作します
gsh 【インスタンス名】
でssh接続します。
#3. WEBサーバApacheをインストールして起動する
sudo apt-get install apache2
sudo /etc/init.d/apache2 start
これでWEBサーバが起動します。
次にトップページを作成してみます。
cd /var/www/
sudo chmod 0777 html
cd /var/www/html
mv index.html ___old___index.html
vi index.html
(エディタで何か入力して保存する)
WEBサイト「Google Cloud Platform」からインスタンスのIPアドレスのところをクリックすると表示されているはずです。