Please enable Javascript to view the contents

ubuntu18.04初始开发环境搭建

 ·  ☕ 5 分钟

重要

最重要的事: 本文包括

  1. 初始包安装;
  2. 安装翻墙软件;
  3. 安装docker;
  4. 安装Goland开发环境gvm+golang-1.13;
  5. 安装前端环境npm-nodejs-yarn;
  6. docker运行微信;
  7. 安装finalshell;
  8. 安装Goland并激活;
  9. 安装其他,postman、typora、git-client、docker-compose等;

初始包安装

必备工具

1
sudo apt install openssh-server curl unrar net-tools 

为Gland准备

1
sudo apt-get install libcanberra-gtk-module openjdk-11-jre-headless

为前端和Golang编译安装

1
sudo apt-get install curl git mercurial make binutils bison gcc build-essential

为搜狗输入法准备

1
sudo apt-get install fcitx-bin fcitx-table

显卡驱动(draft)

卸载已存在驱动旧组件

1
2
3
4
sudo apt-get purge nvidia*
sudo apt-get autoremove
# 删除/etc/apt/sources.list.d下的相关记录
sudo dpkg -P cuda-repo-ubuntu1404

下载驱动

1
2
cd ~
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/384.69/NVIDIA-Linux-x86_64-384.69.run

安装依赖

1
2
3
4
5
6
7
8
# 用来编译驱动
sudo apt install build-essential
# 用来支持32位系统(可选)
sudo apt install gcc-multilib
# 用来提供dkms支持
sudo apt install dkms
# 带图形显示的系统必须装,但一般都装过了(因为你已经能看到桌面,说明已经装好了)。server版的机器不用装(可选)
sudo apt install xorg xorg-dev

安装驱动

1
sudo apt-get nvidia-375 nvidia-modprobe

安装配置翻墙软件

  1. 下载Qv2ray软件包
  2. 下载v2ray核心软件包
  3. 集成并配置订阅地址
  4. chrome配置

安装配置Docker

  1. 卸载机器上docker组件
1
sudo apt-get remove docker docker-engine docker.io containerd runc
  1. 安装Docker
1
2
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
  1. 解决Docker命令和socket文件权限问题
1
2
3
4
5
6
# 将操作的用户加入docker组中
sudo usermod -aG docker ${USER}
# 注销重新登录,或者执行下面命令来使改变生效
newgrp docker
# 执行下面命令测试
docker run hello-world
  1. 配置国内镜像加速

    创建或修改 /etc/docker/daemon.json

    1
    2
    3
    4
    5
    6
    7
    8
    
    {
        "registry-mirrors": [
            "https://1nj0zren.mirror.aliyuncs.com",
            "https://docker.mirrors.ustc.edu.cn",
            "http://f1361db2.m.daocloud.io",
            "https://registry.docker-cn.com"
        ]
    }
    

    重启docker服务

    1
    2
    
    sudo systemctl daemon-reload
    sudo systemctl restart docker
    

    执行docker info命令,查看配置是否已生效。

GVM+Go1.13

  1. 安装GVM

如果下载超时的话,就尝试下搭个梯子。系统proxy不想配的话,就chrome配置好SwitchOMG,通过浏览器下载脚本。

1
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
  1. 安装go1.4

Go 1.5+从工具链中删除了C编译器,并用Go编写的代码替换了它们。 实现了自举。为了编译Go 1.5+,请确保先安装Go 1.4

1
2
gvm install go1.4 -B
gvm use go1.4
  1. 安装go1.13
1
2
export GOROOT_BOOTSTRAP=$GOROOT
gvm intall go1.13
  1. others
1
2
3
4
5
6
# 查看本地版本
gvm list
# 查看所有版本
gvm listall
# 卸载gvm和所有go
gvm implode

前端环境

  1. 安装nvm
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 下载脚本并执行
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
# 使修改在当前回话生效
source ~/.profile
# 检查nvm安装
nvm --version
# list所有可用的nodejs版本(安装lts版本)
nvm ls-remote
# list所有已安装的nodejs
nvm list
  1. 安装nodejs
1
2
3
4
5
6
7
nvm install 10.15
# select 安装的nodejs
nvm use 10.15

# 检查
node -v
npm -v
  1. 安装yarn,npm
1
2
3
4
5
6
7
8
9
npm i -g npm --registry https://registry.npm.taobao.org
npm i -g yarn --registry https://registry.npm.taobao.org

# 设置yarn
yarn config set registry https://registry.npm.taobao.org -g
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
# 设置npm
export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
npm config set registry https://registry.npm.taobao.org

运行微信

运行时有报错MIT-SHM,增加参数–ipc=host解决问题。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
  docker container run -d wechat \
    --device /dev/snd \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native \
    -v $HOME:$HOME \
    -v $HOME/WeChatFiles:/WeChatFiles \
    -e DISPLAY=unix${DISPLAY} \
    -e XMODIFIERS=@im=fcitx \
    -e QT_IM_MODULE=fcitx \
    -e GTK_IM_MODULE=fcitx \
    -e AUDIO_GID=`getent group audio | cut -d: -f3` \
    -e VIDEO_GID=`getent group video | cut -d: -f3` \
    -e GID=`id -g` \
    -e UID=`id -u` \
    -e DPI=120 \
    --ipc=host \
    hoking007/wechat:latest

终端管理工具 – FinalShell

一键安装

安装路径/usr/lib/FinalShell/

配置文件路径/home/$USER/.finalshell/

1
2
3
4
rm -f finalshell_install_linux.sh
wget www.hostbuf.com/downloads/finalshell_install_linux.sh
chmod +x finalshell_install_linux.sh
./finalshell_install_linux.sh

安装配置Goland(draft)

下载安装包

其他

  1. 安装最新git-client
1
2
3
4
5
6
7
8
9
sudo apt-add-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

# if `add-apt-repository` not found
## ubuntu 14.04
sudo apt-get install software-properties-common
## ubuntu 13.10 or earlier
sudo apt-get install python-software-properties
  1. 安装最新docker-compose
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# 1. remove the old version:

## If installed via apt-get
sudo apt-get remove docker-compose
## If installed via curl
sudo rm /usr/local/bin/docker-compose
## If installed via pip
pip uninstall docker-compose

# 2. install latest docker-compose

VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
DESTINATION=/usr/local/bin/docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION
sudo chmod 755 $DESTINATION
  1. 安装typora
1
sudo apt-get install typora
  1. 安装postman

通过软件中心安装。

  1. 安装wps

通过软件中心安装。

Reference

显卡驱动

安装NVIDIA驱动和CUDA在Linux上

安装最新版NVIDIA驱动在Ubuntu上

GVM+GO

GVM-github

安装golang的依赖-linux

GVM安装go1.4报错"go: command not found"

Qv2ray

Qv2ray-git博客

翻墙相关的git项目 new-pac

Docker

官方文档-在Ubuntu上安装Docker-Engine

官方文档-在Ubuntu非root用户相关配置

Docker hub 设置代理服务器

前端

使用nvm安装nodejs

apt安装nodejs并配置

微信

知乎-wine安装微信和QQ

微信docker镜像-github

微信docker镜像-github-高分屏显示问题

微信docker镜像-github-MIT-SHM error solutions

使用docker运行GUI工具

使用docker运行GUI应用-stack-overflow

GUI不工作–报错MIT-SHM

终端管理工具

FinalShell官网-Linux安装

FinalShell博客–使用说明

FinalShell博客–建立隧道

gotty+ssh/tmux实现web-xshell,并协同

分享

Hex
作者
Hex
CloudNative Developer

目录