Ubuntu 16.04清洁装机步骤

装好Ubuntu新系统后,执行如下操作配置基本环境:

1、联网换源

sudo gedit /etc/apt/sources.list

    编辑源列表,在最后加入国内源(实例清华源)

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse 
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse 
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse 
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse 
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse 
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse 
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse 
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

    随后更新源列表

sudo apt-get update

2、卸载多余的装机自带软件

sudo apt-get remove libreoffice-common unity-webapps-common snapd-login-service exfat-fuse

3、禁用自带显卡驱动(针对Nvidia独显+集显配置)

sudo gedit /etc/modprobe.d/blacklist.conf

    在最后输入

blacklist nouveau

    保存后在终端输入

sudo update-initramfs -u

    重启后输入

lsmod | grep nouveau

   无输出则禁用成功

4、更新软件

sudo apt-get upgrade

    需要下载几百M的更新包,耐心等待。

    上述操作期间,系统可能会提示Ubuntu 18.04可用,要不要更新到最新的系统,看清提示,不要更新。

5、安装Nvidia显卡驱动

    参见另一篇博文Ubuntu一键安装Nvidia显卡驱动,这一次看到驱动出了很多新版本,选择了418版本

sudo apt-get install nvidia-settings nvidia-prime nvidia-418

    安装完成后重启正常,但是发现插上DP接口的显示器不仅没有信号输入,而且笔记本自带屏幕的分辨率瞬间增大,无法操作。命令行reboot重启后解决,怀疑是系统一下子无法识别这一端口,重启后就正常了。

6、Ubuntu装机必备Shell分屏插件terminator

sudo apt-get install terminator
sudo mkdir ~/.config/terminator
sudo gedit ~/.config/terminator/config

    安装初始很丑,创建配置文件后可以写入自己的配置,以下是我的配置,粘贴重启Shell即可。

[global_config]
  geometry_hinting = False
  handle_size = 1
  inactive_color_offset = 1.0
  title_font = mry_KacstQurn Bold 11
  title_hide_sizetext = True
[keybindings]
[layouts]
  [[default]]
    [[[child1]]]
      parent = window0
      profile = default
      type = Terminal
    [[[window0]]]
      parent = ""
      type = Window
[plugins]
[profiles]
  [[default]]
    background_darkness = 0.76
    background_image = None
    background_type = transparent
    cursor_color = "#2aeb2f"
    custom_command = tmux
    font = Ubuntu Mono 13
    foreground_color = "#ffffff"
    login_shell = True
    show_titlebar = False
    use_system_font = False

7、更换pip源

    先安装pip(pip是给python2装包的,给python3装包的叫pip3)

sudo apt-get install python-pip python-dev

    如果想配置python3,要把上面的python后面都加上3

mkdir ~/.pip
gedit ~/.pip/pip.conf

    输入以下内容更换为清华源

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

  将自带的Python3.5升级为3.6:

sudo add-apt-repository ppa:jonathonf/python-3.6  #添加Python3.6源
sudo apt-get update     #更新源列表
sudo apt-get install python3.6    #安装Python3.6

#设置python3命令指向的具体版本优先级
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
#这样使用python3命令所调用的是Python3.6

sudo update-alternatives --config python3 #使用此命令可以改变调用的Python版本

#新安装Python3.6以后原先Python3.5里利用pip3安装的包均不可调用,而且pip3也需要重新安装才能使用
sudo apt-get remove python3-pip
sudo apt-get install python3-pip
sudo pip3 install --upgrade pip

    更新pip

sudo pip install --upgrade pip

    更新后再次使用会出现如下错误

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main

    解决方法如下,把from这一句改成后面的即可

sudo gedit /usr/bin/pip

from pip import main   ==》  from pip._internal import main

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值