參考來自:https://www.cnblogs.com/oboth-zl/p/10315500.html
有些在我這裏出問題,加了一些操作細節。
目前windows應用商店爲win10 提供了多款Linux發行版本,包括Ubuntu、Debian、OpenSUSE等。
這裏我安裝的Ubuntu系統是bionic,18.04。
在控制面版中啓用Linux子系統,在設定-更新和安全中-開發者選項中切換到開發人員模式
在Windows應用商店安裝一個Linux發行版本,選擇的Ubuntu。安裝完成後可以在開始選單找到,點選即可開啓。
第一次進入需等待安裝完成。如果以前有安裝過1804, 會出現錯誤,我這裏重新啓動一次就可以繼續安裝了。不重新啓動的話始終存在一個錯誤,導致無法安裝ubuntu子系統。
根據提示,設定使用者名稱和密碼。
設定完成,進入系統。
若需要使用root使用者,可通過sudo passwd設定root的密碼。
接下來是把軟體源修改爲國內,因爲預設官方源伺服器在國外,存取太慢。當然你也可以選擇跳過這一步,前提是你不嫌下載軟體慢。
源的修改有兩種方式:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
也可以修改爲清華大學或者阿裡雲的伺服器源。
apt-get update
對於Linux來說使用shell命令列完全滿足大部分場景的使用。但是某些情況還是需要圖形介面,比如檢視圖片、視訊,瀏覽網頁,UI設計等,這也是我折騰圖形介面的原因。
可以通過執行sudo dpkg-reconfigure locales 選擇zh-CN.UTF-8將系統切換爲中文環境。
安裝桌面、語言套件、字型包、輸入法等必要軟體。
這裏選擇的是lxde輕量化桌面,個人比較推薦,當然也可以選擇xfce,lxqt等其他桌面。使用下面 下麪的命令來裝輕量級卓桌面
apt-get update
apt-get gedit
apt install fcitx fcitx-googlepinyin
apt install language-pack-gnome-zh-hans
apt install fonts-wqy-zenhei
apt install xorg
apt install lubuntu-core
apt install lxde
盡然鼓搗壞apt,鼓搗壞apt-get ,或者apt-get 出問題的解決辦法:
wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.9.4ubuntu0.1_amd64.deb
dpkg -i apt_1.9.4ubuntu0.1_amd64.deb
2、安裝遠端桌面軟體(tigervnc)
受限於Linux子系統實現原理,圖形介面無法直接輸出到顯示器。
這裏選擇vnc遠端桌面來解決,當然你也可以選擇其他遠端桌面方案。
1)首先下載安裝程式:
wget https://bintray.com/tigervnc/stable/download_file?file_path=tigervnc-1.9.0.x86_64.tar.gz
ls
tar -xf download_file?file_path=tigervnc-1.9.0.x86_64.tar.gz
cd tigervnc-1.9.0.x86_64
cd usr/bin/
vncserver:0# 這裏還無法啓動,這是由於沒有安裝vnc4server
2)安裝vnc4server
apt-get install vnc4server tightvncserver
New 'X' desktop is DESKTOP-xxxxx:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/DESKTOP-寫文章-CSDN部落格.htm:1.log
vim /root/.vnc/xstartup
加入startlxde&
:wq儲存並退出
3)啓動vnc4server
# vnc4server
root使用者的桌面1和2
New 'DESKTOP-xxxx:2 (root)' desktop is DESKTOP-xxxx:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/DESKTOP- xxxx :2.log
You will require a password to access your desktops.
Password:
Verify:
Passwords don't match - try again
Password:
Verify:
Password too long - only the first 8 characters will be used
xauth: file /root/.Xauthority does not exist
New 'X' desktop is DESKTOP-xxxx:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/DESKTOP-xxxx:1.log
.vnc中的目錄
root@DESKTOP-xxxx:~/.vnc# ls
DESKTOP-xxxx:1.log DESKTOP-xxxx:1.pid DESKTOP-xxxx:2.log DESKTOP-xxxx:2.pid passwd xstartup
重新啓動vnc4server
$ vnc4server -kill :1
$vnc4server
注意:「-kill」和「:1」之間有空格
一般使用者的桌面,DESKTOP-xxxx:3
~$ vnc4server
You will require a password to access your desktops.
Password:
Verify:
Password too long - only the first 8 characters will be used
xauth: file /home/xxxx/.Xauthority does not exist
New 'DESKTOP-xxxx:3 (oxxxx)' desktop is DESKTOP-xxxx:3
Creating default startup script /home/oxxxx/.vnc/xstartup
Starting applications specified in /home/oxxxx/.vnc/xstartup
Log file is /home/oxxxx/.vnc/DESKTOP-xxxx:3.log
Xvnc Free Edition 4.1.1 - built Feb 25 2015 23:02:21
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 40300000, The XFree86 Project, Inc
Wed Aug 12 11:57:38 2020
vncext: VNC extension running!
vncext: Listening for VNC connections on port 5903
vncext: created VNC server for screen 0
error opening security policy file /etc/X11/xserver/SecurityPolicy
Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/75dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/100dpi/, removing from list!
Obt-Message: XKB extension is not present on the server or too old
Obt-Message: Xinerama extension is not present on the server
Xlib: extension "XInputExtension" missing on display ":3".
# Failed to parse arguments: Unknown option --login
See vncserver and Xtightvnc manual pages for more information.
vncserver :0不行
New 'X' desktop is DESKTOP-xxxx:0
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/DESKTOP-寫文章-CSDN部落格.htm:0.log
win下的桌布路徑C:\Windows\Web\Wallpaper挑幾張好的複製過去
cd /mnt/c/Windows/Web/Screen
cp *.* /etc/alternatives
然後在vnc中選擇一張桌布即可.
# cd .vnc
root@DESKTOP-xxxx:~/.vnc# ls
DESKTOP-xxxx:0.log DESKTOP-xxxx:0.pid DESKTOP-xxxx:1.log DESKTOP-xxxx:2.log passwd xstartup
root@DESKTOP-xxxx:~/.vnc# vncserver :1
New 'X' desktop is DESKTOP-xxxx:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/DESKTOP-xxxx:1.log
apt-get install firefox
Anaconda3安裝
oxxxx@DESKTOP-xxxx:/mnt/v$ sh ./Anaconda3-2020.07-Linux-x86_64.sh
# PREFIX=/home/oxxxx/anaconda3
Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes
./Anaconda3-2020.07-Linux-x86_64.sh: 491: ./Anaconda3-2020.07-Linux-x86_64.sh: [[: not found
no change /home/oxxxx/anaconda3/condabin/conda
no change /home/oxxxx/anaconda3/bin/conda
no change /home/oxxxx/anaconda3/bin/conda-env
no change /home/oxxxx/anaconda3/bin/activate
no change /home/oxxxx/anaconda3/bin/deactivate
no change /home/oxxxx/anaconda3/etc/profile.d/conda.sh
no change /home/oxxxx/anaconda3/etc/fish/conf.d/conda.fish
no change /home/oxxxx/anaconda3/shell/condabin/Conda.psm1
no change /home/oxxxx/anaconda3/shell/condabin/conda-hook.ps1
no change /home/oxxxx/anaconda3/lib/python3.8/site-packages/xontrib/conda.xsh
no change /home/oxxxx/anaconda3/etc/profile.d/conda.csh
modified /home/oxxxx/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
If you'd prefer that conda's base environment not be activated on startup,
set the auto_activate_base parameter to false:
conda config --set auto_activate_base false
Thank you for installing Anaconda3!
===========================================================================
Working with Python and Jupyter notebooks is a breeze with PyCharm
Professional! Code completion, Notebook debugger, VCS support, SSH, Docker,
Databases, and more!
Get a free trial at: https://www.anaconda.com/pycharm
wget https://download.jetbrains.8686c.com/python/pycharm-community-2020.2.tar.gz
Unpack the PyCharm distribution archive that you downloaded
where you wish to install the program. We will refer to this
location as your {installation home}.
cd /mnt/v/pycharm-community-2020.2/bin
./pycharm.sh
This will initialize various configuration files in the configuration directory:
~/.config/JetBrains/PyCharmCE2020.2.
3. [OPTIONAL] Add "{installation home}/bin" to your PATH environment
variable so that you can start PyCharm from any directory.
4. [OPTIONAL] To adjust the value of the JVM heap size, create a file pycharm.vmoptions
(or pycharm64.vmoptions if using a 64-bit JDK) in the configuration directory
and set the -Xms and -Xmx parameters. To see how to do this,
you can reference the vmoptions file under "{installation home}/bin" as a model
but do not modify it, add your options to the new file.
[OPTIONAL] Change the location of the "config" and "system" directories
------------------------------------------------------------------------------
By default, PyCharm stores all your settings in the
~/.config/JetBrains/PyCharmCE2020.2 directory
and uses ~/.local/share/JetBrains/PyCharmCE2020.2 as a data cache.
To change the location of these directories:
1. Open a console and cd into ~/.config/JetBrains/PyCharmCE2020.2
2. Create a file idea.properties and set the idea.system.path and idea.config.path variables, for example:
idea.system.path=~/custom/system
idea.config.path=~/custom/config
NOTE: Store the data cache ("system" directory) on a disk with at least 1 GB of free space.
Enjoy!
-PyCharm Development Team
解析度調整
cvt 1680 900
apt install v86d hwinfo
使用cvt命令生成 xorg.conf下的螢幕解析度和重新整理率(你的可以這樣執行sudo cvt 1280 720 75)
遠端螢幕大小設定
vim /usr/bin/vncserver
$geometry="1280x1024" --根據用戶端電腦螢幕解析度設定大小
#geometry="1400x900"
#geometry="1560x900" #還不夠寬
#geometry="1680x900" # 這個差不多了
kill掉開啓的遠端
vncserver -kill :0
vncserver -kill :1
啓動
vncserver :1
沒使用xrandr調整VNC的解析度,cvt處理出來也講究能用了。
./pycharm.sh
任意路徑開啓pycharm.
在終端開啓pycharm,然而,在終端開啓還有一個問題,就是需要進入pycharm解壓的資料夾下,進入bin目錄,輸入sh pycharm.sh才能 纔能開啓,這就比較麻煩了。
所以我需要將這個路徑也寫到~/,bashrc裏面,這樣在任意路徑下都可以直接輸入pycharm.sh,就能開啓pycharm了!
輸入內容如下:
export PATH="/usr/local/bin:$PATH"