mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-07-03 06:26:52 +00:00
Update
This commit is contained in:
parent
2325725386
commit
5c17426170
@ -31,195 +31,6 @@ export const metadata: Metadata = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function SystemSettingsPage() {
|
export default function SystemSettingsPage() {
|
||||||
|
|
||||||
const fastRebootCode = `
|
|
||||||
# Install kexec-tools
|
|
||||||
sudo apt-get install -y kexec-tools
|
|
||||||
|
|
||||||
# Create kexec-pve service file
|
|
||||||
sudo tee /etc/systemd/system/kexec-pve.service > /dev/null <<EOF
|
|
||||||
[Unit]
|
|
||||||
Description=Loading new kernel into memory
|
|
||||||
Documentation=man:kexec(8)
|
|
||||||
DefaultDependencies=no
|
|
||||||
Before=reboot.target
|
|
||||||
RequiresMountsFor=/boot
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/sbin/kexec -d -l /boot/pve/vmlinuz --initrd=/boot/pve/initrd.img --reuse-cmdline
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Enable the service
|
|
||||||
sudo systemctl enable kexec-pve.service
|
|
||||||
|
|
||||||
# Add alias for reboot-quick
|
|
||||||
echo "alias reboot-quick='systemctl kexec'" >> ~/.bash_profile
|
|
||||||
`
|
|
||||||
|
|
||||||
const kernelPanicCode = `
|
|
||||||
# Create kernel panic configuration file
|
|
||||||
sudo tee /etc/sysctl.d/99-kernelpanic.conf > /dev/null <<EOF
|
|
||||||
kernel.core_pattern = /var/crash/core.%t.%p
|
|
||||||
kernel.panic = 10
|
|
||||||
kernel.panic_on_oops = 1
|
|
||||||
kernel.hardlockup_panic = 1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Apply the changes
|
|
||||||
sudo sysctl -p /etc/sysctl.d/99-kernelpanic.conf
|
|
||||||
`
|
|
||||||
|
|
||||||
const entropyCode = `
|
|
||||||
# Install haveged
|
|
||||||
sudo apt-get install -y haveged
|
|
||||||
|
|
||||||
# Configure haveged
|
|
||||||
sudo tee /etc/default/haveged > /dev/null <<EOF
|
|
||||||
DAEMON_ARGS="-w 1024"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Enable haveged service
|
|
||||||
sudo systemctl enable haveged
|
|
||||||
`
|
|
||||||
|
|
||||||
const systemLimitsCode = `
|
|
||||||
# Increase max user watches
|
|
||||||
sudo tee /etc/sysctl.d/99-maxwatches.conf > /dev/null <<EOF
|
|
||||||
fs.inotify.max_user_watches = 1048576
|
|
||||||
fs.inotify.max_user_instances = 1048576
|
|
||||||
fs.inotify.max_queued_events = 1048576
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Increase max FD limit / ulimit
|
|
||||||
sudo tee /etc/security/limits.d/99-limits.conf > /dev/null <<EOF
|
|
||||||
* soft nproc 1048576
|
|
||||||
* hard nproc 1048576
|
|
||||||
* soft nofile 1048576
|
|
||||||
* hard nofile 1048576
|
|
||||||
root soft nproc unlimited
|
|
||||||
root hard nproc unlimited
|
|
||||||
root soft nofile unlimited
|
|
||||||
root hard nofile unlimited
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Increase kernel max Key limit
|
|
||||||
sudo tee /etc/sysctl.d/99-maxkeys.conf > /dev/null <<EOF
|
|
||||||
kernel.keys.root_maxkeys=1000000
|
|
||||||
kernel.keys.maxkeys=1000000
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Set systemd ulimits
|
|
||||||
echo "DefaultLimitNOFILE=256000" | sudo tee -a /etc/systemd/system.conf /etc/systemd/user.conf
|
|
||||||
|
|
||||||
# Configure PAM limits
|
|
||||||
echo 'session required pam_limits.so' | sudo tee -a /etc/pam.d/common-session /etc/pam.d/runuser-l
|
|
||||||
|
|
||||||
# Set ulimit for the shell user
|
|
||||||
echo "ulimit -n 256000" >> ~/.profile
|
|
||||||
|
|
||||||
# Configure swappiness
|
|
||||||
sudo tee /etc/sysctl.d/99-swap.conf > /dev/null <<EOF
|
|
||||||
vm.swappiness = 10
|
|
||||||
vm.vfs_cache_pressure = 100
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Increase Max FS open files
|
|
||||||
sudo tee /etc/sysctl.d/99-fs.conf > /dev/null <<EOF
|
|
||||||
fs.nr_open = 12000000
|
|
||||||
fs.file-max = 9223372036854775807
|
|
||||||
fs.aio-max-nr = 1048576
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Apply sysctl changes
|
|
||||||
sudo sysctl --system
|
|
||||||
`
|
|
||||||
|
|
||||||
const kernelHeadersCode = `
|
|
||||||
# Install kernel headers for the current kernel version
|
|
||||||
sudo apt-get install -y linux-headers-$(uname -r)
|
|
||||||
`
|
|
||||||
|
|
||||||
const journaldCode = `
|
|
||||||
# Configure journald
|
|
||||||
sudo tee /etc/systemd/journald.conf > /dev/null <<EOF
|
|
||||||
[Journal]
|
|
||||||
Storage=persistent
|
|
||||||
SplitMode=none
|
|
||||||
RateLimitInterval=0
|
|
||||||
RateLimitIntervalSec=0
|
|
||||||
RateLimitBurst=0
|
|
||||||
ForwardToSyslog=no
|
|
||||||
ForwardToWall=yes
|
|
||||||
Seal=no
|
|
||||||
Compress=yes
|
|
||||||
SystemMaxUse=64M
|
|
||||||
RuntimeMaxUse=60M
|
|
||||||
MaxLevelStore=warning
|
|
||||||
MaxLevelSyslog=warning
|
|
||||||
MaxLevelKMsg=warning
|
|
||||||
MaxLevelConsole=notice
|
|
||||||
MaxLevelWall=crit
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Restart journald service
|
|
||||||
sudo systemctl restart systemd-journald.service
|
|
||||||
|
|
||||||
# Clean and rotate logs
|
|
||||||
sudo journalctl --vacuum-size=64M --vacuum-time=1d
|
|
||||||
sudo journalctl --rotate
|
|
||||||
`
|
|
||||||
|
|
||||||
const logrotateCode = `
|
|
||||||
# Optimize logrotate configuration
|
|
||||||
sudo tee /etc/logrotate.conf > /dev/null <<EOF
|
|
||||||
daily
|
|
||||||
su root adm
|
|
||||||
rotate 7
|
|
||||||
create
|
|
||||||
compress
|
|
||||||
size=10M
|
|
||||||
delaycompress
|
|
||||||
copytruncate
|
|
||||||
|
|
||||||
include /etc/logrotate.d
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Restart logrotate service
|
|
||||||
sudo systemctl restart logrotate
|
|
||||||
`
|
|
||||||
|
|
||||||
const memorySettingsCode = `
|
|
||||||
# Optimize memory settings
|
|
||||||
sudo tee /etc/sysctl.d/99-memory.conf > /dev/null <<EOF
|
|
||||||
vm.min_free_kbytes = 1048576
|
|
||||||
vm.nr_hugepages = 2000
|
|
||||||
vm.max_map_count = 1048576
|
|
||||||
vm.overcommit_memory = 1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Apply sysctl changes
|
|
||||||
sudo sysctl -p /etc/sysctl.d/99-memory.conf
|
|
||||||
`
|
|
||||||
|
|
||||||
const timeSyncCode = `
|
|
||||||
# Set timezone (replace 'America/New_York' with your timezone)
|
|
||||||
sudo timedatectl set-timezone America/New_York
|
|
||||||
|
|
||||||
# Enable automatic time synchronization
|
|
||||||
sudo timedatectl set-ntp true
|
|
||||||
|
|
||||||
# Note: Automatic timezone setting based on IP is commented out to avoid errors
|
|
||||||
# To set timezone automatically based on IP, you would need to run:
|
|
||||||
# IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
|
||||||
# TIMEZONE=$(curl -s "https://ipapi.co/$IP/timezone")
|
|
||||||
# sudo timedatectl set-timezone "$TIMEZONE"
|
|
||||||
`
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container mx-auto px-4 py-8">
|
<div className="container mx-auto px-4 py-8">
|
||||||
<div className="flex items-center mb-6">
|
<div className="flex items-center mb-6">
|
||||||
@ -227,144 +38,47 @@ sudo timedatectl set-ntp true
|
|||||||
<h1 className="text-3xl font-bold">System Settings</h1>
|
<h1 className="text-3xl font-bold">System Settings</h1>
|
||||||
</div>
|
</div>
|
||||||
<p className="mb-4">
|
<p className="mb-4">
|
||||||
The System Settings category in the customizable_post_install.sh script focuses on core system configurations
|
The <strong>System Settings</strong> category in the <code>customizable_post_install.sh</code> script focuses on core system configurations
|
||||||
and optimizations for your Proxmox VE installation. These settings are crucial for improving system performance,
|
and optimizations for your Proxmox VE installation. These settings improve performance, stability, and resource management.
|
||||||
stability, and resource management.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 className="text-2xl font-semibold mt-8 mb-4">Available Optimizations</h2>
|
<h2 className="text-2xl font-semibold mt-8 mb-4">Available Optimizations</h2>
|
||||||
|
|
||||||
<section className="mb-8">
|
<section className="mb-8">
|
||||||
<h3 className="text-xl font-semibold mb-2">1. Enable Fast Reboots</h3>
|
<h3 className="text-xl font-semibold mb-2">Enable Fast Reboots</h3>
|
||||||
<p className="mb-4">
|
<p className="mb-4">This optimization enables <code>kexec</code>, allowing the system to reboot quickly without full hardware reinitialization.</p>
|
||||||
This optimization configures kexec for quick reboots, significantly reducing the time needed for system
|
<h4 className="text-lg font-semibold mb-2">To apply this setting manually, run:</h4>
|
||||||
restarts.
|
<CopyableCode code={`sudo apt-get install -y kexec-tools\nsudo systemctl enable kexec-pve.service\necho "alias reboot-quick='systemctl kexec'" >> ~/.bash_profile`} />
|
||||||
</p>
|
|
||||||
<p className="mb-4">
|
|
||||||
<strong>Why it's beneficial:</strong> Fast reboots are crucial in a virtualization environment where downtime
|
|
||||||
needs to be minimized. By using kexec, the system can skip the time-consuming hardware initialization process
|
|
||||||
during a reboot, resulting in much faster restart times.
|
|
||||||
</p>
|
|
||||||
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
|
|
||||||
<CopyableCode code={fastRebootCode} />
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="mb-8">
|
<section className="mb-8">
|
||||||
<h3 className="text-xl font-semibold mb-2">2. Configure Kernel Panic Behavior</h3>
|
<h3 className="text-xl font-semibold mb-2">Configure Kernel Panic Behavior</h3>
|
||||||
<p className="mb-4">
|
<p className="mb-4">Ensures the system reboots automatically after a kernel panic to reduce downtime.</p>
|
||||||
This optimization sets up the system to automatically restart on kernel panic, improving system resilience and
|
<h4 className="text-lg font-semibold mb-2">To apply this setting manually, run:</h4>
|
||||||
uptime.
|
<CopyableCode code={`echo "kernel.panic = 10" | sudo tee /etc/sysctl.d/99-kernelpanic.conf\necho "kernel.panic_on_oops = 1" | sudo tee -a /etc/sysctl.d/99-kernelpanic.conf\nsudo sysctl -p /etc/sysctl.d/99-kernelpanic.conf`} />
|
||||||
</p>
|
|
||||||
<p className="mb-4">
|
|
||||||
<strong>Why it's beneficial:</strong> Automatic restarts on kernel panic help maintain system availability.
|
|
||||||
Instead of remaining in a crashed state, the system will attempt to recover by rebooting, potentially
|
|
||||||
resolving the issue without manual intervention.
|
|
||||||
</p>
|
|
||||||
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
|
|
||||||
<CopyableCode code={kernelPanicCode} />
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="mb-8">
|
<section className="mb-8">
|
||||||
<h3 className="text-xl font-semibold mb-2">3. Ensure Entropy Pools are Populated</h3>
|
<h3 className="text-xl font-semibold mb-2">Increase System Limits</h3>
|
||||||
<p className="mb-4">
|
<p className="mb-4">Optimizes system resource management by increasing user and file limits.</p>
|
||||||
This optimization installs and configures haveged to ensure sufficient entropy, preventing potential slowdowns
|
<h4 className="text-lg font-semibold mb-2">To apply this setting manually, run:</h4>
|
||||||
in cryptographic operations.
|
<CopyableCode code={`echo "fs.inotify.max_user_watches = 1048576" | sudo tee /etc/sysctl.d/99-maxwatches.conf\necho "* soft nofile 1048576" | sudo tee /etc/security/limits.d/99-limits.conf\nsudo sysctl -p`} />
|
||||||
</p>
|
|
||||||
<p className="mb-4">
|
|
||||||
<strong>Why it's beneficial:</strong> Many cryptographic operations rely on a pool of random numbers. In
|
|
||||||
virtual environments, generating true randomness can be challenging, leading to potential bottlenecks. Haveged
|
|
||||||
helps maintain a healthy entropy pool, ensuring smooth operation of cryptographic tasks.
|
|
||||||
</p>
|
|
||||||
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
|
|
||||||
<CopyableCode code={entropyCode} />
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="mb-8">
|
<section className="mb-8">
|
||||||
<h3 className="text-xl font-semibold mb-2">4. Increase Various System Limits</h3>
|
<h3 className="text-xl font-semibold mb-2">Optimize Journald</h3>
|
||||||
<p className="mb-4">
|
<p className="mb-4">Configures system logs to limit excessive disk usage and improve performance.</p>
|
||||||
This optimization increases various system limits to improve resource management and system performance.
|
<h4 className="text-lg font-semibold mb-2">To apply this setting manually, run:</h4>
|
||||||
</p>
|
<CopyableCode code={`echo "SystemMaxUse=64M" | sudo tee -a /etc/systemd/journald.conf\nsudo systemctl restart systemd-journald`} />
|
||||||
<p className="mb-4">
|
|
||||||
<strong>Why it's beneficial:</strong> Default system limits can be too restrictive for high-performance
|
|
||||||
virtualization environments. Increasing these limits allows for better utilization of system resources,
|
|
||||||
accommodating more concurrent operations and larger workloads without hitting artificial bottlenecks.
|
|
||||||
</p>
|
|
||||||
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
|
|
||||||
<CopyableCode code={systemLimitsCode} />
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section className="mb-8">
|
|
||||||
<h3 className="text-xl font-semibold mb-2">5. Install Kernel Headers</h3>
|
|
||||||
<p className="mb-4">This optimization installs the kernel headers for the current kernel version.</p>
|
|
||||||
<p className="mb-4">
|
|
||||||
<strong>Why it's beneficial:</strong> Kernel headers are necessary for building kernel modules, which may be
|
|
||||||
required by certain software or drivers. Having them installed ensures that you can compile and use custom
|
|
||||||
kernel modules if needed, enhancing system flexibility and compatibility.
|
|
||||||
</p>
|
|
||||||
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
|
|
||||||
<CopyableCode code={kernelHeadersCode} />
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section className="mb-8">
|
|
||||||
<h3 className="text-xl font-semibold mb-2">6. Optimize Journald</h3>
|
|
||||||
<p className="mb-4">This optimization configures journald for better performance and resource usage.</p>
|
|
||||||
<p className="mb-4">
|
|
||||||
<strong>Why it's beneficial:</strong> Optimizing journald helps manage system logs more efficiently. By
|
|
||||||
limiting log sizes and adjusting logging levels, you can prevent logs from consuming excessive disk space
|
|
||||||
while still maintaining useful system information for troubleshooting.
|
|
||||||
</p>
|
|
||||||
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
|
|
||||||
<CopyableCode code={journaldCode} />
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section className="mb-8">
|
|
||||||
<h3 className="text-xl font-semibold mb-2">7. Optimize Logrotate</h3>
|
|
||||||
<p className="mb-4">This optimization configures logrotate for better log management.</p>
|
|
||||||
<p className="mb-4">
|
|
||||||
<strong>Why it's beneficial:</strong> Proper log rotation is crucial for managing disk space and maintaining
|
|
||||||
system performance. By compressing old logs and limiting their size, you prevent log files from growing
|
|
||||||
indefinitely and potentially filling up your disk.
|
|
||||||
</p>
|
|
||||||
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
|
|
||||||
<CopyableCode code={logrotateCode} />
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section className="mb-8">
|
|
||||||
<h3 className="text-xl font-semibold mb-2">8. Optimize Memory Settings</h3>
|
|
||||||
<p className="mb-4">
|
|
||||||
This optimization adjusts various memory-related kernel parameters for better performance.
|
|
||||||
</p>
|
|
||||||
<p className="mb-4">
|
|
||||||
<strong>Why it's beneficial:</strong> These memory optimizations can significantly improve system performance,
|
|
||||||
especially in virtualized environments. They help ensure that memory is used efficiently, reduce the
|
|
||||||
likelihood of out-of-memory errors, and improve the performance of memory-intensive applications.
|
|
||||||
</p>
|
|
||||||
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
|
|
||||||
<CopyableCode code={memorySettingsCode} />
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section className="mb-8">
|
|
||||||
<h3 className="text-xl font-semibold mb-2">9. Synchronize Time Automatically</h3>
|
|
||||||
<p className="mb-4">
|
|
||||||
This optimization configures the system to automatically synchronize its time, ensuring accurate timekeeping.
|
|
||||||
</p>
|
|
||||||
<p className="mb-4">
|
|
||||||
<strong>Why it's beneficial:</strong> Accurate timekeeping is crucial for many system operations, log
|
|
||||||
consistency, and proper functioning of time-sensitive applications. Automatic synchronization ensures your
|
|
||||||
Proxmox VE system maintains the correct time without manual intervention.
|
|
||||||
</p>
|
|
||||||
<h4 className="text-lg font-semibold mb-2">To apply this optimization manually, run these commands:</h4>
|
|
||||||
<CopyableCode code={timeSyncCode} />
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="mt-12 p-4 bg-blue-100 rounded-md">
|
<section className="mt-12 p-4 bg-blue-100 rounded-md">
|
||||||
<h2 className="text-xl font-semibold mb-2">Automatic Application</h2>
|
<h2 className="text-xl font-semibold mb-2">Automatic Application</h2>
|
||||||
<p>
|
<p>
|
||||||
All of these optimizations are automatically applied when selected in the System section of the
|
All of these optimizations are automatically applied when selected in the System section of the
|
||||||
customizable_post_install.sh script. This automation ensures that these beneficial settings are applied
|
<code>customizable_post_install.sh</code> script. This ensures that beneficial settings are consistently applied,
|
||||||
consistently and correctly, saving time and reducing the potential for human error.
|
improving efficiency and reducing manual setup time.
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user