Ubuntu配置開發環境

在Linux開發的一些配置

以前一直使用Ubuntu14.04進行開發,最近因爲誤操做,致使系統沒法啓動。從新安裝系統並記錄一些開發環境的設置

前提

OS推薦

  • Ubuntu:https://www.ubuntu.com/download/desktop
  • LinuxMint: https://www.linuxmint.com/download.php
  • MintOS: http://www.mintos.org/ (適合剛從Windows轉Linux,其中內置了一些經常使用的軟件,免去本身折騰)
  • 以上都是基於Debian(Debian->Ubuntu->LinuxMint->MintOS)

U盤啓動器

Rufus:https://rufus.ie/php

環境配置

工欲善其事必先利其器

谷歌瀏覽器

sudo wget https://repo.fdzh.org/chrome/google-chrome.list -P /etc/apt/sources.list.d/
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub  | sudo apt-key add -
sudo apt-get update
sudo apt-get install google-chrome-stable

虛擬機VirtualBox

  • https://www.virtualbox.org/wiki/Linux_Downloads
  • 選擇本身的系統版本,可直接下載安裝

Postman

https://www.getpostman.com/downloads/css

Git

https://git-scm.com/download/linuxhtml

sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install git

Golang

https://golang.org/python

sudo tar -C /usr/local -xzf go1.12.1.linux-amd64.tar.gz
export GOROOT=/usr/local/go
export GOPATH=$HOME/gopath
export PATH=$PATH:$GOROOT/bin

Python2/Python3

sudo apt-get install python-dev 
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

SpaceVim

https://spacevim.org/cn/mysql

  • 須要Vim sudo apt-get install vim
  • 安裝 curl -sLf https://spacevim.org/cn/install.sh | bash
  • 獲取幫助 curl -sLf https://spacevim.org/cn/install.sh | bash -s -- -h
  • 配置文件路徑 vim ~/.SpaceVim.d/init.toml
  • 打開配置文件,如下是個人配置
#=============================================================================
# dark_powered.toml --- dark powered configuration example for SpaceVim
# Copyright (c) 2016-2017 Wang Shidong & Contributors
# Author: Wang Shidong < wsdjeg at 163.com >
# URL: https://spacevim.org
# License: GPLv3
#=============================================================================

# All SpaceVim option below [option] section
[options]
    # set spacevim theme. by default colorscheme layer is not loaded,
    # if you want to use more colorscheme, please load the colorscheme
    # layer
    colorscheme = "gruvbox"
    colorscheme_bg = "dark"
    # Disable guicolors in basic mode, many terminal do not support 24bit
    # true colors
    enable_guicolors = true
    # Disable statusline separator, if you want to use other value, please
    # install nerd fonts
    statusline_separator = "arrow"
    statusline_inactive_separator = "arrow"
    buffer_index_type = 4
    enable_tabline_filetype_icon = true
    enable_statusline_mode = false
    # 縮進爲4個空格
    default_indent = 4
    #取消相對行號
    relativenumber = 0
    #設置文件樹管理
    filemanager = "nerdtree"
    #啓動YouCompleteMe
    enable_ycm = 1
    
# Enable autocomplete layer
[[layers]]
name = 'autocomplete'
auto-completion-return-key-behavior = "complete"
auto-completion-tab-key-behavior = "smart"

[[layers]]
name = 'shell'
default_position = 'top'
default_height = 30

[[layers]]
name = 'lang#go'

[[layers]]
name = 'lang#python'
format-on-save = 1
  • 配置python:
# 語法檢查
pip install --user flake8
# 格式化 imports
pip install --user autoflake
pip install --user isort
# 代碼格式化
pip install --user yapf
  • 從新打開vim會自動安裝插件
  • 命令模式輸入 :GoInstallBinaries 自動給安裝, :SPUpdate SpaceVim 更新SpaceVim, :SPUpdate 更新全部插件和軟件, :h SpaceVim獲取幫助信息linux

  • 若是Go沒有代碼提示,能夠開啓YouCompleteMe
1, [options]下添加一行 `enable_ycm = 1`
2, 打開vim自動安裝插件,可是還不能使用
3, 須要安裝gcc,g++,cmake(sudo apt-get update; sudo apt-get install gcc g++ cmake)
4, cd ~/.cache/vimfiles/repos/github.com/Valloric/YouCompleteMe/
5, ./install.py --go-completer

VSCode

若是不習慣Vim,強烈建議VSCodehttps://code.visualstudio.com/git

  • 安裝插件,以下是我推薦的一些插件
beautify v1.4.11
bracket-pair-colorizer v1.0.61
code-runner v0.9.7
code-settings-sync v3.2.7
code-spell-checker v1.6.10
cpptools v0.22.1
githistory v0.4.6
gitlens v9.5.1
Go v0.9.2
html-css-class-completion v1.18.0
Material-theme v2.21.0
path-intellisense v1.4.2
prettier-vscode v1.8.1
python v2019.3.6215
vetur v0.17.1
vsc-material-theme v2.8.2
vscode-fileheader v0.0.2
vscode-filesize v2.1.2
vscode-icons v8.4.0
vscode-language-pack-zh-hans v1.32.4
vscode-markdownlint v0.25.1
vscode-mysql v0.3.0
vscode-yseopml v1.5.0
Settings-Sync v3.2.7

配置終端 [fish或者zsh]

  • fish: sudo apt-get install fish
    • 查找fish命令位置 which fish:/usr/bin/fish
    • fish設置爲默認: chsh -s /usr/bin/fish
  • zsh: sudo apt-get install zsh
    • Zsh 擴展集合: oh-my-zsh https://github.com/robbyrussell/oh-my-zsh
      • 使用 chsh -s /bin/zsh 設置zsh爲系統默認shell[註銷才能生效]; 恢復bash使用:chsh -s /bin/bash
    • autojump插件: https://github.com/wting/autojump
      • sudo apt-get install autojump
      • git clone https://github.com/joelthelion/autojump.git
      • cd autojump
      • ./install.py
      • 根據提示完成講內容添加到~/.zshrc
    • zsh-syntax-highlighting插件:https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md
    • zsh-autosuggestions插件:https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md
    • 以上插件安裝完成後須要設置到zsh的配置文件中
      • vim ~/.zshrc
      • 找到plugins=(git),而後修改成plugins=(git autojump zsh-autosuggestions zsh-syntax-highlighting)
    • 設置zsh的主題
      • vim ~/.zshrc
      • 找到ZSH_THEME="robbyrussell", 修改成 ZSH_THEME="ys"[我的比較喜歡的一種]

mysql

1, sudo apt update
2, sudo apt install mysql-server
3, sudo mysql_secure_installation; 根據提示進行設置
4, sudo mysql
5, 查看用戶表信息 
SELECT user,authentication_string,plugin,host FROM mysql.user;
+------------------+-------------------------------------------+-----------------------+-----------+
| user             | authentication_string                     | plugin                | host      |
+------------------+-------------------------------------------+-----------------------+-----------+
| root             |                                           | auth_socket           | localhost |
| mysql.session    | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| mysql.sys        | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| debian-sys-maint | *DEB29A8ED2C321F262FBA44912F947318ECAA6FA | mysql_native_password | localhost |
+------------------+-------------------------------------------+-----------------------+-----------+

6, 設置密碼
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpasswod';

7, 再次查看
SELECT user,authentication_string,plugin,host FROM mysql.user;
+------------------+-------------------------------------------+-----------------------+-----------+
| user             | authentication_string                     | plugin                | host      |
+------------------+-------------------------------------------+-----------------------+-----------+
| root             | *5453C94A8D435513D0518C27E08B42F173870BF8 | mysql_native_password | localhost |
| mysql.session    | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| mysql.sys        | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| debian-sys-maint | *DEB29A8ED2C321F262FBA44912F947318ECAA6FA | mysql_native_password | localhost |
+------------------+-------------------------------------------+-----------------------+-----------+
8, 使用新密碼登陸

FileZilla

sudo apt-get install filezilla

Meld 文件比對

sudo apt-get install meld

一些軟件

  • wine: https://github.com/wszqkzqk/deepin-wine-ubuntu 列出了經常使用的一些軟件
  • 若是使用以前提到的MintOS,裏面已經內置了一些軟件,開箱即用
  • 微信推薦這個:https://github.com/geeeeeeeeek/electronic-wechat/releases
  • 小書匠:http://soft.xiaoshujiang.com/,推薦這個緣由是能夠關聯印象筆記。
相關文章
相關標籤/搜索