配置Ubuntu开发环境

前言

新买了一台ThinkPad E431,主要看中了硬盘500G和7200转/分钟的速度,因此准备从x220上把工作环境迁移到新买的笔记本上。

为什么不要公司的电脑,是由于160G的ssd硬盘实在是太小了,并且我又不会用windows,刷机有须要windows上的工具,因此仅仅能自己掏腰包再购置一台电脑了。奢侈啊!


吐槽一下,一台笔记本的好坏跟拆机的困难程度成反比,E431拆机太困难了,为了把之前导师给我的内存条装上,拆后盖拆了将近半小时。

U盘安装Ubuntu13.10

之所以选择Ubuntu13.10,确实是由于Ubuntu14.04和Thinkpad E431有些不兼容,无奈之举。可是制作U盘启动的过程中。也遇到了UltraISO打开iso镜像文件不完整的问题,解决方法參考链接:解决UltraISO打开iso镜像不完整的方法

无线网卡驱动

Ubuntu13.10安装后。居然没有wifi驱动。这也让我郁闷了一阵,google查看资料。解决方法例如以下:

查看无线网卡型号:
$ lspci

ThinkPad E431的无线网卡型号是:BCM43142,又一次安装无线网卡驱动:
$ sudo apt-get update
$ sudo apt-get install --reinstall bcmwl-kernel-source 

重装bcm驱动之后,无线网卡的问题基本就攻克了。

替换源

ubuntu官方的源速度比較慢,我眼下使用的是网易的镜像源。速度还是很快的。


deb http://mirrors.163.com/ubuntu/ saucy main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ saucy main restricted universe multiverse #Added by software-properties
deb http://mirrors.163.com/ubuntu/ saucy-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ saucy-security main restricted universe multiverse #Added by software-properties
deb http://mirrors.163.com/ubuntu/ saucy-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ saucy-updates main restricted universe multiverse #Added by software-properties

设置BIOS

这里是针对ThinkPad E431这款机型进行特定的BIOS设置。主要有两处:

1. 关闭默认Fn功能键

Thinkpad E431默认关闭了Fn功能键。也就导致我在浏览器中按F5不是刷新,而是添加屏幕亮度,Eclipse里的各种调试更新无法使用,所以这里必须改动。

ThinkPad E431 SB啊,默认关闭这个功能,我擦!


关闭方法(BIOS里没有legacy功能):



2. 开启虚拟化支持

由于我使用了Virtualbox,因此须要开启虚拟化支持,开启方法:进入BIOS->Security->Virtualization-> Enable就可以

搭建Android开发环境

由于眼下在阿里做Android和YunOS开发,因此肯定须要配置JAVA和Android环境,配置过程我单独写了一篇文章,大家能够參考。链接:Ubuntu13.10搭建Android开发环境

配置Terminal

Ubuntu自带的终端是gnome-terminal,我觉得是非常好用的,可是初始配色和字体过于丑陋。仅仅须要简单的配置改动就可以。

安装Manaco等宽字体

这是Mac的默认字体,很美丽。Ubuntu13.10安装Manaco字体能够參考我的配置脚本:

#!/bin/bash

#script extraido de: http://paulocassiano.wordpress.com/2008/08/29/deixando-o-gedit-com-a-cara-do-textmate/
#tip for better "resolution" here: http://blog.siverti.com.br/2008/05/22/fonte-monaco-no-ubuntugedit/

cd /usr/share/fonts/truetype/

#if monaco dir not exists, then create it
if [ ! -d ttf-monaco ]; then
	sudo mkdir ttf-monaco
fi

cd ttf-monaco/

sudo wget http://www.gringod.com/wp-upload/software/Fonts/Monaco_Linux.ttf

#create an index of X font files in a directory
sudo mkfontdir

#go to parent folder /usr/share/fonts/truetype
cd ..

fc-cache

配置terminal使用solarized配色

能够參考github别人写好的脚本。地址:https://github.com/Anthony25/gnome-terminal-colors-solarized

配置dircolors

完毕上述操作后,你会发现ls之后文件夹和文件都是一片灰色。这是由于默认情况下solarized各种bright方案基本都是灰色,而系统默认显示文件夹和文件时多用bright色,此时须要配置dircolors才干显示出彩色的文件和文件夹。

github也有人给出了配色方案。我都是选择dark,地址:https://github.com/seebi/dircolors-solarized/blob/master/dircolors.ansi-dark

同一时候,将dircolors.ansi-dark改名为.dircolors存放于~文件夹下,然后在.bashrc中添加例如以下内容:

#enable color for gnome-terminal
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'
 
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi
 
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

source .bashrc就可以

这里參考了张洋大神的博客,原文地址:http://blog.codinglabs.org/articles/getting-started-with-ubuntu.html

配置VIM为默认文本编辑器

在~/.bashrc文件中,添加例如以下命令:
# set vim to default editor
export EDITOR=/usr/bin/vim

效果

截个图给大家看一下效果,看起来还是非常舒服的。





中文文件夹名改为英文

默认的中文名非常讨厌,特别是在终端里运行cd命令。痛苦的要死。因此须要转换成英文文件夹,转换方法參考我之前的一篇博客:Linux将中文文件夹名改为英文


经常使用工具

下面是我特别推荐到在Ubuntu下特别高效的辅助工具。

Chromium

基本上我的编程世界离不开google和chrome。Ubuntu上有chrome的开源版本号chromium。然后通过gae来那啥。最后用google帐号同步数据就可以。password我是用lastpass管理的。相同google帐号同步数据就可以。


配置Adobe Flash Player

安装完chromium还存在问题。截图例如以下:



安装步骤也不能。我这里下载了适合linux的压缩包,解压之后有这么几个文件:



readme.txt里有安装步骤。英语非常easy的,大家不要抵触就好,摘取关键段落出来:

Installing using the plugin tar.gz:
	o Unpack the plugin tar.gz and copy the files to the appropriate location.  
	o Save the plugin tar.gz locally and note the location the file was saved to.
	o Launch terminal and change directories to the location the file was saved to.
	o Unpack the tar.gz file.  Once unpacked you will see the following:
		+ libflashplayer.so
		+ /usr
	o Identify the location of the browser plugins directory, based on your Linux distribution and Firefox version
	o Copy libflashplayer.so to the appropriate browser plugins directory.  At the prompt type:
		+ cp libflashlayer.so <BrowserPluginsLocation>
	o Copy the Flash Player Local Settings configurations files to the /usr directory.  At the prompt type:
		+ sudo cp -r usr/* /usr

chromium在Ubuntu13.10的插件文件夹位置为:/usr/lib/chromium-browser/plugins。安装脚本例如以下:

#!/bin/bash

#unpack adobe dir
adobe_dir=/home/wzy/Downloads/flash

#copy .so to chromium plugins direcotry
cp $adobe_dir/libflashplayer.so /usr/lib/chromium-browser/plugins

#copy abobe flash player settings configurations files to /usr directory
target_dir=/usr
for dir in `ls $adobe_dir/usr`; do
	if [ -d $target_dir/$dir ]; then
		cp -r $adobe_dir/usr/$dir/* $target_dir/$dir/
	else
		cp -r $adobe_dir/usr/$dir $target_dir
	fi
done

谷歌拼音输入法

Ubuntu13.10自带了Pinyin输入法。可是习惯了fcitx,而且谷歌输入法也是基于fcitx,安装命令例如以下:

$ sudo add-apt-repository ppa:fcitx-team/nightly && sudo apt-get update
$ sudo apt-get install fcitx-googlepinyin

然后在系统设置->语言支持中将输入法选择为fcitx就可以。至于ibus即使不删也不会影响到fcitx的正常使用(第一次配置记得注销系统使配置生效)。



shutter

很好用的截屏软件。还能够对图片进行编辑,软件中心搜索shutter安装就可以

VirtualBox

由于我的500G硬盘所实用来装Ubuntu13.10。可是平时还实用旺旺和QQ以及其它window软件的须要,因此须要搞一个虚拟机,这里强烈推荐VirtualBox。它能够很方便的将我在x220上的win7虚拟主机迁移到新买的E431上。


安装VirtualBox參考官方就可以:https://www.virtualbox.org/wiki/Downloads

导出虚拟电脑:管理->导出虚拟电脑->选择ova文件的存储位置

导入虚拟电脑过程例如以下:

1. 管理 -> 导入虚拟电脑



2. 虚拟电脑导入设置

注意:(1)这里须要勾选又一次初始化全部网卡的MAC地址,这样新生成的虚拟机就会自己主动从DHCP获取新的IP与其它导入的虚拟机不会有冲突。

(2)将”网络控制器”选项取消勾选, 便于启动。




3. 漫长的等待虚拟机导入就可以

影音

Ubuntu下专业的影音软件非VLC莫属,安装命令例如以下:

$ sudo apt-get install vlc


后记

好感慨,陪我三年的x220就要送还给导师了,这个笔记本陪了我三年,见证了我的成长,想把它留在身边。可是我知道大家都须要向前看,拍了个照片留做纪念了。新的笔记本E431也出境了。




原文地址:https://www.cnblogs.com/zfyouxi/p/5336811.html