Skip to content

Instantly share code, notes, and snippets.

@MarshalW
Last active December 14, 2023 02:08
Show Gist options
  • Save MarshalW/34a537e6dcc11da1c4704cd3a7e8344f to your computer and use it in GitHub Desktop.
Save MarshalW/34a537e6dcc11da1c4704cd3a7e8344f to your computer and use it in GitHub Desktop.
ubuntu desktop 开发环境安装配置

ubuntu 开发环境安装配置

ubuntu 版本:

  • 20.04.1 desktop,国内下载 清华镜像 - ubuntu release
  • macOS 下使用 vmware fusion,免费的,使用界面比 virtualbox 方便很多

需要安装和配置的项目:

  • ansible
  • sshuttle
  • vscode
  • docker
  • nvm/node.js
  • yarn
  • lerna

安装记录:

# 设置 sudo 免密码
# sudo sudoer
# 增加: username     ALL=(ALL) NOPASSWD:ALL

# curl
sudo apt install curl -y

# docker & compose
curl -fsSL https://get.docker.com -o get-docker.sh
DRY_RUN=1 sudo sh ./get-docker.sh
sudo usermod -aG docker $USER # 需要重启系统才能生效?

# 安装 vscode
sudo apt install software-properties-common apt-transport-https wget -y
wget -O- https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor | sudo tee /usr/share/keyrings/vscode.gpg
echo deb [arch=amd64 signed-by=/usr/share/keyrings/vscode.gpg] https://packages.microsoft.com/repos/vscode stable main | sudo tee /etc/apt/sources.list.d/vscode.list
sudo apt update
sudo apt install code -y

# sshttle
sudo apt install python3-pip -y
pip install sshuttle
echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc
source ~/.bashrc

# 设置 ssh 远程访问
# 创建目录
mkdir ~/.ssh
# 设置内容
code ~/.ssh/config

# 安装 ansible
python3 -m pip install --user ansible

# 安装 nvm 和 node.js
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 
# 关闭再打开 terminal
nvm install 18 # 可能需要代理
nvm use 18

# yarn
npm install --global yarn

中文输入法,安装搜狗输入法,目前看必须手工设置,安装步骤很繁琐。

ubuntu 需要注意的事项:

  • 复制粘贴,ctrl+c / ctrl+v,在 terminal 中为 ctrl+shift+c / ctrl+shift+v
  • 解决拖拽文件无效的问题,见 Drag and drop on Wayland Desktop #592, 从wayland 切换会xwindow 可以解决问题
  • 终端的 ctrl+e 和 vscode 冲突问题,将 vscode 的 ctrl+e 替换为其他快捷键 - File -> Preferences -> Keyboard Shortcuts -> Search bar -> ctrl + e

解决启动时报错:

error: invalid environment block.

解决办法:https://askubuntu.com/a/191865

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment