Linode へインストールした Ubuntu の設定
以下は僕が最初にやった作業の記録です。参考までに。
SSH ログイン
手元のマシンから、SSH で接続します。Ubuntu なのに root アカウントが有効になっています。パスワードはインストール時に入力したものが設定されています。
$ ssh root@サーバーのIP ...途中省略... root@li6-97:~#
パッケージのアップデート
root@li6-97:~# apt-get update root@li6-97:~# apt-get upgrade
ubuntu-standard をインストール
最初はほとんど何もインストールされていないので、まずは ubuntu-standard を入れときました。
root@li6-97:~# apt-get install ubuntu-standard Reading package lists... Done Building dependency tree... Done The following extra packages will be installed: ...途中省略... Do you want to continue [Y/n]? y ...途中省略...
vim をインストール
vim 使いなので。。。
root@li6-97:~# apt-get install vim-full
update-alternatives
エディターを nano から vim に変更します。
root@li6-97:~# update-alternatives --all
language-pack のインストール
root@li6-97:~# apt-get install language-pack-en root@li6-97:~# apt-get install language-pack-ja
locales の設定
ja_JP.UTF-8に設定すると、表示が日本語になります。
root@li6-97:~# dpkg-reconfigure locales root@li6-97:~# update-locale LANG=ja_JP.UTF-8
タイムゾーンの設定
Asia/Tokyoに設定して、日本時間を表示するようにします。
root@li6-97:~# dpkg-reconfigure tzdata
sysv-rc-conf のインストール
ランレベルによって起動するサービスを設定するコマンドで、RedHat 系でいうところの chkconfig です。
root@li6-97:~# apt-get install sysv-rc-conf
admin グループ追加
admin グループのユーザーだけが sudo できるようにしたいと思います。
root@li6-97:~# groupadd admin
ユーザー登録
root@li6-97:~# adduser ユーザー名 root@li6-97:~# usermod -g admin ユーザ名
sudo の設定
root@li6-97:~# visudo # /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # See the man page for details on how to write a sudoers file. # Defaults env_reset # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL) ALL # Uncomment to allow members of group sudo to not need a password # (Note that later entries override this, so you might need to move # it further down) # %sudo ALL=NOPASSWD: ALL %admin ALL=(ALL) ALL <<<<<<<<<< 追加
root ユーザーの ssh ログインを無効にする
root@li6-97:~# vim /etc/ssh/sshd_config # Authentication: LoginGraceTime 120 #PermitRootLogin yes PermitRootLogin no <<<<<<<<<< 変更 StrictModes yes
root ユーザーを無効にする
必要に応じて sudo するようにしたいので、root ユーザーを無効にします。
root@li6-97:~# usermod -L root
root ユーザーを有効に戻したいとき
root@li6-97:~# usermod -U root
Linode サーバーがリブートしていた へ続く...