# 安裝和設定CentOS ## winsows10 安裝 CentOS 7 on WSL ### Step1:使用管理者權限開啟PowerShell  輸入:**Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux**  ### Step2:下載CentOS, 本範例使用CentOS 8.1 1911版 - [下載位置](https://github.com/wsldl-pg/CentWSL/releases)  ### Step3:下載完後解壓縮檔案,點擊CentOS8.exe安裝,安裝完出現完成畫面  ### Step4:點選CentOS8.exe後更新:執行 yum -y update後,開始更新   ## winsows10 安裝 CentOS 7 on WSL2 ## Enable WSL2 on Windows 10 - 使用管理者權限開啟PowerShell 輸入dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart  - 使用管理者權限開啟PowerShell 輸入dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart  - 下載linux更新包14.6MB wsl_update_x64.msi 並安裝(https://docs.microsoft.com/zh-cn/windows/wsl/install-win10#step-4---download-the-linux-kernel-update-package)   - 使用管理者權限開啟PowerShell 輸入wsl --set-default-version 2, 將WSL2設成默認版本  ## 安裝需要檔案 ### 下載安裝java,輸入: yum install java  **如果有遇到下列問題:**  **解決方法:** 輸入rm -f /var/lib/rpm/__db* 然後輸入 dnf update  **再重新 yum install java**  **安裝完成**  ### 下載安裝sudo,輸入: yum install sudo  ### 下載安裝tomcat **創建tomcat用戶, sudo useradd -r tomcat**  **安裝wget 命令: yum install wget**  **安裝tomcat, 可去官網找, 目前是9.0.45** 輸入:**wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.45/bin/apache-tomcat-9.0.45.tar.gz**  **建立資料夾: sudo mkdir -p /opt/tomcat**  **解壓縮: tar xvf apache-tomcat-9.0.45.tar.gz -C /opt/tomcat/**  **更新權限: sudo chown -R tomcat:tomcat /opt/tomcat**  **啟動tomcat**  **在網址輸入http://localhost:8080/**  **可以看到tomcat已啟動** ###### tags: `Linux`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up