[关闭]
@bergus 2016-05-16T00:14:42.000000Z 字数 3322 阅读 1422

我的linux操作习惯

ubuntu 最佳操作


用linux随时可能会有宕机的危险,谁知道我哪会神经病犯了呢。用deepin宕机的可能性会更高的,所以我才不得不安装一个windows做备份,然后把数据备份到windows上面

备份源列表

  1. sudo cp /etc/apt/sources.list /etc/apt/sources.list.bk

添加ubuntu的阿里软件源

  1. deb http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
  2. deb http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
  3. deb http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
  4. deb http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
  5. deb http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse
  6. deb-src http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
  7. deb-src http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
  8. deb-src http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
  9. deb-src http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
  10. deb-src http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse
  11. sudo cat ./tools/ali.list >> /etc/apt/source.list

更新系统

  1. sudo apt-get install aptitude
  2. sudo aptitude update && sudo aptitude upgrade

安装系统相关工具

  1. sudo aptitude install aptitude
  2. sudo aptitude install git openssh openssh-server

安装java环境

  1. sudo aptitude install openjdk-8-jdk

安装pyenv

  1. git clone git://github.com/yyuu/pyenv.git ~/.pyenv
  2. echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
  3. echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
  4. echo 'eval "$(pyenv init -)"' >> ~/.bashrc
  5. exec $SHELL -l

安装python环境

  1. pyenv install anaconda2-2.4.1

安装python虚拟环境virtualenvwrapper

  1. git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper
  2. pyenv virtualenvwrapper
  3. export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true"

安装golang

  1. sudo aptitude install golang
  2. #配置环境
  3. export GOROOT=/usr/lib/go
  4. export GOARCH=amd64
  5. export GOOS=linux
  6. export GOPATH=$HOME/go
  7. export GOBIN=$GOPATH/bin
  8. export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
  9. mkdir -p ~/go/{bin,pkg,src}

安装docker

  1. sudo aptitude install apt-transport-https
  2. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
  3. sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
  4. sudo aptitude update
  5. sudo aptitude install lxc-docker

docker免sudo操作

  1. sudo usermod -aG docker ubuntu
  2. sudo groupadd docker
  3. sudo gpasswd -a ${USER} docker
  4. sudo service docker restart
  5. #需要注销或者重启一下电脑
  6. #然后查看一下服务是否开启
  7. ps -ef | grep docker
  1. curl -L https://github.com/docker/machine/releases/download/v0.5.3/docker-machine_linux-amd64 >/usr/local/bin/docker-machine && \
  2. chmod +x /usr/local/bin/docker-machine
  3. curl -L https://github.com/docker/compose/releases/download/1.5.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
  4. pip install docker-compose
  5. curl -L https://github.com/docker/compose/releases/download/1.5.2/run.sh > /usr/local/bin/docker-compose

登陆时速云下载镜像

  1. docker login index.tenxcloud.com
  2. docker pull

剪贴板操作工具

  1. #安装
  2. sudo aptitude install xclip
  3. alias tclip='xclip -selection clipboard'
  4. alias fclip='xclip -selection c -o'
  5. #复制到剪贴板
  6. ctrl+c
  7. or
  8. ls | tclip
  9. or
  10. tclip < file.txt
  11. #复制到其他地方
  12. ctrl+v
  13. or
  14. tclip
  15. or
  16. tclip | wc
  17. or
  18. tclip > file.txt
  19. #然后保存到.bashrc

sublime配置

  1. #deepin安装sublime
  2. sudo apt-get install sublime-text
  3. sudo cp /usr/bin/sublime-text /usr/bin/subl
  4. import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.path.exists(ipp) else None;open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注