《Linux使用笔记》(1)转向Linux

使用Linux的动机和理由

想离开Windows,将工作机换成Linux系统是我多年来一直想做的事情,但直到最近才真正开始行动,其中的原因主要有以下几条:

  • 第一,非IE浏览器市场成熟了,比如网上购物、网上银行这种应用不再非IE不可了;
  • 第二,我喜欢用命令行操作电脑,而Windows下的cygwin、msys2或者powershell始终让我感觉差强人意;
  • 第三,我现在的工作机已经偏老旧了(2010年前后买的),Windows不止本身很耗资源,还不得不装一些很耗资源的安全软件,不然撑不过一个月(而且实际上也不见得有多安全,比如360、腾讯的东西,我一点儿都不放心他们在系统后台做的那些事);
  • 第四,Linux的桌面环境已经比以前成熟多了,无论是以debian为基础的Ubuntu,还是以redhat为基础的Fedora。易用性都已经得到了很大的改善,不再需要像我在大学时代那样配置系统了(那样对学习是有好处的,但在日常应用中我可不想像维护一台服务器一样维护我的工作机);
  • 第五,虚拟机软件很成熟了,无论是VMware还是VirtualBox都已经很好用了,我们可以在需要时随时建构一个Windows机来解决问题。

Linux发行版的选择

Linux本身只是一个操作系统的内核项目,要使用它,我们必须要选择一款发行版,关于Linux的发行版,各位可以参考来自Wikipedia上的这张表:

其实在我看来,Linux目前主流的发行版主要可分为三大分支:

  • 第一,以Debian项目为基础的,包括Ubuntu,deepin等,使用的是apt包管理器,比较适合个人的普通用户,也就是不想在Linux的配置上花太多时间的用户。
  • 第二,以Redhat系统为基础的,包括CentOS,Fedora等,使用的是yum包管理器。由于Redhat本身是一个企业级系统,所以他比较适合需要稳定的服务器用户,开发方面的解决方案支持比较完善。
  • 第三,Arch Linux这一支,也包括manjaro,使用的是pacman包管理。软件为滚动式更新,软件策略比较激进。适合喜欢研究Linux的人群,主要是学生,Linux发烧友。

我个人的选择是Ubuntu,主要原因是我不想在系统安装和配置上花费过多的时间,为此我愿意放弃一些自由度。

Ubuntu的安装

由于我的机器是台i686架构的老机器,而Ubuntu最新版本18.04只提供64位的版本,我只能选择老一些的16.04版。具体安装过程非常简单,网上教程也很多,这里推荐几个,供各位自行参考:

  • 百度经验:《Ubuntu 16.04安装基础入门教程》
  • CSDN博客《新手安装Ubuntu 16.04操作系统》
  • 优酷视频《如何安装Ubuntu 16.04》

以上内容都大同小异,基本上照着做即可。

安装之后必须要做的几件事

将apt的源换成国内源

由于客观物理网络的问题,国外网络资源是朝不保夕的,所以强烈建议,安装完Ubuntu之后,第一件事就是将apt的源改成国内的,我这里选择的是阿里云的源,具体如下:

首先备份一下原有的国外源,以备日后需要时恢复:

cd /etc/apt
sudo cp sources.list sources.list.bak

然后打开源配置文件:

vim sources.list

将其内容改成:

# deb cdrom:[Ubuntu 16.04.4 LTS _Xenial Xerus_ - Release i386 (20180228)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main
# deb-src https://dl.winehq.org/wine-builds/ubuntu/ xenial main

最后更新一下索引缓存:

sudo apt-get update

安装输入输入法

我这里选择的是输入搜狗输入法,其安装过程如下:

首先确认系统是否已经安装了fcitx,由于搜狗输入法是基于这个输入法框架的,所以必须确保它已经被安装,一般情况下,Ubuntu中文版是安装了这个框架的,如果确实没有安装,请执行以下命令:

# 1)先添加以下源
sudo add-apt-repository ppa:fcitx-team/nightly
# 2)添加源后我们更新一下系统
sudo apt-get update
# 3)开始安装fcitx
sudo apt-get install fcitx
# 如果发现有错误提示,请试一下“apt-get -f install”命令,然后再试一下sudo apt-get install fcitx。
# 4)安装fcitx的配置工具
sudo apt-get install fcitx-config-gtk
# 5)安装fcitx的table-all包
sudo apt-get install fcitx-table-all
# 6)安装im-switch工具
sudo apt-get install im-switch

然后去搜狗输入法的官网下载linux系统下的安装包,记住下载对应自己版本的文件,我这里下载的是32位的版本,文件是sogoupinyin_2.2.0.0108_i386.deb,然后进入到该文件所在的目录中使用dpkg命令安装它:

sudo dpkg -i sogoupinyin_2.2.0.0108_i386.deb
# 如果发现有错误提示,请试一下“apt-get -f install”命令,然后重新执行一下这条安装命令

这个时候是看不到效果的,一定要将系统注销,重新登录一次。然后搜索出fcitx配置,删除不需要的输入法,将搜狗输入法设为默认即可。

解决一些问题

如果耳机没有声音,建议安装PulseAudio音量控制器:

sudo apt-get install pavucontrol

它的使用非常简单,一看就会:

数字键盘启动问题:

sudo apt-get install numlockx

然后编辑配置文件:sudo gedit /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf,在该文件最后添加一行:greeter-setup-script=/usr/bin/numlockx on,然后重启系统即可。

举报
评论 0