Note on Ubuntu
要用Ubuntu的一些个环境: PettingZoo.
Win10下配置Ubuntu可视化窗口
Ubuntu on Windows
太长不看版, 下载安装到GUI运行一条龙: WSL2 Ubuntu GUI, 其代码见wsl2/ubuntu_gui_youtube.
安装WSL2和Ubuntu, Windows Subsystem for Linux Installation Guide for Windows 10.
Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables (in ELF format) natively on Windows 10, Windows 11,[2] and Windows Server 2019.
Ubuntu (/ʊˈbʊntuː/ uu-BUUN-too)[7] (Stylized as ubuntu) is a Linux distribution based on Debian and composed mostly of free and open-source software.[8][9][10] Ubuntu is officially released in three editions: Desktop,[11] Server,[12] and Core[13] for Internet of things devices[14] and robots.[15][16] All the editions can run on the computer alone, or in a virtual machine.[17] Ubuntu is a popular operating system for cloud computing, with support for OpenStack.[18] Ubuntu's default desktop has been GNOME, since version 17.10.
安装过程最麻烦的报错是Error 0x80370102 The Virtual machine could not be started because a required feature is not installed .... #436, 解决方法可参照ktmn的回答, 具体如下:
win+R
→ 键入msinfo32
后回车 → 查看BIOS Mode
的值, 见How to Fix UEFI Firmware Settings Missing Windows 10 [Partition Magic].- 若为
UEFI
,win+I
→ 搜索BIOS
→ 点击Advanced startup下的Restart now, 之后依次点击Troubleshoot
→Advanced options
→UEFI Firmware Settings
即可进入BIOS, 见How to enter the BIOS on a Windows 10 PC - 若为
Legacy
, 则只能重启电脑手动进入BIOS. 若电脑重启速度过快, 则按电源旁边的重启键强制重启, 按F2
进入 (按键因人而异).
- 若为
- 进入BIOS, 搜索
Virtualization
并启动.
GUI运行:
sudo /etc/init.d/xrdp start
, 详见WSL2 Ubuntu GUI.
云服务器
You are here:
Home / Tutorial / How To Check Your IP Address in Ubuntu [Beginner’s
Tip] How To Check Your IP Address in Ubuntu [Beginner’s Tip]:
给出了详细的步骤和图示, 并且有对ufw
的简单使用教程.
记录在Linux系统Ubuntu 20.04中安装xrdp远程桌面连接RDP: 唯一看了之后才成功的😠, 重要的几点如下:
- 安装桌面后重启服务器.
- 避开Windows的
3389
端口, 比如文中使用了13389
端口
同时需要注意IP (以下使用0.0.0.0
代替) 的获取方式有
ipconfig
后Ethernet adapter 以太网
中的IPv4 Address
.- 一直点你的网络直到进入
Settings
, 查看Properties
中的IPv4 address
.
具体的过程如下:
1 | sudo apt update |
1 | sudo ufw status |
1 | sudo sed -i 's/3389/13389/g' /etc/xrdp/xrdp.ini |
之后又会遇到很多问题:
打开黑屏或者报错😡
1
2
3- Sorry, Ubuntu 20.04 has experienced an internal error.
- Send problem report to the developers?
If you notice further rpoblems, try restarting the computer.解决方法为How did I connect to Ubuntu 18.04 Xfce 4 desktop from Windows 7 via xrdp?, 和Ubuntu on Windows的配置类似.
打不开命令行👿, 报错
1
2- Failed to execute default Ternimal Emulator.
Input/output error.解决方法见Getting input/output error running anything on remote desktop, 具体为安装并选择
xfce4-terminal
.1
2sudo apt-get install xfce4-terminal
sudo update-alternatives --config x-terminal-emulator
常用命令
Ununtu命令 | 含义 | 参见 |
---|---|---|
lsb-release -a |
查看Ubuntu版本 | |
sudo apt update && sudo apt -y upgrade |
更新 | |
clear | 清屏 | |
hostname -I |
查看IP |
Terminal命令 | 含义 | 参见 |
---|---|---|
dpkg -s <packagename> | grep '^Version:' |
查看包的版本 | How can I find the version number of an installed package via dpkg? |
Installation
App: Run Linux GUI apps on the Windows Subsystem for Linux (preview)
.deb
:
Install/Uninstall .deb files
.tar.tz
:
若有
./config
, 见How do I install a .tar.gz (or .tar.bz2) file?, 具体为:1
2
3
4tar xvzf PACKAGENAME.tar.gz
./configure
make
sudo make install若无, 见How to Install Python IDE PyCharm in Ubuntu and Other Linux Distributions, 具体为
1
2
3
4
5tar -xzf file.tar.gz
cd file
cd bin
chmod u+x file.sh
sh file.sh
.sh
:
1 | chmod u+x file.sh |
google-research/football
Imported target "Boost::filesystem" includes non-existent path "/include" in its interface_include_directories #311
1 sudo ln -s /usr/include /include
CPLEX
czet88/OCT_Benders
每日一破防.
fatal error: cplex.h: No such file or directory
就是没装CPLEX, 保姆教程见How to install CPLEX on Ubuntu 20.4, 具体报错如下:
1 | (base) carlos@DESKTOP-R4H3HQA:~/Github/OCT_Benders/src$ make |
undefined reference to `dladdr'
见Compilation of MAX_HS solver with IBM CPLEX, 具体报错如下:
1 | (base) carlos@DESKTOP-R4H3HQA:~/Github/OCT_Benders/src$ make |
Troubling Shooting
黑屏问题
Ubuntu 18.04, Blank screen after login from Windows 10 #1358
Jarez95好答案, 但没看.
affansaied给出了两种GUI的配置方法, 我没试成功.
- (没有效果)
更改
startwm.sh
的内容, 见How to Fix Black Screen When Remote Desktop to Ubuntu Desktop 20 from Windows 10 Using XRDP.原文内容见Restore contents of /etc/xrdp/startwm.sh, 有两处需要修改:- wsl2/ubuntu_gui_youtube
- How to Fix Black Screen When Remote Desktop to Ubuntu Desktop 20 from Windows 10 Using XRDP
更改后内容如下:
ERROR: No matching distribution found for setuptools
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# xrdp X session start script (c) 2015, 2017 mirabilos
# published under The MirOS Licence
if test -r /etc/profile; then
. /etc/profile
fi
if test -r /etc/default/locale; then
. /etc/default/locale
test -z "${LANG+x}" || export LANG
test -z "${LANGUAGE+x}" || export LANGUAGE
test -z "${LC_ADDRESS+x}" || export LC_ADDRESS
test -z "${LC_ALL+x}" || export LC_ALL
test -z "${LC_COLLATE+x}" || export LC_COLLATE
test -z "${LC_CTYPE+x}" || export LC_CTYPE
test -z "${LC_IDENTIFICATION+x}" || export LC_IDENTIFICATION
test -z "${LC_MEASUREMENT+x}" || export LC_MEASUREMENT
test -z "${LC_MESSAGES+x}" || export LC_MESSAGES
test -z "${LC_MONETARY+x}" || export LC_MONETARY
test -z "${LC_NAME+x}" || export LC_NAME
test -z "${LC_NUMERIC+x}" || export LC_NUMERIC
test -z "${LC_PAPER+x}" || export LC_PAPER
test -z "${LC_TELEPHONE+x}" || export LC_TELEPHONE
test -z "${LC_TIME+x}" || export LC_TIME
test -z "${LOCPATH+x}" || export LOCPATH
fi
# [How to Fix Black Screen When Remote Desktop to Ubuntu Desktop 20 from Windows 10 Using XRDP]
# (https://www.youtube.com/watch?v=0PlG6vCOmjc)
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
. $HOME/.profile
if test -r /etc/profile; then
. /etc/profile
fi
# test -x /etc/X11/Xsession && exec /etc/X11/Xsession
# exec /bin/sh /etc/X11/Xsession
# xfce
startxfce4 终极办法, 重启xrdp.
1
sudo /etc/init.d/xrdp restart
貌似解决了的办法, 进入
Xfce Power Manager
→Display
,Security
把会熄屏的选项调成Never
.
XX is Already Running
这是黑屏后附带产生的问题, 可以通过Applications
→
System
→ Task Manager
观察其运行状况,
也可以直接用pkill -f XX
关闭, 见Pycharm is "Already
running" while trying to launch from ubuntu terminal中 furas的评论.
curl: (60) SSL certificate problem: unable to get local issuer certificate
今天又被Ubuntu整破防了, 起因是想搞点DCMST的实验, 比如这个malbarbo/dcmstp-instances,
这次我学乖了直接上Ubuntu, make
时跳标题错误, 我就看了
- SSL Certificate Verification
- curl: (60) SSL certificate problem: unable to get local issuer certificate
- How do you add a certificate authority (CA) to Ubuntu?, 这里写了个命名坑
我滴操作如下
- 下载cacert.pem
- 运行
mv /home/carlos/downloads/mycert.crt /usr/local/share/ca-certificates/
移动并进入 - 用
sudo mv ca-certificates.crt mycert.crt
将其命名为mycert.crt
- 上述目录运行
sudo mv ca-certificates.crt mycert.crt
- 命名环境变量
export CURL_CA_BUNDLE="/usr/local/share/ca-certificates/mycert.crt"
搞不定了, 歇了...
好了我最后靠把Makefile
里所有的curl
都加上-k
解决了,
见curl: (60) SSL certificate
problem: unable to get local issuer certificate.
(然而这个库的链接挂了, 搞了半天还是用不了, 我暴哭😢)
ls: command not found
环境变量烂了, 每次进terminal都报错.
1 | ubuntu@VM-4-5-ubuntu:~$ ls |
解决方法见Command 'ls' is available in '/bin/ls', 具体为
.bashrc'中加入
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"`..profile
中加入PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
.- 保证
/etc/environment
为PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
.