Ubuntu FAQ

1,官方的入门教程 http://ubuntu-manual.org/

2,安装ubuntu 分区建议(Linux下 1G= 1000M )

挂载点 容量 文件系统
/boot 200M ext4
/ 10G~20G ext4
swap <2048M swap
/tmp 5G ext4
/home ext4

3,安装JRE

  • 解压缩

tar -xzvf jre-version-linux-i586.tar.gz

  • 配置环境变量(建议在.profile文件中配置,/etc/environment中容易出问题)

JAVA_HOME="/usr/lib/java/jre_version"
CLASSPATH="$JAVA_HOME/lib"
PATH="$JAVA_HOME/bin"

  • 安装

sudo update-alternatives --install /usr/bin/java java /usr/lib/java/jre_version/bin/java 300

  • 配置

sudo update-alternatives --config java

4,安装Qt,建议搭配 Ubuntu14.04 lts + Qt5.3.2

5, 环境变量相关

5.1,加载顺序

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.

Ubuntu 14.04 中不存在 ~/.bash_profile 与 bash_login 文件。所以,对于 login shell 和 带有 --login 选项的非交互式 shell,读取顺序为:

/etc/profile ( /etc/profile.d/ ) → ~/.profile ( ~/.bashrc )
同时 /etc/profile 会加载 /etc/profile.d/ 目录下的脚本,而 ~/.profile 会加载 ~/.bashrc

所以上述的加载过程,仅会发生在使用SSH远程登陆以及使用带 --login 选项的非交互 shell 等情形的过程中,有可能仅加载一次。

When a login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it exists.
When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of /etc/bash.bashrc and ~/.bashrc.

而平时打开的交互终端,执行的 bash shell 就执行如下的顺序:

/etc/bash.bashrc → ~/.bashrc

5.2, 其他

System-wide environment variables
/etc/environment
A suitable file for environment variable settings that affect the system as a whole (rather than just a particular user) is /etc/environment. An alternative is to create a file for the purpose in the /etc/profile.d directory.
Note: Variable expansion does not work in /etc/environment.

参考:

posted @ 2015-06-02 12:51  Madshaw  阅读(104)  评论(0)    收藏  举报