知乎专栏 |
桌面版 AlmaLinux-9-latest-x86_64-dvd.iso
neo@MacBook-Pro-M2 ~/Downloads> sudo dd if=AlmaLinux-9.3-x86_64-minimal.iso of=/dev/rdisk4 bs=100m
iMac:Downloads neo$ sudo dd if=AlmaLinux-9-latest-x86_64-dvd.iso of=/dev/rdisk2 bs=100m
dnf -y upgrade dnf -y install epel-release dnf install -y bzip2 tree psmisc \ telnet wget rsync vim-enhanced \ net-tools bind-utils
将其改为英文
cat >> /etc/environment <<EOF LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LC_CTYPE=UTF-8 EOF
设置历史记录格式,可以看到命令的执行时间
cat >> /etc/profile.d/history.sh <<EOF # Administrator specific aliases and functions for system security export HISTSIZE=10000 export HISTFILESIZE=10000 export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S " export TIME_STYLE=long-iso EOF source /etc/profile.d/history.sh
sysctl 优化
cat >> /etc/sysctl.conf <<EOF # add by netkiller net.ipv4.ip_local_port_range = 1025 65500 net.core.somaxconn = 1024 # TCP BBR net.core.default_qdisc=fq net.ipv4.tcp_congestion_control=bbr fs.inotify.max_user_instances=65535 fs.inotify.max_user_watches=5088930 EOF sysctl -p
ulimit 优化
cat > /etc/security/limits.d/20-nofile.conf <<EOF * soft nofile 655350 * hard nofile 655350 EOF
cp /etc/selinux/config{,.original} sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config setenforce Permissive
关闭防火墙
systemctl disable firewalld systemctl stop firewalld
时间同步
dnf install -y chrony systemctl start chronyd
迷你版安装桌面
dnf update -y dnf grouplist dnf groupinstall -y "Server with GUI"
安装虚拟机
dnf groupinstall -y "Virtualization Host" dnf install -y virt-manager [root@localhost ~]# systemctl enable libvirtd [root@localhost ~]# systemctl start libvirtd [root@localhost ~]# dnf install -y bridge-utils [root@localhost ~]# brctl addbr br0 [root@localhost ~]# brctl addif br0 enp3s0 [root@localhost ~]# brctl stp br0 on [root@localhost ~]# brctl show
使用 nmtui 给 br0 设置 IP 地址、子网掩码和DNS
[root@localhost ~]# nmtui