とりあえずUbuntuを再インストールしただけなので、いろいろと設定をしていく。
同じ Ubuntu なので概ね一緒とは思うが、バージョンをあげているので、確認しながら進めていく。
1.root のパスワード
$ sudo su - # passwd Enter new UNIX password: (新パスワード) Retype new UNIX password: (新パスワードをもう一回) passwd: password updated successfully
2.パッケージの最新化
$ sudo apt update $ sudo apt upgrade
3.SSH関係の設定
*サーバー側の作業
$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa): Created directory '/home/ubuntu/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/ubuntu/.ssh/id_rsa. Your public key has been saved in /home/ubuntu/.ssh/id_rsa.pub. The key fingerprint is: (以下略) $ mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys $ chmod 600 ~/.ssh/authorized_keys
*Mac側の作業
$ scp ubuntu@192.168.xxx.xxx:/home/ubuntu/.ssh/id_rsa ~/.ssh/ $ ssh 192.168.xxx.xxx Enter passphrase for key '/Users/ubuntu/.ssh/id_rsa': (中略) ubuntu@hostname:~$
4.時刻同期の設定
$ sudo apt-get install chrony $ sudo vi /etc/chrony/chrony.conf ==== # About using servers from the NTP Pool Project in general see (LP: #104525). # Approved by Ubuntu Technical Board on 2011-02-08. # See http://www.pool.ntp.org/join.html for more information. #pool ntp.ubuntu.com iburst maxsources 4 #pool 0.ubuntu.pool.ntp.org iburst maxsources 1 #pool 1.ubuntu.pool.ntp.org iburst maxsources 1 #pool 2.ubuntu.pool.ntp.org iburst maxsources 2 server ntp.nict.jp iburst server ntp1.jst.mfeed.ad.jp iburst server ntp2.jst.mfeed.ad.jp iburst ==== $ sudo systemctl restart chrony $ chronyc sources
5.sambaのインストールと初期設定
# apt-get install samba # vi /etc/samba/smb.conf ==== [global] unix extensions = no # samba側かMac側かは不明だが、これをつけないと Mac > Ubuntu 方向の書き込みができない (略) interfaces = 127.0.0.0/8 192.168.3.0/24 eth0 # 実際のネットワークに合わせて設定変更 (略) bind interfaces only = yes # コメント解除 (略) [Share] path = /path/to/share writable = yes create mode = 0777 directory mode = 0777 guest ok = no valid users = @group #許可するグループ名 ==== # smbpasswd -a ubuntu New SMB password: Retype new SMB password: Added user ubuntu. # systemctl restart smbd
6.Dockerのインストールと初期設定
基本的には、過去の記事の手順に沿ったが、dockerのパッケージ名が変わっていたようだった。
$ sudo apt install curl # デスクトップの最小インストールではcurlは入ってなかった。 $ sudo apt install -y apt-transport-https gnupg-agent $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - OK $ sudo apt-get install docker.io $ sudo docker run hello-world $ cat /etc/group | grep docker docker:x:999: $ sudo gpasswd -a ubuntu docker # ubuntu は一般ユーザー名 $ cat /etc/group | grep docker docker:x:999:ubuntu # 追加されたのを確認 (一旦、ターミナルからログアウトし、再ログイン) $ docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:92695bc579f31df7a63da6922075d0666e565ceccad16b59c3374d2cf4e8e50e Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. (以下略) $ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose $ sudo chmod +x /usr/local/bin/docker-compose $ docker-compose --version docker-compose version 1.24.0, build 0aa59064
7.アンチウイルスソフトインストール
$ sudo apt -y install clamav $ sudo sed -i -e "s/^NotifyClamd/#NotifyClamd/g" /etc/clamav/freshclam.conf $ sudo systemctl stop clamav-freshclam $ sudo freshclam $ sudo systemctl start clamav-freshclam $ clamscan --infected --remove --recursive /home $ wget http://www.eicar.org/download/eicar.com # テスト用の無害ウィルス $ clamscan --infected --remove --recursive ./ ./eicar.com: Eicar-Test-Signature FOUND # ウィスル検知 ./eicar.com: Removed. # 削除された