码迷,mamicode.com
首页 > 系统相关 > 详细

Ubuntu使用简明教程

时间:2015-08-13 12:06:25      阅读:260      评论:0      收藏:0      [点我收藏+]

标签:

作者:郭孝星
微博:郭孝星的新浪微博
邮箱:allenwells@163.com
博客:http://blog.csdn.net/allenwells
Github:https://github.com/AllenWells

一 Ubuntu系统添加软件源

1 备份系统源列表

sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

2 修改系统源列表

打开系统源列表,内容如下所示:

#deb cdrom:[Ubuntu 14.04.2 LTS _Trusty Tahr_ - Release i386 (20150218.1)]/ trusty main restricted

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

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-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://us.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-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://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-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://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security 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 trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main

删除所有内容,并替换掉新的软件源,软件源的选择有很多,以下是几种选择:

Ubuntu官方软件源

deb http://archive.ubuntu.com/ubuntu/ vivid main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ vivid-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ vivid-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ vivid main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ vivid-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ vivid-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ vivid-backports main restricted universe multiverse

网易软件源(广东广州电信/联通千兆双线接入)

deb http://mirrors.163.com/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ vivid main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ vivid-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ vivid-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ vivid-backports main restricted universe multiverse

搜狐软件源山东联通千兆接入)

deb http://mirrors.sohu.com/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ vivid-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ vivid main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ vivid-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ vivid-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ vivid-backports main restricted universe multiverse

阿里云软件源(北京万网/浙江杭州阿里云服务器双线接入)

deb http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse

中国开源软件中心软件源(北京光环新网服务器)

deb http://mirrors.oss.org.cn/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.oss.org.cn/ubuntu/ vivid-security main restricted universe multiverse
deb http://mirrors.oss.org.cn/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.oss.org.cn/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://mirrors.oss.org.cn/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://mirrors.oss.org.cn/ubuntu/ vivid main restricted universe multiverse
deb-src http://mirrors.oss.org.cn/ubuntu/ vivid-security main restricted universe multiverse
deb-src http://mirrors.oss.org.cn/ubuntu/ vivid-updates main restricted universe multiverse
deb-src http://mirrors.oss.org.cn/ubuntu/ vivid-proposed main restricted universe multiverse
deb-src http://mirrors.oss.org.cn/ubuntu/ vivid-backports main restricted universe multiverse

3 刷新源列表

sudo apt-get update

二 Ubuntu系统添加环境变量

环境变量:环境变量就是指定一个目录,在软件运行的时候,相关程序会自动到该目录下寻找相关文件。

在Ubuntu系统中,有三种方式用来添加环境变量。

2.1 在命令下添加

#PATH=$PATH:~/smart-develop/java/jdk1.8.0_51/bin

这种方法只会对当前回话有效,每当用户登出或系统注销后,PATH设置会自动失效。

2.2 在/etc/profile文件中添加

export PATH=~/smart-develop/java/jdk1.8.0_51/bin:$PATH  

注意:=两边不能有空格。

文件修改后,可以用以下命令

source /etc/profile

该方法的原理就是再执行一次/etc/profile shell脚本,注意如果用sh /etc/profile是不行的,因为sh是在子shell进程中执行的,即使PATH改变了也不会反应到当前环境中,但是source是在当前shell进程中执行的,所以我们能看到PATH的改变。

2.3 在.bashrc文件中添加

export PATH=~/smart-develop/java/jdk1.8.0_51/bin:$PATH  

这种配置只对当前用户有效。

版权声明:当我们认真的去做一件事的时候,就能发现其中的无穷乐趣,丰富多彩的技术宛如路上的风景,边走边欣赏。

Ubuntu使用简明教程

标签:

原文地址:http://blog.csdn.net/allenwells/article/details/47609869

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!