- sudoerの追加
sudo
コマンドのインストールzsh
のインストールとデフォルトシェルの変更vim
のインストール- ドットファイルちょっといじる
gcc
インストールmake
コマンドのインストール- Pythonのビルドに必要なパッケージのインストール
git
コマンドのインストールpyenv
のインストール- Python2.6.6環境ディレクトリの作成
- sshKeyの作成
tesseract-ocr
,python-imaging
パッケージのインストールgcutil
コマンドのインストールnvm
,node
,npm
のインストール- mongoDB最新版をインストール(せつこ、これはドライバーや)
- mongoDB最新版をインストール(aptを使う)
go
のインストールrevel
のインストールtmux
のインストール- apache2のインストールとリバースプロキシ設定
Last active
December 24, 2015 09:49
-
-
Save otiai10/6779454 to your computer and use it in GitHub Desktop.
VPSをDebian7.1wheezyにしたのでサーバセットアップのログを取っておこうと思ったわけ 2
go
のインストール
https://gist.github.com/otiai10/6596982
mercurial(hg
)のインストール
www15224uf% apt-cache search mercurial
mercurial - easy-to-use, scalable distributed version control system
www15224uf% sudo apt-get install mercurial
[sudo] password for otiai10:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
mercurial-common
Suggested packages:
qct wish kdiff3 kdiff3-qt kompare meld xxdiff tkcvs mgdiff python-mysqldb python-pygments python-openssl
The following NEW packages will be installed:
mercurial mercurial-common
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,413 kB of archives.
After this operation, 8,067 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.jp.debian.org/debian/ wheezy/main mercurial-common all 2.2.2-3 [2,320 kB]
Get:2 http://ftp.jp.debian.org/debian/ wheezy/main mercurial amd64 2.2.2-3 [93.1 kB]
Fetched 2,413 kB in 1s (1,630 kB/s)
Selecting previously unselected package mercurial-common.
(Reading database ... 34815 files and directories currently installed.)
Unpacking mercurial-common (from .../mercurial-common_2.2.2-3_all.deb) ...
Selecting previously unselected package mercurial.
Unpacking mercurial (from .../mercurial_2.2.2-3_amd64.deb) ...
Processing triggers for man-db ...
Setting up mercurial-common (2.2.2-3) ...
Setting up mercurial (2.2.2-3) ...
Creating config file /etc/mercurial/hgrc.d/hgext.rc with new version
www15224uf% which hg
/usr/bin/hg
www15224uf%
$GOROOT
,$GOPATH
の設定
~/.zshrc
# - go
export GOROOT=$HOME/proj/go
export GOPATH=$HOME/proj/go/packages
export PATH=${PATH}:$GOROOT/bin:$GOPATH/bin
www15224uf% source ~/.zshrc
ソースのダウンロード
www15224uf% cd ~/src
www15224uf% wget https://go.googlecode.com/files/go1.1.2.linux-amd64.tar.gz
--2013-10-02 14:48:42-- https://go.googlecode.com/files/go1.1.2.linux-amd64.tar.gz
Resolving go.googlecode.com (go.googlecode.com)... 74.125.31.82, 2404:6800:4008:c00::52
Connecting to go.googlecode.com (go.googlecode.com)|74.125.31.82|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 41756805 (40M) [application/x-gzip]
Saving to: `go1.1.2.linux-amd64.tar.gz'
100%[==============================================================================================================================================================================>] 41,756,805 4.35M/s in 17s
2013-10-02 14:49:01 (2.28 MB/s) - `go1.1.2.linux-amd64.tar.gz' saved [41756805/41756805]
www15224uf% tar -xzf go1.1.2.linux-amd64.tar.gz
www15224uf% cp -r go ~/proj
www15224uf%
ビルド
www15224uf% cd $GOROOT/src
www15224uf% ./all.bash
# Building C bootstrap tool.
cmd/dist
# Building compilers and Go bootstrap tool for host, linux/amd64.
...中略...
ALL TESTS PASSED
---
Installed Go for linux/amd64 in /home/otiai10/proj/go
Installed commands in /home/otiai10/proj/go/bin
www15224uf%
www15224uf% which go
/home/otiai10/proj/go/bin/go
GOROOT
もGOPATH
もちゃんと効いてるもよう
revel
のインストール
www15224uf% cd ~
www15224uf% go get github.com/robfig/revel/revel
www15224uf% which revel
/home/otiai10/proj/go/packages/bin/revel
www15224uf%
サンプルアプリの起動
www15224uf% revel run github.com/robfig/revel/samples/chat
~
~ revel! http://robfig.github.com/revel
~
2013/10/02 15:04:26 revel.go:292: Loaded module static
2013/10/02 15:04:26 revel.go:292: Loaded module testrunner
2013/10/02 15:04:26 run.go:57: Running chat (github.com/robfig/revel/samples/chat) in dev mode
2013/10/02 15:04:26 harness.go:157: Listening on :9000
2013/10/02 15:04:39 revel.go:292: Loaded module static
2013/10/02 15:04:39 revel.go:292: Loaded module testrunner
2013/10/02 15:04:39 main.go:30: Running revel server
Go to /@tests to run the tests.
Listening on port 49160...
^C% www15224uf%
いけた
mgo
のインストール
mgo
Rich MongoDB driver for Go
bzr
のインストール
パッケージ: bzr (2.6.0~bzr6526-1) 簡単に使える分散型バージョン管理システム
Bazaar は分散型バージョン管理システムです。簡単に使えて、直感的で、いろいろ なワークフローに適用でき、信頼性があり、かつ、簡単に拡張できるように設計されています。
www15224uf% apt-cache search bzr
bzr - easy to use distributed version control system
www15224uf% sudo apt-get install bzr
[sudo] password for otiai10:
...中略...
Setting up python-configobj (4.7.2+ds-4) ...
Setting up python-bzrlib (2.6.0~bzr6526-1) ...
Setting up bzr (2.6.0~bzr6526-1) ...
Setting up wwwconfig-common (0.2.2) ...
Setting up javascript-common (7) ...
Setting up libjs-jquery (1.7.2+dfsg-1) ...
Setting up python-crypto (2.6-4) ...
Setting up python-gpgme (0.2-3) ...
Setting up python-httplib2 (0.7.4-2) ...
Setting up python-keyring (0.7.1-1+deb7u1) ...
Setting up python-pkg-resources (0.6.24-1) ...
Setting up python-simplejson (2.5.2-1) ...
Setting up python-lazr.uri (1.0.3-1) ...
Setting up python-wadllib (1.3.0-2) ...
Setting up python-zope.interface (3.6.1-3) ...
Setting up python-oauth (1.0.1-3) ...
Setting up python-lazr.restfulclient (0.12.0-2) ...
Setting up python-launchpadlib (1.9.12-2) ...
Setting up python-paramiko (1.7.7.1-3.1) ...
www15224uf%
なんか色々入ったな...
mgo
のインストール
www15224uf% go get labix.org/v2/mgo
www15224uf%
サンプルアプリ作るためのデータをつくる
www15224uf% mongo
MongoDB shell version: 2.4.6
connecting to: test
> help
db.help() help on db methods
db.mycoll.help() help on collection methods
sh.help() sharding helpers
rs.help() replica set helpers
help admin administrative help
help connect connecting to a db help
help keys key shortcuts
help misc misc things to know
help mr mapreduce
show dbs show database names
show collections show collections in current database
show users show users in current database
show profile show most recent system.profile entries with time >= 1ms
show logs show the accessible logger names
show log [name] prints out the last segment of log in memory, 'global' is default
use <db_name> set current database
db.foo.find() list objects in collection foo
db.foo.find( { a : 1 } ) list objects in foo where a == 1
it result of the last line evaluated; use to further iterate
DBQuery.shellBatchSize = x set default number of items to display on shell
exit quit the mongo shell
> db.createCollection('hoge')
{ "ok" : 1 }
> db.hoge.find()
>
> exit
bye
サンプルアプリをつくる
www15224uf% mkdir -p labo/mgo
www15224uf% cd labo/mgo
www15224uf% vi sample.go
sample.go
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
)
type Person struct {
Name string
Phone string
}
func main() {
session, err := mgo.Dial("localhost")
if err != nil {
panic(err)
}
defer session.Close()
// Optional. Switch the session to a monotonic behavior.
session.SetMode(mgo.Monotonic, true)
c := session.DB("test").C("hoge")
err = c.Insert(&Person{"Ale", "+55 53 8116 9639"},
&Person{"Cla", "+55 53 8402 8510"})
if err != nil {
panic(err)
}
result := Person{}
err = c.Find(bson.M{"name": "Ale"}).One(&result)
if err != nil {
panic(err)
}
fmt.Println("Phone:", result.Phone)
}
www15224uf% go run sample.go
Phone: +55 53 8116 9639
おお動いた
www15224uf% mongo
MongoDB shell version: 2.4.6
connecting to: test
> db.hoge.find()
{ "_id" : ObjectId("524bbd58af5c4c9ebe7961f1"), "name" : "Ale", "phone" : "+55 53 8116 9639" }
{ "_id" : ObjectId("524bbd58af5c4c9ebe7961f2"), "name" : "Cla", "phone" : "+55 53 8402 8510" }
> exit
bye
www15224uf%
DBにも入っとる
tmux
のインストール
www15224uf% sudo apt-get install tmux
[sudo] password for otiai10:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
tmux
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 249 kB of archives.
After this operation, 543 kB of additional disk space will be used.
Get:1 http://ftp.jp.debian.org/debian/ wheezy/main tmux amd64 1.6-2 [249 kB]
Fetched 249 kB in 0s (592 kB/s)
Selecting previously unselected package tmux.
(Reading database ... 38622 files and directories currently installed.)
Unpacking tmux (from .../archives/tmux_1.6-2_amd64.deb) ...
Processing triggers for man-db ...
Setting up tmux (1.6-2) ...
www15224uf% which tmux
/usr/bin/tmux
apache2のインストールとリバースプロキシ設定
インストール
www15224uf% sudo apt-get install apache2
proxyモジュールを有効にする
http://otiai10.hatenablog.com/entry/2013/02/12/162501
www15224uf% sudo a2enmod proxy
www15224uf% sudo a2enmod proxy_http
www15224uf% sudo a2enmod proxy_connect
httpd.confを編集する
/etc/apache2/conf.d/httpd.conf
であった。/etc/apache2/httpd.conf
でうまくいってたのはなぜだ?
<VirtualHost *:80>
ServerName yourservicename.com
ServerAdmin [email protected]
ProxyRequests off
ProxyPass / http://applicationserver.com:7777/
<Location />
ProxyPassReverse http://applicationserver.com:7777/
ProxyPassReverseCookieDomain localhost yourservicename.com
ProxyPassReverseCookiePath / /
Order allow,deny
# Allow Allでいいのかな?
Allow from all
</Location>
</VirtualHost>
apache restart
www15224uf% sudo /etc/init.d/apache2 restart
ちょっと訂正
ユーザ関係
- suでrootに
- apt-getでsudoをinstall
- visudoも一緒に入ってくるから一般ユーザをsudoerに追加
- exitで一般ユーザに戻る
nginx
- sudo apt-get install nginx
- sudo which nginx (入ってる確認)
- exitで一般ユーザに戻る
- sudo nginx
- なんも記述無いけどデフォルトのドキュメントルートは/usr/share/nginx/index.htmlっぽい
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mongoDB最新版をインストール
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian/
aptで入れれるパッケージが更新された感ある
いけた感ある
いけたしv2.4.6である