gooブログはじめました!

写真付きで日記や趣味を書くならgooブログ

FreeBSD 12.1 + Redmine 4.1.1

2020-05-04 16:39:00 | ノンジャンル
FreeBSD 64ビット番の最新版、12.1-STABLEに、Redmineの最新版、4.1.1をインストールしたときのメモ。LLVMが10になったために、zlib周りが変わって、インストールできなくなったが、LDのリンクを変えることで成功した。


1. 前提条件
- Redmine
ruby-2.6.5.1
redmine 4.1.1
mysql80-client-8.0.19_2 Multithreaded SQL database (client)
mysql80-server-8.0.19_2 Multithreaded SQL database (server)
Apache/2.4.43
- OS
FreeBSD 12.1-STABLE r360560 GENERIC amd64 1201515 (2020/05/02コンパイル)

2. 作業内容

Step 1 -- Redmineのインストール
本家のサイトを見ると最新版は、4.1.1
これをいれる。
# cd /tmp ; fetch https://www.redmine.org/releases/redmine-4.1.1.tar.gz
# tar xvzf redmine-4.1.1.tar.gz
# mv redmine-4.1.1 /usr/local/www
# cd /usr/local/www
# ln -s redmine-4.1.1 redmine

Step 2 -- Ruby のライブラリのインストール
- 以下は家のマシンに入っているもの。
ruby-2.6.5,1 Object-oriented interpreted scripting language
ruby26-gems-3.0.6 Package management framework for the Ruby language
rubygem-passenger-apache-6.0.4_1 Modules for running Ruby on Rails and Rack applications
rubygem-rack-2.2,2,3 Rack, a Ruby Webserver Interface
rubygem-rake-12.3.3 Ruby Make
rubygem-ruby2ruby-2.4.1 Pure ruby code generator easily from ParseTree's Sexps
rubygem-ruby_parser-3.10.1 Ruby parser written in pure ruby
rubygem-sexp_processor-4.11.0 Generic sexp processing tools
rubygem-rmagick-2.16.0_6 Ruby binding for ImageMagick (*)

(*) ImageMagickは自動的にインスールされる。ただし、バージョンは6。

Step 3 -- Apache の設定 ( /usr/local/etc/apache24/Includes/redmine.conf

#####################################################################
<Directory "/usr/local/www/redmine/public">
Require all granted
</Directory>

########## Ruby 26
LoadModule passenger_module /usr/local/lib/ruby/gems/2.6/gems/passenger-6.0.4/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/lib/ruby/gems/2.6/gems/passenger-6.0.4
PassengerRuby /usr/local/bin/ruby26
</IfModule>
# 必要に応じてPassengerのチューニングのための設定を追加(任意)。
# 詳しくはPhusion Passenger users guide
# (https://www.phusionpassenger.com/library/config/apache/reference/)参照。
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 864000
PassengerStatThrottleRate 10
#####################################################################


Step 4 -- redmineユーザの登録
- adduser のshellの選択でnolgoinを選択する。
# grep redmine /etc/passwd
redmine:*:1003:1003:redmine:/usr/local/www/redmine:/usr/sbin/nologin

Step 5 -- Mysqlを動くようにする
(1) /etc/rc.conf の設定
# sysrc mysql_enable="YES"
mysql_enable: -> YES
# sysrc mysql_optfile="/usr/local/etc/mysql/my.cnf"
mysql_optfile: -> /usr/local/etc/mysql/my.cnf
(2) エラーログファイルの設定
# vi /usr/local/etc/mysql/my.cnf
--> [mysqld]の最後に、エラーログのファイル名を追加
log-error=/var/log/mysqld-error.log

--> "expire_logs_days = 30"の代わりに、
"binlog_expire_logs_seconds=2592000"をいれる。

# touch /var/log/mysqld-error.log
# chown mysql:mysql /var/log/mysqld-error.log
(3) 起動と確認
# service mysql-server start
Starting mysql.
# service mysql-server status
mysql is running as pid 24765. ⇒ 24765はプロセスID
# less /var/log/mysqld-error.log
2020-05-02T15:39:29.6NZ mysqld_safe Logging to '/var/log/mysqld-error.log'.
2020-05-02T15:39:29.6NZ mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
100

Step 6 -- DBにテーブルを作成
# mysql -u root -p
Enter password:

CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY '###';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
QUIT;

上記の"IDENTIFIED BY'の後ろのパスワードを、MY_PWD とする。

Step 7 -- データベースに接続するための設定

/usr/local/www/redmine の下の、config/database.example.yml を
コピーして config/database.yml を作成する。そのファイルを編集
し,"production"環境用のデータベース設定を行う。変更するのは、
★の行。

# cd /usr/local/www/redmine/config
# cp database.example.yml database.yml
# vi database.yml
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine ★
password: MY_PWD ★
encoding: utf8mb4

'development:'以降の行は、全部コメントにする(先頭に'#'をつける)。

Step 8 -- 依存するソフトウェアのインストール

Bundlerをインストールし,以下のコマンドを実行することで
Redmineを実行するために必要な すべてのgemをインストールする。

# gem install bundler
# bundle install

(注) FreeBSD 12.1-STABLE は2020年5月からコンパイラとリンカーシステム
である、LLVMのバージョンが10になった。このバージョンでは、gemの1つである、
nokogiriのインストールの際に以下のエラーが出る。

ld: error: --compress-debug-sections: zlib is not available

エラーが出るバージョンは以下の通り。

% ld --version
LLD 10.0.0 (FreeBSD llvmorg-10.0.0-0-gd32170dbd5b-1200011) (compatible with GNU linkers)

このエラーを避けるためには古いLLVMをインストールする必要が
ある。nokogiriのソースは、毎回ダウンロードされるために、そ
のソースの中に含まれるMakefileを修正して、zlibの行を消そう
としたがうまくいかなかった。nokogiriがきちんとインストール
できるLLVMはV8である。インストールはpkgコマンドを使用する。
その後、ld にシンボリックリンクを張る。もともと、ldは
/usr/bin/ld.lldへのリンクである。

# pkg install llvm80-8.0.1_3
# rm /usr/bin/ld
# ln -s /usr/local/llvm80/bin/ld.lld /usr/bin/ld

Step 9 -- セッションストア秘密鍵の生成

Railsはセッションハイジャックを防ぐために,セッション情報を格
納するcookieをエンコードする。この処理で使われるランダムなキー
を生成する。

# bundle exec rake generate_secret_token

データベース上にテーブルを作成する。これによりテーブルと
Redmineの管理者アカウントが作成される(*)。

# bundle exec rake db:migrate RAILS_ENV=production

下記コマンドを実行し、デフォルトデータをデータベースに登録する。

# bundle exec rake redmine:load_default_data RAILS_ENV=production

コマンドを実行中、どの言語のデフォルトデータを登録するのか
選択を求められます。なお、コマンドラインで REDMINE_LANG 環
境変数を指定すると、言語の選択を求められることなく自動的に
処理が勧められる。

# bundle exec rake redmine:load_default_data RAILS_ENV=production REDMINE_LANG=ja

(*) 以下のエラーが出る場合は、Step 7のユーザ名とパスワードが正しいかを確認すること。
rake aborted!
Mysql2::Error::ConnectionError: Access denied for user
'root'@'localhost' (using password: YES)

Step 10 -- Apache との連携
(1) Ruby側の連携用の設定を行う

# gem install passenger
gem install passenger
Fetching passenger-6.0.4.gem
Building native extensions. This could take a while...
Successfully installed passenger-6.0.4
Parsing documentation for passenger-6.0.4
Installing ri documentation for passenger-6.0.4
Done installing documentation for passenger after 35 seconds
1 gem installed
#

(2) Apache24のモジュールをいれる

# cd /usr/ports/www/rubygem-passenger
# make clean
# make deinstall
# make reinstall


Step 11 -- Apacheの設定ファイルの追加

# Configuration for Radmine

Alias /redmine /usr/local/www/redmine/public
<Location /redmine>
PassengerBaseURI /redmine
PassengerAppRoot /usr/local/www/redmine
</Location>
#################### end of readmine.confroot@ns:/usr/local/www/redmine #


Step 12 -- 作業ディレクトリのパーミッション設定
# cd /usr/local/www
# chown -R redmine:redmine redmine
# cd redmine
# chown -R redmine:redmine files log tmp public/plugin_assets
# chmod -R 755 files log tmp public/plugin_assets
# find . -type f -exec chmod 644 '{}' \;

Step 13 -- 初期ユーザの登録など
(1) ブラウザで http://localhost/redmine/ にアクセスする。
(2) adminの初期パスワードは、adminなのでそれでログインし
てパスワードを変更する。

Step 14 -- Skinの変更


----------------------------------------------
正常なログの記録 ( ) bundle install 開始
----------------------------------------------

# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all
non-root users on this machine.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
The dependency ffi (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 13.0.1
Using concurrent-ruby 1.1.6
Using i18n 1.6.0
Using minitest 5.14.0
Using thread_safe 0.3.6
Using tzinfo 1.2.7
Using activesupport 5.2.4.2
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.9
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Fetching crass 1.0.6
Installing crass 1.0.6
Fetching loofah 2.5.0
Installing loofah 2.5.0
Fetching rails-html-sanitizer 1.3.0
Installing rails-html-sanitizer 1.3.0
Fetching actionview 5.2.4.2
Installing actionview 5.2.4.2
Using rack 2.2.2
Fetching rack-test 1.1.0
Installing rack-test 1.1.0
Fetching actionpack 5.2.4.2
Installing actionpack 5.2.4.2
Fetching nio4r 2.5.2
Installing nio4r 2.5.2 with native extensions
Fetching websocket-extensions 0.1.4
Installing websocket-extensions 0.1.4
Fetching websocket-driver 0.7.1
Installing websocket-driver 0.7.1 with native extensions
Fetching actioncable 5.2.4.2
Installing actioncable 5.2.4.2
Fetching globalid 0.4.2
Installing globalid 0.4.2
Fetching activejob 5.2.4.2
Installing activejob 5.2.4.2
Fetching mini_mime 1.0.2
Installing mini_mime 1.0.2
Fetching mail 2.7.1
Installing mail 2.7.1
Fetching actionmailer 5.2.4.2
Installing actionmailer 5.2.4.2
Fetching method_source 1.0.0
Installing method_source 1.0.0
Fetching thor 1.0.1
Installing thor 1.0.1
Fetching railties 5.2.4.2
Installing railties 5.2.4.2
Fetching actionpack-xml_parser 2.0.1
Installing actionpack-xml_parser 2.0.1
Fetching activemodel 5.2.4.2
Installing activemodel 5.2.4.2
Fetching arel 9.0.0
Installing arel 9.0.0
Fetching activerecord 5.2.4.2
Installing activerecord 5.2.4.2
Fetching mimemagic 0.3.4
Installing mimemagic 0.3.4
Fetching marcel 0.3.3
Installing marcel 0.3.3
Fetching activestorage 5.2.4.2
Installing activestorage 5.2.4.2
Fetching public_suffix 4.0.4
Installing public_suffix 4.0.4
Fetching addressable 2.7.0
Installing addressable 2.7.0
Using bundler 2.1.4
Fetching css_parser 1.7.1
Installing css_parser 1.7.1
Fetching csv 3.1.2
Installing csv 3.1.2
Fetching htmlentities 4.3.4
Installing htmlentities 4.3.4
Fetching mini_magick 4.9.5
Installing mini_magick 4.9.5
Fetching mysql2 0.5.3
Installing mysql2 0.5.3 with native extensions
Fetching net-ldap 0.16.2
Installing net-ldap 0.16.2
Fetching ruby-openid 2.9.2
Installing ruby-openid 2.9.2
Fetching rack-openid 1.4.2
Installing rack-openid 1.4.2
Fetching sprockets 4.0.0
Installing sprockets 4.0.0
Fetching sprockets-rails 3.2.1
Installing sprockets-rails 3.2.1
Fetching rails 5.2.4.2
Installing rails 5.2.4.2
Fetching rbpdf-font 1.19.1
Installing rbpdf-font 1.19.1
Fetching rbpdf 1.20.1
Installing rbpdf 1.20.1
Fetching redcarpet 3.5.0
Installing redcarpet 3.5.0 with native extensions
Fetching request_store 1.4.1
Installing request_store 1.4.1
Fetching roadie 4.0.0
Installing roadie 4.0.0
Fetching roadie-rails 2.1.1
Installing roadie-rails 2.1.1
Fetching rouge 3.12.0
Installing rouge 3.12.0
Bundle complete! 31 Gemfile dependencies, 59 gems now installed.
Gems in the groups development, test, postgresql and sqlite were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
#

----------------------------------------------
正常なログの記録 ( ) bundle install 終了
----------------------------------------------

------------------------
番外編
------------------------
1. MySQL8の初期化してrootのパスワードを変更するまでの手順
1.1 データ初期化
・サービスを止める(念のためプロセスを殺して、ソケット用のファイルも削除、ログファイルを初期化)
・MySQLの初期化コマンドを実行しrootの初期パスワードを表示する。
・サービスを起動する。

# service mysql-server stop ; killall mysql ; rm -f /tmp/mysql* ; rm -rf /var/db/mysql/* ; cp /dev/null /var/log/mysqld-error.log ; /usr/local/libexec/mysqld --initialize --user=mysql ; tail -5 /var/log/mysqld-error.log ; service mysql-server start

mysql not running? (check /var/db/mysql/tkmtbsd.pid).
No matching processes were found
rm: No match.
100 200
100
mysqld: Error on delete of './auto.cnf' (OS errno 2 - No such file or directory)
2020-05-04T02:25:59.865974Z 0 [Warning] [MY-010107] [Server] World-writable config file './auto.cnf' has been removed.
2020-05-04T02:26:00.262127Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: &_*(&b?+:8jY
Starting mysql.

1.2 root のパスワードの変更
・set password を使う

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.19

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> set password = 'hikari';
Query OK, 0 rows affected (0.01 sec)

root@localhost [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

root@localhost [(none)]> quit;
Bye

1.3 確認のためにパスワードのフィールドを検索する
# sync
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.19 Source distribution

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> use mysql;
Database changed
root@localhost [mysql]> select User,host,authentication_string from user;
+------------------+-----------+------------------------------------------------------------------------+
| User | host | authentication_string |
+------------------+-----------+------------------------------------------------------------------------+
| mysql.infoschema | localhost | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.session | localhost | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.sys | localhost | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| root | localhost | $A$005$5q:~hE1%jmZ~%Ecbwdj7yv5lw2bkJZLd7GwdCIccqeXz/2in4w4sp1/rD |
+------------------+-----------+------------------------------------------------------------------------+
4 rows in set (0.00 sec)

root@localhost [mysql]>

-------------------------------
番外編 2 ld の復帰
-------------------------------

# rm /usr/bin/ld
# ln -s /usr/bin/ld.lld /usr/bin/ld


---------------------------------

FreeBSDのMySQL8の初期化

2020-05-04 09:50:00 | ノンジャンル
どうしようもなくなったので、FreeBSD 12.1 の上のMySQL8のDBを初期化することにした。削除すべきファイルは、my.cnf (/usr/local/etc/mysql/my.cnf )の中に書いているDBのディレクトリのパスにある。その前にMySQLのサービスを止める。

# service mysql-server stop

# grep datadir /usr/local/etc/mysql/my.cnf
datadir = /var/db/mysql
# rm -rf /var/db/mysql/*

MySQLのテンポラリディレクトリなどが存在していることを確認する。なければ、以下のパーミッションで作成する。これがないと次に行かない。

# ls -l /var/db | grep mysql
drwxr-x--- 2 mysql mysql 512 5月 4 10:13 mysql
drwxr-x--- 2 mysql mysql 512 5月 4 10:27 mysql_secure
drwxr-x--- 2 mysql mysql 512 5月 4 10:27 mysql_tmpdir

初期化のコマンドを実行する。FreeBSDの場合、mysqldコマンドが、/usr/local/binの下ではない。

# /usr/local/libexec/mysqld --initialize --user=mysql

実行すると、ファイルができている。

# ls -lR /var/db/mysql
total 0
-rw-r----- 1 mysql mysql 0 5月 4 09:55 mysql-bin.index

ログファイルの最後の行に、rootユーザのパスワードが入っている。# tail -1 /var/log/mysqld-error.log
2020-05-04T01:33:37.875970Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: uunkEf7pA>kX

# service mysql-server start
Starting mysql.

立ち上がっていることをpsコマンドで確認する。

# ps ax |grep mysql
2289 - Is 0:00.03 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/usr/local/etc/mysql/my.cnf --basedir=/usr/local --da
3563 - I 0:00.68 /usr/local/libexec/mysqld --defaults-extra-file=/usr/local/etc/mysql/my.cnf --basedir=/usr/local --datadir=/va
3569 0 S+ 0:00.00 grep mysql

ログインできることを確認する。

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.19 Source distribution

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]>

うまくいったようだ。


FreeBSD 12.1 文字化け

2020-05-03 14:40:00 | パソコン・インターネット

1. 問題
・FreeBSD 12.1-STABLE r360560あたりを入れると、Xorgを起動した後のキーボードを打つとランダムな文字が表示される。表示は同じキーを押しても異なる文字になる。要は文字が無茶苦茶になる。
・いろいろ対処したが、途中段階では、jp106の右端のキーである、「バー」「バックスラッシュ」「アンダーバー」が入力できない問題や、emacsでは、mozcで日本語入力できるが、Mate terminalでは日本語入力に切り替わらないという問題が発生した。
・以下の対処によって、上記のすべての問題は解決している。

2. 現状のバージョン
- X.Org : X Server 1.20.8
- OS : FreeBSD 12.1-STABLE r360560 GENERIC amd64

3. 参考にしたWebサイト
- https://forums.freebsd.org/threads/keyboard-configuration-disaster.74850/
- https://forums.freebsd.org/threads/new-xorg-switch-from-devd-to-udev.74144/page-4

4. 原因と対処の概要
・原因は、FreeBSDが12.1からUDEVに変わったこと。なぜか、12.1-RELEASEp3 は問題ないのだが。。
・対処としては、以下を行う。
- X関係のモジュールのUDEV対応・最新化
- sysctl の設定
- Xの設定ファイルの最新化(UDEV対応)

5. 対処
5.1 Xorg関係のイカをportsから再インストール。
devel/libudev-devd
x11-server/xorg-server
x11/libinput
x11-drivers/xf86-input-libinput
その後、各行に対して以下を実行する。
# cd /usr/ports/上記のディレクトリ
# make clean; make rmconfig ; make ; make deinstall ; make reinstall

5.2 sysctlの設定
kern.evdev.rcpt_maskを初期値の3から12に変更
- file: /etc/sysctl.conf
- 追加行:
kern.evdev.rcpt_mask=12

5.3 Xの設定ファイル
- /etc/X11/xorg.conf.dの下と/usr/local/etc/X/xorg.conf.d/の下に
存在する設定ファイルをマージする。具体的には、前者の下のinput.confは
削除した。後者の下の 99-myinput.conf に内容をマージした。

Section "InputClass"
Identifier "libinput keyboard catchall + jp106x"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "XkbRules" "evdev"
Option "XkbModel" "jp106"
Option "XkbLayout" "jp"
Option "XkbOptions" "ctrl:nocaps"
EndSection
Section "InputClass"
Identifier "libinput touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "MiddleEmulation" "on"
Option "DisableWhileTyping" "off"
EndSection

5.4 念のためのカーネルの確認
上記の設定を有効にするには、kernelがEVDEVをサポートするようになっていないといけない。デフォルトはサポートするようになっている。すなわち、GENERICファイルを編集していなければ問題ない。念のため、カーネルの設定ファイルを確認することを進める。以下の2行があればよい。標準のGENERICは、/usr/src/sys/amd64/confの下にある。削除していた場合は補ってカーネルを再インストールすることが必要。

# evdev interface
options EVDEV_SUPPORT # evdev support in legacy drivers
device evdev # input event device support


6. 再起動
(1) キーボード設定の確認のために、setxkbmapを実行。xkb_keycodesの中に"evdev"が入ればOK。

% setxkbmap -print
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete+japan" };
xkb_symbols { include "pc+jp+inet(evdev)+ctrl(nocaps)" };
xkb_geometry { include "pc(pc104)" };
};

(2) /var/log/Xorg.0.log の確認。
設定ファイルに設定した、キーボードのモデル名がログに入っていることを確認する。
% grep xkb_model /var/log/Xorg.0.log
[ 36.524] (**) Option "xkb_model" "jp106"
[ 36.624] (**) Option "xkb_model" "jp106"
[ 36.625] (**) Option "xkb_model" "jp106"
[ 36.626] (**) Option "xkb_model" "jp106"
[ 36.628] (**) Option "xkb_model" "jp106"

7. 動作確認
(1) Terminalを起動して、CTRL-スペース及び全角/半角キーでmozcが起動することを確認
(2) アンダーバー、バー、バックスラッシュが入ることを確認
(3) emacsを起動して、CTRL-スペースではmozcが起動しないこと、全角/半角キー及びCTRL-バックスラッシュでmozcが起動することを確認

ようやく終わった!