Fedora36:初期設定

rootファイルシステムを拡張.

最上層部( / )rootファイルシステムを確認、記録します。

[root@www ~]# df -h
ファイルシス             サイズ    使用  残り 使用% マウント位置
devtmpfs                   3.9G      0  3.9G     0% /dev
tmpfs                      3.9G      0  3.9G     0% /dev/shm
tmpfs                      3.9G   1.1M  3.9G     1% /run
/dev/fedora/fedora-root     15G   1.9G   14G    13% / #拡張
tmpfs                      3.9G   4.0K  3.9G     1% /tmp
/dev/sda1                  1014M  194M  821M    20% /boot
tmpfs                      783M      0  783M     0% /run/user/1000

rootファイルシステムはディフォルトで15Gb ですので拡張します。
記録した最上層部( / )のroot理論ボリュームを拡張します。(上記フォームにてご自身のファイルパスに変更してください。)

[webmaster@www ~]$ sudo lvextend -l +100%FREE /dev/fedora/fedora-root

記録した最上層部( / )のrootファイルシステムを拡張します。

[webmaster@www ~]$ sudo xfs_growfs /dev/fedora/fedora-root

一般ユーザーの作成.

rootユーザーにログインします。

[webmaster@www ~]$ su -
パスワード:
[root@www ~]#

一般ユーザーを作成します。(初期設定では一般ユーザーは必要ありません。)

[root@www ~]# useradd ユーザー名

パスワードを設定します。

[root@www ~]# passwd ユーザー名
新しいパスワード:
新しいパスワードを再入力してください:

rootになれるユーザーを限定.

rootになれるユーザーを限定します。

[root@www ~]# usermod -G wheel webmaster
[root@www ~]# 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
auth            substack        system-auth
auth            include         postlogin
account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
account         include         system-auth
password        include         system-auth
session         include         system-auth
session         include         postlogin
session         optional        pam_xauth.so

一般ユーザーの削除.

ユーザーのみ削除する場合

[root@www ~]# userdel ユーザー名

ホームディレクトリも削除する場合

[root@www ~]# userdel -r ユーザー名

ファイアウォールとSELinuxを無効化.

ファイアウォールサービスを停止します。

[root@www ~]# systemctl stop firewalld

自動起動設定を無効にします。

[root@www ~]# systemctl disable firewalld
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'

SELinux を無効にします。

[root@www ~]# vi /etc/selinux/config

disabled に変更します。

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled #変更
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

再起動します。

[root@www ~]# reboot

ネットワークの設定.

IPv6 を無効にします。

[root@www ~]# vi /etc/default/grub

6行目:「ipv6.disable=1」を追加します。

GRUB_CMDLINE_LINUX="ipv6.disable=1 rd.lvm.lv=linuxserver/root..

変更を反映します。

[root@www ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
[root@www ~]# reboot

ルーター設定.

ルーターでDHCP固定IPアドレス設定ができる場合は「MACアドレス」、「サーバーIPアドレス」を設定します。

DHCP固定IPアドレス設定

MACアドレス(例:0c:2e:48:2b:dg:f4)

サーバーIPアドレス:192.168.1.3

システムの最新化.

システムを最新化します。

[root@www ~]# dnf -y update

モジュールを追加.

Node.js 14をインストールします。

[root@www ~]# dnf module -y install nodejs:14

モジュールを確認します。

[root@www ~]# node -v
v14.14.0

Node.js をリセットします。

[root@www ~]# dnf module reset nodejs

Node.js 16をインストールします。

[root@www ~]# dnf module enable nodejs:16
[root@www ~]# dnf module -y install nodejs:16/common

モジュールを確認します。

[root@www ~]# node -v
v16.14.0

パッケージ自動更新設定.

dnf-automaticをインストールします。

[root@www ~]# dnf install dnf-automatic dnf-utils -y

dnf-automaticを設定します。

[root@www ~]# vi /etc/dnf/automatic.conf

自動ダウンロード&自動アップデートを行うようにする

# Whether updates should be applied when they are available, by
# dnf-automatic.timer. notifyonly.timer, download.timer and
# install.timer override this setting.
apply_updates = yes #変更

パッケージ自動更新自動起動設定

[root@www ~]# systemctl enable --now dnf-automatic.timer

Web 管理コンソールの設定.

Cockpit を有効にして Web 管理コンソールが利用可能にします。

[root@www ~]# systemctl enable --now cockpit.socket
[root@www ~]# ss -napt
State Recv-Q Send-Q Local Address:Port Peer Address:Port 
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=831,fd=6)) 
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=831,fd=8)) 
LISTEN 0 128 *:9090 *:* users:(("systemd",pid=1,fd=24)) 

クライアントPCのWebブラウザで、 Web 管理コンソールへアクセスし「root」でログインします。

http://192.168.1.3:9090/

Vim(テキストエディタ)の設定.

Vim(テキストエディタ)をインストールします。

[root@www ~]# dnf -y install vim-enhanced

コマンドエイリアスを適用します。

[root@www ~]# vi /etc/profile

最終行に追記します。

alias vi='vim'

変更を反映します。

[root@www ~]# source /etc/profile

vim を設定します。

[root@www ~]# vi ~/.vimrc

行番号を表示する(サーバー設定を行番号で説明いたします。)

set number

Sudo(root権限)の設定.

root権限を特定のユーザーに設定します。

[root@www ~]# visudo

最終行に追記します。

webmaster    ALL=(ALL)       ALL

コメント

タイトルとURLをコピーしました