- Extend the root file system.
- Create a general user.
- Limit users who can become root.
- Deletion of general users.
- Disable firewall and SELinux.
- Network settings.
- router settings
- System modernization.
- Add module.
- Package auto-update settings.
- Web management console settings.
- Vim (text editor) settings.
- Configure sudo (root privileges).
Extend the root file system.
Check and record the top level ( / ) root file system.
[root@www ~]# df -h
filesys size used remaining %used mount location
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% / #Expansion
tmpfs 3.9G 4.0K 3.9G 1% /tmp
/dev/sda1 1014M 194M 821M 20% /boot
tmpfs 783M 0 783M 0% /run/user/1000
Extend the root logical volume at the top level ( / ) you recorded. (Please change to your own file path in the above form.)
[webmaster@www ~]$ sudo lvextend -l +100%FREE /dev/fedora/fedora-root
[webmaster@www ~]$ sudo xfs_growfs /dev/fedora/fedora-root
Create a general user.
Log in to root user.
[webmaster@www ~]$ su -
password:
[root@www ~]#
[root@www ~]# useradd ユーザー名
[root@www ~]# passwd ユーザー名 New Password: Re-enter new password:
Limit users who can become root.
Limit users who can become 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
Deletion of general users.
If you want to delete only the user
[root@www ~]# userdel ユーザー名
[root@www ~]# userdel -r ユーザー名
Disable firewall and SELinux.
Stop the firewall service.
[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'
[root@www ~]# vi /etc/selinux/config
# 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
Network settings.
IPv6 を無効にします。
[root@www ~]# vi /etc/default/grub
GRUB_CMDLINE_LINUX="ipv6.disable=1 rd.lvm.lv=centos/root..
[root@www ~]# grub2-mkconfig -o /boot/grub2/grub.cfg [root@www ~]# reboot
router settings
If DHCP fixed IP address can be set on the router, set “MAC address” and “Server IP address” in ” DHCPv4 server setting > DHCP fixed IP address setting ” and record the IP address.
MAC address(例:0c:2e:48:2b:dg:f4)
Server IP address:192.168.1.3
System modernization.
Modernize your system.
[root@www ~]# dnf -y update
Add module.
Install Node.js 14.
[root@www ~]# dnf module -y install nodejs:14
[root@www ~]# node -v v14.14.0
[root@www ~]# dnf module reset nodejs
[root@www ~]# dnf module enable nodejs:16
[root@www ~]# dnf module -y install nodejs:16/common
[root@www ~]# node -v v16.14.0
Package auto-update settings.
Set dnf-automatic.
[root@www ~]# dnf install dnf-automatic dnf-utils -y
[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 #change
[root@www ~]# systemctl enable --now dnf-automatic.timer
Web management console settings.
Enable Cockpit to make the web management console available.
[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))
Vim (text editor) settings.
Install Vim (text editor).
[root@www ~]# dnf -y install vim-enhanced
[root@www ~]# vi /etc/profile
alias vi='vim'
[root@www ~]# source /etc/profile
[root@www ~]# vi ~/.vimrc
set number
Configure sudo (root privileges).
Set root privileges to a specific user.
[root@www ~]# visudo
webmaster ALL=(ALL) ALL
コメント