実現する機能
CentOSインストール直後は、セキュリティを確保するためにアップデートを速やかに行う必要があります。セキュリティ強化のため、SELinuxを有効にしていますが、使い辛い事はありません。設定の工数が少し多くなるだけですので、心配は無用です。ただ、Windowsライクには使えませんので、マウスを使う機会がありません。画面には文字や数字や記号以外何も表示されないからです。Windowsではやりたいことができない、という方以外にはオススメしないPC活用法です。以下の記述は、備忘録なので、動作保証はありません。悪しからず。
初期設定手順
GNOME端末を使っての初期設定作業
以下の黒背景部分はGNOME端末を表示しています。紫色はキーボードから入力するコマンド(コピペした方が楽ですが、コマンドは覚えられません)、緑はコマンドや処理内容の説明、白は自動表示する部分、赤は注意書きです。
1 CentOSのアップデート
# 別PCからサーバー(例示ではufuso.dip.jp)にrootで接続する場合のみ [tu@ufuso ~]$ sudo ssh root@ufuso.dip.jp [sudo] tu のパスワード: ← ユーザー(例示ではtu)のパスワードを入力(画面 に表示はされない) @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the ECDSA key sent by the remote host is SHA256:g5URH77jmdQLLLSTwm/48HZlxFVKA2a/pMUAPajMoeE. Please contact your system administrator. Add correct host key in /root/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /root/.ssh/known_hosts:1 ECDSA host key for ufuso.dip.jp has changed and you have requested strict checking. Host key verification failed. ← サーバーに接続しているPCの暗号キーが サーバーと合わないので接続できず #上記の解決方法として現在の暗号キーを削除 [tu@ufuso ~]$ sudo rm -fr /root/.ssh/known_hosts #別PCからサーバー(例示ではufuso.dip.jp)にrootで再度接続 [tu@ufuso ~]$ sudo ssh root@ufuso.dip.jp The authenticity of host 'ufuso.dip.jp (192.168.24.241)' can't be established. ECDSA key fingerprint is SHA256:g5URH77jmdQLLLSTwm/48HZlxFVKA2a/pMUAPajMoeE. ECDSA key fingerprint is MD5:61:95:b0:ef:57:10:56:cc:d1:26:bf:ae:74:9b:78:4c. Are you sure you want to continue connecting (yes/no)? yes ← yesと入力 Warning: Permanently added 'ufuso.dip.jp,192.168.24.241' (ECDSA) to the list of known hosts. root@ufuso.dip.jp's password: ← rootのパスワードを入力(画面に表示はされない) Last failed login: Sun Oct 29 20:11:07 JST 2017 from 192.168.24.240 on ssh:notty There was 1 failed login attempt since the last successful login. ← ログイン成功 Last login: Sun Oct 29 19:46:34 2017 #インストール済パッケージの一括アップデート [root@ufuso ~]# yum -y update インストール: grub2.x86_64 1:2.02-0.65.el7.centos.2 grub2-tools.x86_64 1:2.02-0.65.el7.centos.2 grub2-tools-extra.x86_64 1:2.02-0.65.el7.centos.2 grub2-tools-minimal.x86_64 1:2.02-0.65.el7.centos.2 kernel.x86_64 0:3.10.0-693.5.2.el7 kernel-devel.x86_64 0:3.10.0-693.5.2.el7 更新: NetworkManager.x86_64 1:1.8.0-11.el7_4 NetworkManager-libnm.x86_64 1:1.8.0-11.el7_4 NetworkManager-team.x86_64 1:1.8.0-11.el7_4 NetworkManager-tui.x86_64 1:1.8.0-11.el7_4 NetworkManager-wifi.x86_64 1:1.8.0-11.el7_4 bash.x86_64 0:4.2.46-29.el7_4 bind-libs-lite.x86_64 32:9.9.4-51.el7 bind-license.noarch 32:9.9.4-51.el7 binutils.x86_64 0:2.25.1-32.base.el7_4.1 cpio.x86_64 0:2.11-25.el7_4 emacs-filesystem.noarch 1:24.3-20.el7_4 git.x86_64 0:1.8.3.1-12.el7_4 grub2-common.noarch 1:2.02-0.65.el7.centos.2 grub2-pc.x86_64 1:2.02-0.65.el7.centos.2 grub2-pc-modules.noarch 1:2.02-0.65.el7.centos.2 iptables.x86_64 0:1.4.21-18.2.el7_4 kernel-headers.x86_64 0:3.10.0-693.5.2.el7 kernel-tools.x86_64 0:3.10.0-693.5.2.el7 kernel-tools-libs.x86_64 0:3.10.0-693.5.2.el7 kexec-tools.x86_64 0:2.0.14-17.2.el7 kmod.x86_64 0:20-15.el7_4.4 kmod-libs.x86_64 0:20-15.el7_4.4 ncurses.x86_64 0:5.9-14.20130511.el7_4 ncurses-base.noarch 0:5.9-14.20130511.el7_4 ncurses-libs.x86_64 0:5.9-14.20130511.el7_4 nss.x86_64 0:3.28.4-15.el7_4 nss-softokn.x86_64 0:3.28.3-8.el7_4 nss-softokn-freebl.x86_64 0:3.28.3-8.el7_4 nss-sysinit.x86_64 0:3.28.4-15.el7_4 nss-tools.x86_64 0:3.28.4-15.el7_4 openssh.x86_64 0:7.4p1-13.el7_4 openssh-clients.x86_64 0:7.4p1-13.el7_4 openssh-server.x86_64 0:7.4p1-13.el7_4 perl-Git.noarch 0:1.8.3.1-12.el7_4 python-perf.x86_64 0:3.10.0-693.5.2.el7 selinux-policy.noarch 0:3.13.1-166.el7_4.5 selinux-policy-targeted.noarch 0:3.13.1-166.el7_4.5 subversion.x86_64 0:1.7.14-11.el7_4 subversion-libs.x86_64 0:1.7.14-11.el7_4 sudo.x86_64 0:1.8.19p2-11.el7_4 systemd.x86_64 0:219-42.el7_4.4 systemd-libs.x86_64 0:219-42.el7_4.4 systemd-sysv.x86_64 0:219-42.el7_4.4 tzdata.noarch 0:2017c-1.el7 wpa_supplicant.x86_64 1:2.6-5.el7_4.1 置換: grub2.x86_64 1:2.02-0.64.el7.centos grub2-tools.x86_64 1:2.02-0.64.el7.centos 完了しました! |
2 通常はインターネットプロバイダから支給されたルーターにファイアウォールが設定されているので、サーバーのファイアウォールは停止
#プロバイダ提供のルーターのファイアウォールを使うのでソフトは停止 [root@ufuso ~]# systemctl stop firewalld #ファイアウォール自動起動停止 [root@ufuso ~]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. |
3 管理者rootになれるユーザを制限する
#rootユーザーをtuに限定する [root@ufuso ~]# usermod -G wheel tu #ユーザー認証ファイルの編集 [root@ufuso ~]# vi /etc/pam.d/su #%PAM-1.0 auth sufficient pam_rootok.so # Uncomment the following line to implicitly trust users in the "wheel" group. #auth sufficient pam_wheel.so trust use_uid # Uncomment the following line to require a user to be in the "wheel" group. auth required pam_wheel.so use_uid ← #を削除してroot ユーザーになる者を限定 auth include system-auth account sufficient pam_succeed_if.so uid = 0 use_uid quiet account include system-auth password include system-auth session include system-auth session optional pam_xauth.so |
4 標準リポジトリ導入
#標準リポジトリをインストール [root@ufuso ~]# yum -y install yum-plugin-priorities インストール: yum-plugin-priorities.noarch 0:1.1.31-42.el7 完了しました! #標準リポジトリを最優先 (プライオリティ=1)にする [root@ufuso ~]# sed -i -e "s/\]$/\]\npriority=1/g" /etc/yum.repos.d/CentOS-Base.repo #CentOS SCLo Software collections を追加 [root@ufuso ~]# yum -y install centos-release-scl-rh centos-release-scl インストール: centos-release-scl.noarch 0:2-2.el7.centos centos-release-scl-rh.noarch 0:2-2.el7.centos 完了しました! #プライオリティを10にする [root@ufuso ~]# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo #プライオリティを10にする [root@ufuso ~]# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo ※RPMforgeはサービスが休止?されているので導入を見送った |
5 EPELリポジトリ導入
#epel-releaseインストール [root@ufuso ~]# yum -y install epel-release インストール: epel-release.noarch 0:7-9 完了しました! #プライオリティを5にする [root@ufuso ~]# sed -i -e "s/\]$/\]\npriority=5/g" /etc/yum.repos.d/epel.repo |
6 REMIリポジトリ導入
#Remi's RPM repositoryをインストール [root@ufuso ~]# yum -y install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm インストール: remi-release.noarch 0:7.3-2.el7.remi 完了しました! #プライオリティを10にする [root@ufuso ~]# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/remi-safe.repo |
コメントを残す