在CentOS系統上安裝Compton,可以按照以下步驟進行:
更新系統: 首先,確保你的CentOS系統已經更新到最新版本。
sudo yum update -y
啟用EPEL倉庫(如果需要): Compton可能不在默認的CentOS倉庫中,但可能在EPEL(Extra Packages for Enterprise Linux)倉庫中。
sudo yum install epel-release -y
安裝Compton: 你可以通過yum直接安裝Compton,或者從源代碼編譯安裝。使用yum安裝是最簡單的方法。
sudo yum install compton -y
如果yum倉庫中沒有Compton,你可以嘗試從源代碼編譯安裝。
從源代碼編譯安裝(如果需要): 如果你需要從源代碼編譯Compton,首先需要安裝一些依賴項。
sudo yum groupinstall "Development Tools" -y
sudo yum install mesa-libGL-devel mesa-libEGL-devel libX11-devel libXext-devel libXinerama-devel libXcursor-devel libxdamage-devel libxrandr-devel libxxf86vm-devel -y
然后,克隆Compton的GitHub倉庫并進入目錄。
git clone https://github.com/astraeadar/compton.git
cd compton
接下來,編譯并安裝Compton。
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install
創建或編輯配置文件:
Compton的配置文件通常位于~/.config/compton.conf
。你可以創建一個默認的配置文件,或者直接編輯它。
mkdir -p ~/.config/compton.conf
使用文本編輯器(如nano或vim)打開配置文件。
nano ~/.config/compton.conf
添加或修改配置選項,例如:
bg_blur = true
shadow = true
screen_edge_blur = true
opacity = false
vsync = true
ignore_glx_glitz = true
手動啟動Compton: 你可以通過在終端中運行以下命令來啟動Compton。
compton --config ~/.config/compton.conf
設置Compton開機自啟: 你可以創建一個systemd服務文件來管理Compton的啟動。
創建一個服務文件:
sudo nano /etc/systemd/system/compton.service
將以下內容粘貼到compton.service
文件中:
[Unit]
Description=Compton Compositor
After=display-manager.service
[Service]
Type=simple
ExecStart=/usr/bin/compton --config /etc/compton.conf
Restart=on-failure
[Install]
WantedBy=multi-user.target
保存并關閉文件。
重新加載systemd配置:
sudo systemctl daemon-reload
啟用并啟動Compton服務:
sudo systemctl enable compton
sudo systemctl start compton
無論使用哪種方法,都可以通過以下命令來驗證Compton是否正常運行:
ps aux | grep compton
如果顯示了Compton的版本信息,說明安裝成功。