Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

1.2. AlmaLinux

1.2.1. 制作 U 盘启动盘

桌面版 AlmaLinux-9-latest-x86_64-dvd.iso

		
iMac:Downloads neo$ sudo dd if=AlmaLinux-9-latest-x86_64-dvd.iso of=/dev/rdisk2 bs=100m
		
		

1.2.2. AlmaLinux 9.0 镜像安装初始化

			
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
			
		

1.2.3. Minimal 版本安装 XWindows

迷你版安装桌面

		
dnf update -y

dnf grouplist
dnf groupinstall -y "Server with GUI"
		
		

1.2.3.1. KVM 虚拟机

安装虚拟机

			
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