1日ひとつだけ強くなる

おべんきょうのーと

研究室生活が始まった。

はじめに

新学期の季節がやってきた。今日は午前中からMTG、午後は割り当てられた研究室のPCにLubuntu 16.10を導入した。前日の深夜3時くらいまでラボのメンバーのツイッター垢をReconしてたら寝不足になった。環境構築の手順をまとめる丁度いい機会なので、メモを取りながら導入したものを公開する。

機体の紹介

古そうなやつだった。NECのMateシリーズかな??図書館とかにありそうな感じ。 スペックのメモ取るの忘れたけど、デザインが古いだけで別に悪くない。

f:id:hal0taso:20170403221617p:plain

画像検索してみた。そうそうこんな感じ。

最初にまとめ

インストーラの作成

isoイメージはここから

lubuntu | lightweight, fast, easier

書き込み

hal0taso.hateblo.jp

インストール

インストールするだけ。sda,sdbの2つのHDDが存在したので、sdaにインストール

sdbの初期化

sdbがもう一つのHDDなのはまぁdmesgとか使えばわかる。まずは現在のパーティションの確認から。

$ sudo fdisk -l
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x76260085

Device     Boot    Start       End   Sectors   Size Id Type
/dev/sdb1  *        2048  16779263  16777216     8G 27 Hidden NTFS WinRE
/dev/sdb2       16779264 976764927 959985664 457.8G  7 HPFS/NTFS/exFAT

sdb1sdb2の2つのパーティションが存在することがわかり、これを一旦消去する。

$ sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.28.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x76260085

Device     Boot    Start       End   Sectors   Size Id Type
/dev/sdb1  *        2048  16779263  16777216     8G 27 Hidden NTFS WinRE
/dev/sdb2       16779264 976764927 959985664 457.8G  7 HPFS/NTFS/exFAT

Command (m for help): d
Partition number (1,2, default 2): 

Partition 2 has been deleted.

Command (m for help): p
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x76260085

Device     Boot Start      End  Sectors Size Id Type
/dev/sdb1  *     2048 16779263 16777216   8G 27 Hidden NTFS WinRE

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

新しい領域を確保する。

$ sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.28.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x76260085

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):  
First sector (2048-976773167, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-976773167, default 976773167): 

Created a new partition 1 of type 'Linux' and of size 465.8 GiB.

Command (m for help): p
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x76260085

Device     Boot Start       End   Sectors   Size Id Type
/dev/sdb1        2048 976773167 976771120 465.8G 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

OS の非同期書き込みを考慮して、念のためもう一度 sync させておく。

$ sync

できた。一応確認する。

$ sudo fdisk -l
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x76260085

Device     Boot Start       End   Sectors   Size Id Type
/dev/sdb1        2048 976773167 976771120 465.8G 83 Linux

ubuntuのデフォルトのファイルシステムext4だったので、sdb1のfsも変更

$ sudo mkfs.ext4 /dev/sdb1
mke2fs 1.43.3 (04-Sep-2016)
/dev/sdb1 contains a ntfs file system labelled 'Windows RE'
Proceed anyway? (y,n) y
Creating filesystem with 122096390 4k blocks and 30531584 inodes
Filesystem UUID: b00fa6cd-6146-4204-80c6-60ec7e2bdf0a
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
    102400000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done     

マウントポイントを作成し、そこに/dev/sdb1のHDDをマウントする。

$ sudo mkdir /mnt/sdb
$ sudo mount /dev/sdb1 /mnt/sdb

最後にマウントできているかどうかの確認。

$ mount | grep sdb1
/dev/sdb1 on /mnt/sdb type ext4 (rw,relatime,data=ordered)

Caps LockをCtrlに置換

$ sudo nano /etc/default/keyboard

XKBOPTIONSを以下のように変更

# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="jp"
XKBVARIANT=""
XKBOPTIONS="ctrl:nocaps" 
BACKSPACE="guess"

再起動する

$ sudo reboot

アップデート

$ sudo apt update
$ sudo apt upgrade

テキストエディタ

テキストエディタにはemacsを使っている。25.1をインストール。

$ sudo add-apt-repository ppa:kelleyk/emacs
$ sudo apt install emacs25
$ emacs --version

feh, urxvt, ranger, xmonad

$ sudo apt install rxvt-unicode-256color feh ranger caca-utils highlight atool w3m poppler-utils mediainfo xmonad

xmonad入れたけど使いこなせる自信がなさすぎる

日本語入力

$ sudo apt install fctx-mozc

まず、System Settings - Language Support - Keyboard input method system: fcitxを選択。初回起動時には”The language support is not installed completely” と表示されるので、Install を選択しておく。

一度Logout。再Login後、Application - Fcitx Configuration - Input Method Configuration - Input Methodから、Onlu Show Current Languageのチェックボックスを外し、Japanese - MozcをCurrent Input Method に追加。

Global Config - Hotkey - Trigger Input Method から切り替える時のホットキーの設定をして完了。

NASを使う

弊ラボのNASはsambaを使用しているらしい。

$ sudo apt install cifs-utils
$ sudo mkdir /mnt/nas
$ sudo mount.cifs //<NAS's IP Address>/share /mnt/nas/ -o password=XXXX

ついでに最初にフォーマットしてマウントしたsdbと一緒に、再起動時にマウントされるよう、/etc/fstabに記述しておく。

$ sudo nano /etc/fstab
# LAB
//<NAS's IP Address>/share /mnt/nas/ username=XXXX, password=YYYY 0 0

# sdb
/dev/sdb1 /mnt/sdb ext4 defaults 0 0

参考

hddのフォーマットについて Linux CentOS 外付けHDDのフォーマットとマウント

fsまとめ Linuxファイルシステムをまとめてみました - Qiita

感想

今日はこれで半日、というか1日が終わった。xmonadも使いこなせていないし、この機会にzshデビューしたい。環境がだんだん古くなって互換が効かなくなっている部分があり、なんとかしないとという気持ち。

早く基礎的な知識をつけて、論文とか読んでいきたい気持ちだ〜〜〜〜。つよいオタクになりたい。

研究室の雰囲気も賑やかで好きな感じですし、今年度は社会性を保ったまま平穏な日々を過ごせそうです。

とりあえず続きをやるとしたら明日以降になる。