最近也是继续搞Linux,结果呢,很多exe程序都要疯狂换系统运行,简直要把我烦死于是乎我就开干了,我也是费了好大劲,写了一个install_wine.sh方便给大家下载了,你们可以复制粘贴以下内容,然后文件名写上install_wine.sh,用chmod +x ~/install_wine.sh赋予可执行权限,然后运行~/install_wine.sh代码都是公开在下面的,你们担心有病毒的话可以仔细阅读#!/bin/bashset -euo pipefailecho "Initializing..."sudo dpkg --add-architecture i386sudo mkdir -pm755 /etc/apt/keyrings# 清理重复的旧源sudo rm -f /etc/apt/sources.list.d/winehq-plucky.listsudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/plucky/winehq-plucky.sourcessudo wget -O /etc/apt/keyrings/winehq-archive.gpg https://dl.winehq.org/wine-builds/winehq.key# 卸载冲突的旧winesudo apt remove wine wine64 wine-amd64 wine-i386 -y 2>/dev/null || truesudo apt updatesudo apt upgrade -yecho "Installing Wine Stable..."sudo apt install --install-recommends winehq-stable -yecho "Installing Winetricks..."sudo apt install winetricks -yecho "Setting up Wine path..."# 创建系统级软链接,让所有程序(包括GUI)都能找到winesudo ln -sf /opt/wine-stable/bin/wine /usr/local/bin/winesudo ln -sf /opt/wine-stable/bin/wine64 /usr/local/bin/wine64sudo ln -sf /opt/wine-stable/bin/wineserver /usr/local/bin/wineserver# 用户级PATH也加上(终端用)if ! grep -q '/opt/wine-stable/bin' ~/.bashrc; then echo 'export PATH=$PATH:/opt/wine-stable/bin' >> ~/.bashrcfiexport WINE=$(which wine || echo /opt/wine-stable/bin/wine)echo "Wine found at: $WINE"echo "Installing common runtimes..."WINE=$WINE winetricks d3dx9 vcrun2019 corefontsWINE=$WINE winetricks --force vcrun2022echo "Installing Lutris..."sudo apt install lutris -yecho "Installing DXVK..."WINE=$WINE winetricks dxvkecho "Setting up exe double-click support..."sudo apt install binfmt-support wine-binfmt -ysudo update-binfmts --enable winesudo systemctl restart systemd-binfmtecho "Setting exe file association..."xdg-mime default wine.desktop application/x-ms-dos-executableecho ""echo "===================="echo "All done! 🎉"echo "Wine is installed and configured."echo "Double-click any .exe file to run it with Wine."echo "===================="
ok啊,运行完就可以了,但如果经常内存爆炸,可以在终端运行下面的即行命令,注意了,“你要分配给溢出内存的盘”处需要填写成你要分配的盘的名称,不要填盘符,而且需要在文件里确保它已经装载。count后面的那个16是要分配给溢出内存的GB数量:echo"Creating 16GB swap file (for memory-hungry games like BeamNG)..."SWAP_PATH="/run/media/joshuamaojh/你要分配给溢出内存的盘/swapfile"if [ ! -f "$SWAP_PATH" ]; then sudoddif=/dev/zero of="$SWAP_PATH" bs=1G count=16 sudochmod 600 "$SWAP_PATH" sudo mkswap "$SWAP_PATH" sudo swapon "$SWAP_PATH"else echo"Swap file already exists, skipping."fi