Ubuntu Linux 20.04

About this article

This article is a personal note about Ubuntu Linux 20.04. Since I use Ubuntu on my personal computer, I make a note of software installation records. I have published a memo because I think it will be useful for people who use Linux besides me. In addition, I installed the Japanese Remix version distributed by the Japanese Team. This is recommended because it is set to give priority to Japanese.

Hardware configuration

Create user

Create a dummy user at the time of installation, and add user hirayama later. Because I want to use the user ID and groove ID of hirayama as the values I have used so far. However, it seems that the user ID and groove ID cannot be changed with the GUI tool, so I changed them using the vipw and vigr commands.

Keep the dummy user account after installation. Since ubuntu is designed so that you do not log in as root, you can log in as a dummy user when hirayama cannot log in due to some mistake.

The page that was referred to during installation

What is written in this is basically omitted in this article.

-Settings to be performed immediately after installing Ubuntu 20.04 LTS & software to be installed -Summary of what you want to do immediately after installing Ubuntu 20.04 LTS

Japanese directory to English

A directory with Japanese names such as desktop and download is created in the home directory. The Japanese directory is often inconvenient, so keep it in the English directory. The command is as follows.

$ LANG=C xdg-user-dirs-gtk-update

If there are files in the directory, the original directory will remain, so it's a good idea to do it early.

Basic tools

Install basic tools that are useful for setting up early.

Basic commands

Settings related apps

Set a fixed IP address.

Make sure that the contents of / etc / hostname are snowdorp.

Since the unpleasant IP address of is written in / etc / hosts, here,             snowdrop   snowdrop.sao.kono

I made it.

IPv6-related settings were also written in / etc / hosts, but I left them untouched.

Next, set the network from the GUI. "Settings"-> "Network"-> "Ethernet" gear icon-> "IPv4-"-> "Manual"

--Address: --Netmask: --Gateway: --DNS server:

Since IPv6 is not used, "IPv6 setting" is set to "disabled".

Next, I want to edit /etc/resolv.conf, but now it seems that this file should not be edited directly. The one to edit is /etc/systemd/resolved.conf.

$ diff resolved.conf.20200817 resolved.conf
< #DNS=
> DNS=
< #Domains=
> Domains=sao.kono

After rebooting (sudo systemctl restart systemd-resolved) and looking at /etc/resolv.conf, search sao.kono was set. nameserver is strange, but I don't care about it because DNS is set properly from the network setting tool of GUI. (It seems that this is not the file where the setting result of the GUI network setting tool is written.)

/etc/hosts.allow, /etc/hosts.deny

The settings in /etc/hosts.allow look like this. Only the minimum required access from the machine is allowed.


The settings in /etc/hosts.deny look like this. In principle, it is inaccessible.



Since it may or may not be sshed, include a metapackage called ssh.

Just in case, look at the config file / etc / ssh / sshd_config and make sure that PermitRootLogin (login as root) is restricted.


Install the autofs package. /etc/auto.master is a configuration file, but /etc/auto.net is a script.

 $ sudo mkdir /net

I made a mount point net with.

In /etc/auto.master, I added a line of / net (below) as described in the reference example and restarted (sudo service autofs restart).

 /net    -hosts

If you access by computer name / directory name from under / net, the exported directory will be mounted automatically. There is no need to rewrite / etc / fstab etc. Thank you for your convenience.


Install the stable version PPA of the web browser Opera by adding it to the repository. I'm an Opera sect.

Add Opera key

wget -qO- https://deb.opera.com/archive.key | sudo apt-key add -

Add Opera's stable PPA to repository

sudo add-apt-repository "deb [arch=i386,amd64] https://deb.opera.com/opera-stable/ stable non-free"


sudo apt install opera-stable

Japanese input

Since I installed the Japanese Remix version, I can input Japanese itself. You can switch Japanese input on and off with the half-width and full-width keys. The infamous Ctrl + Space on / off Japanese input is also disabled by default.

Register Mozc PPA

As of August 2020, there are no updates for Focal yet. Eventually, ppa: japanese-testers / mozc will be registered.


I put the following packages. As a version, Emacs26 is included.

Disable XIM in Emacs

On Emacs, I want to use mozc.el instead of iBus via XIM, so set to ignore XIM. To $ HOME / .Xresources

!Disable XIM
Emacs*useXIM: false

And it is sufficient.

emacs-mozc settings

If you put the following settings in ~ / .emacs.d / init.el, you can use it at least.

(require 'mozc)
(setq default-input-method "japanese-mozc")

In addition, (set-language-environment" Japanese "), which is often written on other sites, does not need to be set, or should not be set. If this is set, the Japanese file name will be garbled for some reason.

By default, Japanese input is turned on and off with C- , but if you want to switch Japanese input with the half-width / full-width keys, please set the following.

(global-set-key [zenkaku-hankaku] 'toggle-input-method)
(add-hook 'mozc-mode-hook
	    (define-key mozc-mode-map [zenkaku-hankaku] 'toggle-input-method)))

To explain a little, global-set-key allows you to turn on Mozc mode with half-width / full-width keys. On the other hand, when mozc.el enters mozc-mode, it steals the event of half-width and full-width keys, so simply pressing that key globally-set-key does not work to switch off Japanese input. It is also necessary to change the key binding of mozc-mode-map.

Reference URL for the matter:

A trick that is a little more convenient is to make the cursor red when inputting Japanese. This is recommended because you can judge whether you are in Mozc mode or not by the color of the cursor without moving your line of sight to the mode line.

(defun th:check-mozc-and-set-cursor-color ()
  (if mozc-mode
      (set-cursor-color "red")
      (set-cursor-color "black")))
(add-hook 'input-method-activate-hook 'th:check-mozc-and-set-cursor-color)
(add-hook 'input-method-inactivate-hook 'th:check-mozc-and-set-cursor-color)
(run-at-time t 3 ;; repeat in every 3 seconds.

To explain a little, the two add-hooks are settings to change the color of the cursor when Mozc is turned on and off. run-at-time is just in case. I make sure that the cursor color is correct even when the hook does not pass through. With this, for example, if you are using multiple windows in Emacs and you move the cursor between buffers that are in Mozc mode ON and buffers that are OFF, the color of the cursor will change. The check is repeated every 3 seconds, but the value of 3 seconds is decided appropriately and has no deep meaning.

After that, if you want to input kana, please see below. You can get a long sound with the \ key. (Fixed that it becomes "ro" by default)

(mozc-keymap-remove-entry mozc-keymap-kana-106jp ?\\)
(mozc-keymap-put-entry mozc-keymap-kana-106jp ?\\ "\u30fc")


I want to use the latest stable version rather than the standard package, so I decided to install it in a stray manner. http://www.mew.org/ja/git/ I installed it by the method described in. Specifically, I created a working directory and did the following.

% git clone git://github.com/kazu-yamamoto/Mew.git
% cd Mew
% git pull
% make distclean
% ./configure
% make
% sudo make info
% sudo make jinfo
% sudo make install
% sudo make install-jinfo

It's also my personal preference, but I don't think the .elc file is needed anymore in modern times (it would be a hindrance to tuning), so I deleted the .elc file manually.

% cd /usr/local/share/emacs/site-lisp/mew
% sudo rm *.elc

Additional installed packages

--stunnel4 (for secure POP)

Search email body with Mew HyperEstraier

As a basic function of Mew, you can search emails by grep, but the search target is limited to header fields such as Subject and To, and you cannot search the email body. To search the email body, use the extension Hyper Estraier. (Do not use mg because the story "If you want to do a full-text search in Japanese, install" mg "" in the Mew manual is old.) For Ubuntu, if you install the hyperestraier package, it depends. It was supposed to contain everything, but this package wasn't available after 16.04 (Xenial). After that, there is no choice but to install stray by yourself. It's old software, so it seems that there are no more people to maintain it.

Stray installation of Hyper Estraier

Hyper Estraier is a powerful full-text search engine.

HyperEstraier official website According to it, it depends on the following libraries, so you need to install them in advance.

--libiconv: Character code conversion. Version 1.9.1 or later (also included with glibc). --zlib: Reversible data compression. Version 1.2.1 or later. --QDBM: Embedded database. Version 1.8.75 or later.

Guessing the package name for Ubuntu

--libiconv seems to be in glibc, so the package name for Ubuntu is libc6-dev --The package name for zlib for Ubuntu is zlib1g-dev --QDBM's Ubuntu package name is libqdbm-dev

It seems that you should install around.

Get the source tar file (hyperestraier-1.4.13.tar.gz) from the above official website, unpack it, and install it in the stray.

make check
sudo make install

Installation complete

Use Hyper Estraier from Mew

Before searching for the first time, execute the mewest command to create a search index. There is no particular setting on the Mew side. Because the Mew manual says, "The initial value of the search engine is automatically set to the first available one found." Since the search index is not updated automatically, we will execute the mewest command every hour with cron with user privileges. The search method is in the Mew manual, but the one I often use is below.

--"C -uk /": Specify a folder and search for mail in it. --"K /": Search all emails.

When I tried it, I was able to search not only ISO-2022-JP plain text emails, but also Base64-encoded UTF8 emails and quoted-printable emails. Moreover, the search is fast. From the more than 100,000 emails I have, I can feel the search results quickly. great.

+ Search trash folder

What I noticed after using it for a while. I can't search for emails in the + trash folder. I thought it was weird, and when I looked at the mewest script, trash was excluded when indexing for search. I also want the + trash folder to be searched, so I rewrote mewest to handle it. I glance at the business emails that come in every day, throw in things that seem to be unrelated to me into the + trash folder, and search for them later if I need them. I also want to search the + trash folder.

mewest change: I decided to exclude spam instead of trash.

--- mewest.org	2020-08-17 15:13:52.094120192 +0900
+++ mewest	2020-08-17 15:16:25.266332983 +0900
@@ -160,7 +160,7 @@
 # "[0-9]*" matches both "123" and "234.mew".
 ${FIND} "`path_conv \"${TGTDIR}\"`" \
-  -type d -name "trash" -prune -o \
+  -type d -name "spam" -prune -o \
   -type d -name ${INDEXDIR_ORG} -prune -o \
   -type d -name ${INDEXDIR_REPLICA} -prune -o \
   -type f \( -name "[0-9]" -o -name "[0-9]*[0-9]" -o -name "[0-9]*${SUFFIX}" \) -print |\

Mew dialogue

Mew has a function called dialogue. To use this, install the following package.

The command to create an interactive index is cmew. Since the interactive index is not updated automatically, I will execute the cmew command every hour with user-privileged cron.

Recommended Posts

Ubuntu Linux 20.04
linux (ubuntu) memo
Ubuntu / Linux laptop WiFi issues
linux memorandum
Linux commands
Linux commands
Linux Web server construction (Ubuntu & Apache)
Linux command # 3
Linux overview
direnv (linux)
linux commands
Linux practice
Linux Summary
Linux process
How to install MBDyn (Linux Ubuntu)
Linux permissions
Linux command # 5
About Linux
Linux basics
Forgot linux
About Linux
ubuntu codename
Linux commands
Linux commands
Extend virtual box + Linux (Ubuntu 19.04) disk
About Linux
About Linux
About Linux ①
Ubuntu best
Linux file server construction (Ubuntu & Samba)
Linux redirect
I put Linux (Ubuntu) in VAIO SX14.
Run bootgen on Debian GNU / Linux, Ubuntu
How to install php7.4 on Linux (Ubuntu)
On Ubuntu Linux, set Tab to q
What to do after installing Linux (Ubuntu)
Compiling the Linux kernel (Linux 5.x on Ubuntu 20.04)
Linux command list
[Linux] About export
[Linux] Symbolic link
Cool Ubuntu terminal
linux at command
Linux environment construction
Network Linux commands
[Linux] Search command
Linux x memo
Linux directory structure
Linux command <Basic 2>
Verbalize Linux commands
Why use linux
Linux (CentOS) construction
Shebang on Ubuntu 20.04
Linux memorandum [links]
What is Linux
Linux study notes
Linux interprocess communication
[Linux] Proxy application
Linux [directory command]
Linux directory structure