Ubuntu


rootのパスワード設定

以下のコマンドを入力後、パスワードを入力

sudo passwd root

ただし、次のコマンドによりsudoを保持できる。

sudo -s

Ctrlキーの位置

システム設定→国と言語→キーボード配列→Xkbオプション→Ctrlキーの位置 より"CapsLock?をもう一つのCtrlにする"に変更。 しかし、Alt+Shiftを押すとなぜかScrollLock?がかかるという問題が発生する。 そこで、.Xmodmapに以下の内容をかく("xmodmap -pke"でキーコードとかは確認すること)

keycode  50 = Shift_L 
keycode  62 = Shift_R 
keycode  64 = Alt_L
keycode 113 = Alt_R

を記述する。んで、.bashrcに

xmodmap ~/.Xmodmap

と書いておくとOK。ここで、CapsLock?とCtrlを入れ替える設定を書いてもOK.

NFSサーバでファイル共有

以下のパッケージが必要。

sudo apt-get install portmap nfs-common nfs-kernel-server

その後、/etc/fstab に以下の文を追加。

192.168.80.1:/home/common/sakaida /home/sakaida/iris nfs defaults

emacsのインストール

emacs-env-ja パッケージをインストールすればよい。 Anthyの設定は .emacs に以下のように記述。

;======================================================================
; Anthy
;    CTRL-\で入力モード切替え
;======================================================================
(load-library "anthy")
(setq default-input-method "japanese-anthy")

emacsのフォント

shinonomeフォントを使用する。apt-get でフォントをインストール

apt-get install xfonts-shinonome

インストール後、Xを再起動。そして、.emacs に以下の文を追加

(create-fontset-from-fontset-spec
"-shinonome-gothic-medium-r-normal--14-*-*-*-*-*-fontset-shinonome14")
(set-default-font "fontset-shinonome14")

gnuplot mode

apt-get でインストールし、.emacs に以下の文を追加。

;; these lines enable the use of gnuplot mode
(autoload 'gnuplot-mode "gnuplot" "gnuplot major mode" t)
(autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot mode" t)
;; this line automatically causes all files with the .gp extension to
;; be loaded into gnuplot mode
(setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist))
;; This line binds the function-9 key so that it opens a buffer into
;; gnuplot mode 
;(global-set-key [(f9)] 'gnuplot-make-buffer)

その後、gnuplot.el と gnuplot-gui.el を load-path の通ったディレクトリにコピー。

sudo できるユーザーを追加

admin グループに属するユーザなら誰でもsudoを使えるので、以下の行をコマンドシェルで入力し実行します。

sudo adduser a_username admin

これでそのユーザの追加グループリストにadminグループが追加されます。以後ユーザはsudoにアクセス可能になります。

システムデフォルトのユーザと同様な補助グループには属していないため、Ubuntuのデフォルトユーザとは許可されているオペレーションが制限される。そこで、まず以下のコマンドでシステムデフォルトのユーザーが所属する補助グループを確認する。

sudo id default

'default'はシステムデフォルトのユーザーである。その後、adduser コマンドでグループを追加する。

ユーザID(uid)とプライマリグループID(gid)を変更する

ユーザhoge(uid2000,gid2000)のuidを2001に変更する。 既に存在するユーザのプロパティを変更するにはusermodコマンドを使用する。ただこれだけではGNOMEやKDEが起動できなくなるので注意。

$ id hoge
uid=2000(hoge) gid=2000(hoge) 所属グループ =2000(hoge),4(adm),20(dialout),21(fax), 
24(cdrom),25(floppy),26(tape),29(audio),30(dip),44(video),46(plugdev), 
104(scanner),112(netdev),113(lpadmin),117(admin),119(fuse)
$ sudo groupadd -g 3000 tmpgroup
$ sudo usermod -g 3000 hoge
$ sudo groupdel hoge
$ sudo groupadd -g 2001 hoge
$ sudo usermod -g 2001 hoge
$ sudo groupdel tmpgroup
$ sudo usermod -u 2001 hoge
$ id hoge
uid=2001(hoge) gid=2001(hoge) 所属グループ=2001(hoge),4(adm),20(dialout),21(fax), 
24(cdrom),25(floppy),26(tape),29(audio),30(dip),44(video),46(plugdev), 
104(scanner),112(netdev),113(lpadmin),117(admin),119(fuse)

これでhogeでログインしようとするとGNOMEやKDEが起動できないという状況に陥る場合がある。マシンごと再起動すれば問題はないが、再起動できない状況も考えられる。この現象は、GNOMEやKDEがログインしたユーザごとに、/tmp内に専用ディレクトリを作成して管理しているため、uidや gidを変更したことでパーミッションエラーを起こしていることが原因。usermodコマンドが修正してくれるのは/etc内の各設定ファイルだけなので、その他のファイルは手動でなんとかしなければならない。

 具体的な作業は、該当ユーザ名の入った/tmp以下のファイルやディレクトリを削除すればよい。

DELL PC への Vine Linux のインストール

FAT32 のマウント

/etc/fstab に以下の行を追加(FAT32のパーテションが/dev/sda5の場合)

/dev/sda5 /mnt/data vfat noauto,user,codepage=932,iocharset=euc-jp 0 0

これにより、mount /mnt/data でマウント、umonut /mnt/data でアンマウントできる。


5ボタンマウス

/etc/X11/xorg.conf のマウスの設定部分を以下のように変更

Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"
        Option          "CorePointer"
        Option          "Device"                "/dev/input/mice"
        Option          "Protocol"              "ExplorerPS/2"
        Option          "ZAxisMapping"          "4 5"
        Option          "Emulate3Buttons"       "true"
        Option          "Buttons"               "7"
        Option          "ButtonMapping"         "1 2 3 6 7"
EndSection

なお、各ボタンの返す値はxevにて確認できる。

Ngraph

Ngraphのrpmをダウンロードし、debパッケージに変換

sudo alien file_name.rpm

その後インストール。

sudo dpkg -i file_name.deb

NgraphはGUIのメニューの文字コードがEUC-JPなので、文字化けしてしまう。英語に切り替えて使うため、.bashrcに以下の文を追加。

alias ngraph='LANG="C" ngraph'

auctex

apt-get でインストール。

Vine 4.0 の標準設定では、拡張子が .tex のファイルを emacs で開くとやてふが起動するようになっている。これは、Vine 4.0 の標準の .emacs.el で

(setq auto-mode-alist
      (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))

と書かれているためである。 この設定を上書きしてやれば auctex が動作するようになるので、.emacs.my.el を作成し、

;;; AUCTeX用の設定
;;;(load "auctex.el" nil t t)
(load "tex-site.el" nil t t)
(setq auto-mode-alist
      (cons (cons "\\.tex$" 'japanese-latex-mode) auto-mode-alist))
(setq TeX-default-mode 'japanese-latex-mode)
(setq japanese-TeX-command-default "pTeX")
(setq japanese-LaTeX-command-default "pLaTeX")
(setq japanese-LaTeX-default-style "jsarticle")

と記述。上記の設定で、(load "auctex.el" nil t t) がコメント (;) になっているが、これは、もともとは auctex (現段階で)最新版の ver. 11.84 用の設定をコピーしたため。 Vine 4.0 の auctex は auctex.el を持たないので、ちょっと修正してある。

Firefoxプラグイン

AdobeReader?

以下のコマンドで、Firefoxのプラグインディレクトリにプラグインを追加。

$ cd /usr/lib/firefox-2.0/plugins
$ sudo ln -s /usr/local/Adobe/Acrobat7.0/Browser/intellinux/nppdf.so

OpenOffice?

以下のコマンドで、Firefoxのプラグインディレクトリにプラグインを追加。

$ cd /usr/lib/firefox-2.0/plugins
$ sudo ln -s /usr/lib/openoffice.org2.0/program/libnpsoplugin.so

ホームディレクトリに移動し ~/.mozila/firefox にある pluginreg.dat を以下のように編集(Firefoxは閉じておく)

OpenOffice.org Plug-in handles all its documents:$
OpenOffice.org Plug-in:$
33
0:application/vnd.stardivision.calc:StarCalc 3.0 - 5.0:sdc:$
1:application/vnd.stardivision.chart:StarChart 3.0 - 5.0:sds:$
(中略)
28:application/vnd.oasis.opendocument.presentation-template:OpenDocument Presentation Template:otp:$
29:application/vnd.oasis.opendocument.formula:OpenDocument Formula:odf:$
30:application/msword:Microsoft Word Document:doc:$
31:application/vnd.ms-excel:Microsoft Excel Worksheet:xls:$
32:application/vnd.ms-powerpoint:Microsoft PowerPoint Presentation:ppt:$

DHCPクライアントでIPアドレスを再取得

まず以下のコマンドで、IPアドレスを解放する

/sbin/dhcpcd -k

次にdhcpデーモンを実行

/sbin/dhcpcd -n -H eth0

一応、再起動

/sbin/service network restart

ヒストリー補間を賢くする

通常 ~/.inputrc に

"\C-n":history-search-forward
"\C-p":history-search-backward

と記述するらしいがうまくいかないので、~/.bashrc に以下のように記述

bind '"\C-p": history-search-backward'
bind '"\C-n": history-search-forward'

bash_completionによるTAB補完

Working more productively with bash 2.x/3.x ( http://www.caliban.org/bash/ ) からbash-completion-*.noarch.rpm をダウンロードしてインストールする。

$ su
# rpm -Uvh bash-completion-*.noarch.rpm

そして、.bashrc などに以下を追加

if [ -f /etc/profile.d/bash_completion.sh ]; then
    . /etc/profile.d/bash_completion.sh
fi

emacs で日本語検索

まず、C-s とすると以下のように表示される。

I-search:

その後、C-m とすると、以下のように表示が変わる。

Search:

検索する日本語を入力したら、C-s で検索できる。