2011-05-20
UbuntuにフォントRictyを追加
環境
- OS
- Ubuntu10.10
手順
ダウンロード
2011/05/21時点で最新は3.0.1のようです。
$ cd /tmp/ $ wget http://save.sys.t.u-tokyo.ac.jp/~yusa/fonts/ricty/Ricty-3.0.1.tar.gz
解凍
$ tar zxvf Ricty-3.0.1.tar.gz
フォントコピー
$ cd Ricty-3.0.1/ $ mkdir -p ~/.fonts/truetype/ttf-ricty $ mv ricty_* ~/.fonts/truetype/ttf-ricty/
反映
$ fc-cache -fv
参考URL
UbuntuにAptana3をインストール
環境
- OS
- Ubuntu10.10
手順
Aptana3ダウンロード
ゲストOSのUbuntuでブラウザを起動して下記にアクセスしてダウンロードします。
http://www.aptana.com/products/studio3/download
解凍
ダウンロードしたファイルを適当なところにコピーして解凍します。
$ cd ~/Downloads/ $ sudo cp -p Aptana_Studio_3_Setup_Linux_x86_3.0.1.zip /usr/lib/ $ unzip Aptana_Studio_3_Setup_Linux_x86_3.0.1.zip
ディレクトリ名を変更
空白が入っているのでディレクトリ名を変更します。(しなくてもよいけど)
$ mv Aptana\ Studio\ 3/ aptana3
起動シェル作成
/usr/binあたりに起動用のシェルを作成します。
$ cd /usr/bin $ vim aptana3.sh
1 #!/bin/sh 2 export GDK_NATIVE_WINDOWS=true; exec /usr/lib/aptana3/AptanaStudio3
権限付与
$ sudo chmod 755 aptana.sh
起動
ゲストOSの端末から。
$ aptana
参考URL
UbuntuにSun Javaをインストール
環境
- OS
- Ubuntu10.10
手順
Ubuntu10.10にはもともとOpenJDKなるものがインストールされていますが、Aptanaをインストールするにあたり、Aptanaのページを見ると
Sun/Oracle Java 1.5.x or later on Mac and Linux. OpenJDK is not yet supported. The Windows installer includes a compatible version of Java.
とあるので、Sun Javaを入れることにします。
/etc/apt/sources.list修正
$ sudo vim /etc/apt/sources.list
45行目のコメントアウトを解除します。
〜〜省略〜〜 41 ## Uncomment the following two lines to add software from Canonical's 42 ## 'partner' repository. 43 ## This software is not part of Ubuntu, but is offered by Canonical and the 44 ## respective vendors as a service to Ubuntu users. 45 deb http://archive.canonical.com/ubuntu maverick partner 46 # deb-src http://archive.canonical.com/ubuntu maverick partner 〜〜省略〜〜
反映
$ sudo aptitude update
Sun Java6インストール
$ sudo aptitude install sun-java6-jdk
Javaの変更
このままではOpenJDKが使われるままなので、Sun Javaに変更します。
$ java -version java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1) OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
変更します。2キーのあとEnterキー。
$ sudo update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java). 選択肢 パス 優先度 状態 ------------------------------------------------------------ * 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 自動モード 1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 手動モード 2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 手動モード 現在の選択 [*] を保持するには Enter、さもなければ選択肢の番号のキーを押してください: 2 update-alternatives: /usr/bin/java (java) を提供するために 手動モード で /usr/lib/jvm/java-6-sun/jre/bin/java を使います。
確認します。
$ java -version java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b07) Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
Sun Javaになっています。
参考URL
- UbuntuにSun社のJavaをインストールする。 - redtower's memo
- Aptana | Getting Started
- Aptana3のスタートガイド。
PostgreSQLを使ったRails3の新規作成
環境
手順
必要なgemをインストール
$ gem install pg Fetching: pg-0.11.0.gem (100%) Building native extensions. This could take a while... Successfully installed pg-0.11.0 1 gem installed
Railsアプリ作成
$ cd /var/www $ rails new test -d postgresql
アプリ用PostgreSQLのユーザ作成
OSのpostgresユーザになって
$ su - postgres
ユーザ作成
$ createuser user1 新しいロールをスーパーユーザとしますか? (y/n) n 新しいロールにデータベース作成権限を与えますか? (y/n) y 新しいロールにロールを作成する権限を与えますか? (y/n) n
パスワード設定
$ psql template1 psql (8.4.8) "help" でヘルプを表示します. template1=# alter user user1 with password '1234'; ALTER ROLE template1=# \q
RailsのDB設定ファイル($RAILS_ROOT/config/database.yml)を修正
$ cd /var/www/test1
1 # PostgreSQL. Versions 7.4 and 8.x are supported. 2 # 3 # Install the pg driver: 4 # gem install pg 5 # On Mac OS X with macports: 6 # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 7 # On Windows: 8 # gem install pg 9 # Choose the win32 build. 10 # Install PostgreSQL and put its /bin directory on your path. 11 development: 12 adapter: postgresql 13 encoding: utf8 14 database: test_development 15 pool: 5 16 username: user1 17 password: 1234 18 19 # Connect on a TCP socket. Omitted by default since the client uses a 20 # domain socket that doesn't need configuration. Windows does not have 21 # domain sockets, so uncomment these lines. 22 #host: localhost 23 #port: 5432 24 25 # Schema search path. The server defaults to $user,public 26 #schema_search_path: myapp,sharedapp,public 27 28 # Minimum log levels, in increasing order: 29 # debug5, debug4, debug3, debug2, debug1, 30 # log, notice, warning, error, fatal, and panic 31 # The server defaults to notice. 32 #min_messages: warning 33 34 # Warning: The database defined as "test" will be erased and 35 # re-generated from your development database when you run "rake". 36 # Do not set this db to the same as development or production. 37 test: 38 adapter: postgresql 39 encoding: utf8 40 database: test_test 41 pool: 5 42 username: user1 43 password: 1234 44 45 production: 46 adapter: postgresql 47 encoding: utf8 48 database: test_production 49 pool: 5 50 username: user1 51 password: 1234
/etc/postgresql/8.4/main/pg_hba.conf修正
$ sudo vim /etc/postgresql/8.4/main/pg_hba.conf
〜〜省略〜〜 68 # DO NOT DISABLE! 69 # If you change this first entry you will need to make sure that the 70 # database 71 # super user can access the database using some other method. 72 # Noninteractive 73 # access to all databases is required during automatic maintenance 74 # (custom daily cronjobs, replication, and similar tasks). 75 # 76 # Database administrative login by UNIX sockets 77 local all postgres ident 78 79 # TYPE DATABASE USER CIDR-ADDRESS METHOD 80 81 # "local" is for Unix domain socket connections only 82 # local all all ident 83 local all all password 84 # IPv4 local connections: 85 host all all 127.0.0.1/32 md5 86 # IPv6 local connections: 87 host all all ::1/128 md5
確認
おしまい。
参考URL
VMware Playerで起動しているゲストOSのIPアドレスを固定にする
ホストOS側(Windows7)で休止状態などから復帰したときに、VMware Playerで動かしているゲストOS(Ubuntu10.10)のIPアドレスが毎回変わってしまうので固定にします。
環境
ホストOS
ゲストOS
Ubuntu10.10
ネットワーク接続
手順
ゲストOS側でネットワーク接続状況を確認
$ sudo ifconfig
[sudo] password for atsm:
eth0 Link encap:イーサネット ハードウェアアドレス 00:0c:29:30:16:23
inetアドレス:192.168.31.132 ブロードキャスト:192.168.31.255 マスク:255.255.255.0
inet6アドレス: fe80::20c:29ff:fe30:1623/64 範囲:リンク
UP BROADCAST RUNNING MULTICAST MTU:1500 メトリック:1
RXパケット:37615 エラー:0 損失:0 オーバラン:0 フレーム:0
TXパケット:29639 エラー:0 損失:0 オーバラン:0 キャリア:0
衝突(Collisions):0 TXキュー長:1000
RXバイト:36588641 (36.5 MB) TXバイト:4473836 (4.4 MB)
割り込み:19 ベースアドレス:0x2000
lo Link encap:ローカルループバック
inetアドレス:127.0.0.1 マスク:255.0.0.0
inet6アドレス: ::1/128 範囲:ホスト
UP LOOPBACK RUNNING MTU:16436 メトリック:1
RXパケット:1007 エラー:0 損失:0 オーバラン:0 フレーム:0
TXパケット:1007 エラー:0 損失:0 オーバラン:0 キャリア:0
衝突(Collisions):0 TXキュー長:0
RXバイト:182190 (182.1 KB) TXバイト:182190 (182.1 KB)
$ sudo route カーネルIP経路テーブル 受信先サイト ゲートウェイ ネットマスク フラグ Metric Ref 使用数 インタフェース 192.168.31.0 * 255.255.255.0 U 1 0 0 eth0 default 192.168.31.2 0.0.0.0 UG 0 0 0 eth0
/etc/network/interfaces編集
$ sudo cp -p /etc/network/interfaces /etc/network/interfaces.bak
編集
$ sudo vim /etc/network/interfaces
から
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.31.132 network 192.168.31.0 netmask 255.255.255.0 broadcast 192.168.31.255 gateway 192.168.31.2
という感じで保存します。
ネットワークを再起動
$ sudo /etc/init.d/networking restart
* Reconfiguring network interfaces... ssh stop/waiting
ssh start/running, process 3103
[ OK ]
おしまい。
