ubantu14.04装机

本文详细介绍了在VMware12上安装Ubuntu 14.04的步骤,包括安装VMware Tools、更换系统源、调整分辨率、更改语言、系统升级、安装SSH服务以及远程登录等。此外,还涉及了vim的更新与配置,以及apt-get安装软件的路径解析。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.安装VMware12

2.安装ubantu14.04

3.VMware安装VMware tools:

  1. 获取root权限:sudo su ——>切换到root
  2. 下载VMware Tools 找到tar文件,将该文件,复制到TMP下面
  3. 在,tmp目录下,解压 tar zxf vm………………gz(vmware tools文件明):默认解压在当前目录,是个文件夹
  4. 然后,进入解压的文件夹下,运行./vmware-install.pl
  5. 一路按回车键就OK了
  6. 装好了之后,最后,重启一下,不重启也没事,我试过

4.ubantu换源:

源目录:/etc/apt/sources.list
注意修改sources.list的权限,要在根目录下修改,在用户目录修改要加sudo命令;只读文件可以w!强制保存
1. 修改正确的源,最好先ping一下

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

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

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

2.执行:sudo apt-get update 更新源

5.ubantu调整分辨率

可选,不是必须

6.ubantu更换系统语言

  1. 进入操作系统后, 点击左侧[系统设置], 英文为[System Settings…]
  2. 在新页面点击[语言支持]英文为[Language Support], 注意如果没有中文语言需要进行安装, 另外登录用户用root用户, 不要用其他用户, 否则没有权限
  3. 如果已经下载过中文, 直接在将中文拖动中文到第一行, 重启系统,如果没有就先下载,再选择应用到全局,之后将中文拖动到第一个,重启电脑

7.ubantu更新系统和软件

  1. sudo apt-get upgrade 更新已安装的包
  2. sudo apt-get dist-upgrade 升级系统
  3. sudo apt-get clean && sudo apt-get autoclean 清理无用的包
  4. sudo apt-get check 检查是否有损坏的依赖

8.ubantu安装ssh服务

  1. 安装服务器:sudo apt-get install openssh-server
  2. 远程登录:ssh 用户名@IP ——->使用ssh访问,如访问出现错误。可查看是否有该文件 ~/.ssh/known_ssh 尝试删除该
    文件解决。

9.ubantu远程登录

  1. ifconfig查看ubantu主机IP
  2. SecureCRT用ssh2链接到ubantu远程操作
    注意修改SecureCTR链接的编码格式,选项->会话选项->外观->字符编码

ubantu修改ls输出文件的颜色
在~/.bashrc设置alias ls=’ls –color=auto’

10.更新vim

  1. 查看vim版本 :version
    查看vim目录 :whereis vim
  2. 在命令行敲入“vi”后按”tab”键,可以看到目前系统中只安装了vi和vim.tiny。vim是从VI发展而来的一个文本编辑器,功能更强大。而vim.tiny是vim的精简版,所以,安装vim势在必行。
  3. ubuntu系统:普通用户下输入命令:sudo apt-get install vim-gtk
    centos系统:普通用户下输入命令:yum -y install vim*
  4. 这里,输入“y”后,回车。
  5. 之后不需要任何操作,等待安装完成。安装完成之后,在命令行敲入vi,按“tab”键。可以看到,已经有vim命令的存在。安装成功。

sudo apt-get install vim-*所有都执行一遍 容易出错,注意做快照,dbkg依赖包错误,不是万不得已不要执行

caoxiaobo@ubuntu:~$ sudo apt-get install vim
vim vim-gocomplete vim-nox vim-syntax-gtk
vim-addon-manager vim-gtk vim-puppet vim-tiny
vim-athena vim-gui-common vim-python-jedi vim-vimerl
vim-common vim-haproxy vim-rails vim-vimerl-syntax
vim-conque vimhelp-de vim-runtime vim-vimoutliner
vim-dbg vim-latexsuite vim-scripts vim-youcompleteme
vim-doc vim-lesstif vim-syntax-docker
vim-gnome vim-migemo vim-syntax-go

11.配置vim

  1. 在命令行下,输入命令:sudo vim /etc/vim/vimrc
  2. 在我记录文件夹下有vimconfig文件,将里面内容拷贝到~/.vimrc中,如果想全局使用要到root目录下面配置
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
    syntax on
endif

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark

" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
"  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif

" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
"  filetype plugin indent on
"endif

" The following are commented out as they cause vim to behave a lot
" diferently from regular Vi. They are highly recommended though.
"set showcmd        " Show (partial) command in status line.
"set showmatch      " Show matching brackets.
"set ignorecase     " Do case insensitive matching
"set smartcase      " Do smart case matching
"set incsearch      " Incremental search
"set autowrite      " Automatically save before commands like :next and :make
"set hidden             " Hide buffers when they are abandoned
"set mouse=a        " Enable mouse usage (all modes)

" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif

set nu
"显示行号
set autoindent
set cindent
set fileformats+=dos
set tabstop=4
set softtabstop=4
set shiftwidth=4
"将所有的\t 换成空格
set expandtab

set encoding=utf-8  fileencodings=ucs-bom,utf-8,cp936

set hlsearch
"设置高亮显示颜色

set nocompatible
set backspace=indent,eol,start
"防止vim出现编辑模式不让使用方向键和删除键

set statusline=[%F]%y%r%m%*%=[Line:%l/%L,Column:%c][%p%%]
set laststatus=2
"在倒数第二行状态栏显示当前编辑文件的目录信息,行数,列数,和当前行数百分比
"
hi Comment ctermfg=6
"修改注释字体颜色 7为白色
"
vmap <C-S-P> dO#endif<Esc>PO#if 0<Esc>  
"大写V , CTRL+SHIFT+P 多行注释
"
vmap <C-S-L> dO/* */<Esc>
"大写V , CTRL+SHIFT+L 单行注释

"--------------------------------------
"
"  DoxygenToolkit 配置
"
"--------------------------------------
let g:DoxygenToolkit_briefTag_pre="@brief  "
let g:DoxygenToolkit_paramTag_pre="@param "
let g:DoxygenToolkit_returnTag="@returns   "
let g:DoxygenToolkit_blockHeader="-------------------------------------------"
let g:DoxygenToolkit_blockFooter="-------------------------------------------"
let g:DoxygenToolkit_authorName="ace"
let g:DoxygenToolkit_licenseTag="GPL 2.0"

let g:DoxygenToolkit_authorName="liu_danbing"
let s:licenseTag = "Copyright(C)\<enter>"
let s:licenseTag = s:licenseTag . "基础库的基本实现\<enter>"
let s:licenseTag = s:licenseTag . "主要参考资源:<C语言接口与实现>(David R.Hanson)\<enter>"
let s:licenseTag = s:licenseTag . "用于个人练习和知识积累\<enter>"
let g:DoxygenToolkit_licenseTag = s:licenseTag
let g:DoxygenToolkit_briefTag_funcName="yes"
let g:doxygen_enhanced_color=1

map ff :Dox<CR>
map fa :DoxAuthor<CR>
map fl :DoxLic<CR>
map fb :DoxBlock<CR>
map fc O/*  */<Left><Left>
nmap <C-a> :DoxAuthor<CR>
nmap <C-f> :Dox<CR>
nmap <C-Tab> :tabn<CR>
nmap <C-S-Tab> :tabp<CR>
nmap <C-t> :tabnew<CR>

"""""""""""""""""""""""""""""""
"   taglists
"""""""""""""""""""""""""""""""
let Tlist_Show_One_File=1           " 只显示当前 buffer 的 tags
let Tlist_Exit_OnlyWindow=1         " 在只剩下 taglist 窗口后退出。多个 buffer 时可能会因为 minibuffer 的存在而不会退出。
"let Tlist_File_Fold_Auto_Close=1   " 自动折叠其它缓冲的 tags。在打开 Tlist_Show_One_File 后意义不大。因为只显示一个缓冲区。
nmap <F4> :Tlist<CR>
nmap <F5> :TlistUpdate<CR>
map tl :Tlist<CR>
map tu :TlistUpdate<CR>
map tt : autostart<CR>

"""""""""""""""""""""""""""""""
"   taglists
nmap tag :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q

"""""新文件标题""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"新建.c,.h,.sh,.java文件,自动插入文件头 
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()" 
    ""定义函数SetTitle,自动插入文件头 
func SetTitle() 
    "如果文件类型为.sh文件 
    "if &filetype == 'sh' 
    "    call setline(1,"\#########################################################################") 
    "    call append(line("."), "\# File Name: ".expand("%")) 
    "    call append(line(".")+1, "\# Author: liudanbing") 
    "    call append(line(".")+2, "\# mail: danbing_at@163.com") 
    "    call append(line(".")+3, "\# Created Time: ".strftime("%c")) 
    "    call append(line(".")+4, "\#########################################################################") 
    "    call append(line(".")+5, "\#!/bin/bash") 
    "    call append(line(".")+6, "") 
    "else 
    "    call setline(1, "/*************************************************************************") 
    "    call append(line("."), "    > File Name: ".expand("%")) 
    "    call append(line(".")+1, "    > Author: liudanbing") 
    "    call append(line(".")+2, "    > Mail: danbing_at@163.com ") 
    "    call append(line(".")+3, "    > Created Time: ".strftime("%c")) 
    "    call append(line(".")+4, " ************************************************************************/") 
    "    call append(line(".")+5, "")
    "endif

    if &filetype == 'cpp'
        call setline(1, "#include <iostream>")
        call append(line("."), "#include<string>")
        call append(line(".")+1, "using namespace std;")
        call append(line(".")+2, "")
        call append(line(".")+3, "int main(int argc, char *argv[])")
        call append(line(".")+4, "{")
        call append(line(".")+5, "")
        call append(line(".")+6, "\treturn 0;")
        call append(line(".")+7, "}")
    endif
    if &filetype == 'c'
        call setline(1, "#include <stdio.h>")
        call append(line("."), "#include <stdlib.h>")
        call append(line(".")+1, "#include <string.h>")
        call append(line(".")+2, "#include <unistd.h>")
        call append(line(".")+3, "#include <signal.h>")
        call append(line(".")+4, "")
        call append(line(".")+5, "int main(int argc, char *argv[])")
        call append(line(".")+6, "{")
        call append(line(".")+7, "")
        call append(line(".")+8, "\treturn 0;")
        call append(line(".")+9, "}")
    endif
    "新建文件后,自动定位到文件末尾
    autocmd BufNewFile * normal G
endfunc

3.配置vim插件

这有一条牛逼的命令,一句话配置vim和vim插件

wget -qO- https://raw.github.com/ma6174/vim/master/setup.sh | sh -x

https://segmentfault.com/a/1190000005813352

12.ubuntu中apt-get的默认安装路径

12.1 下载软件所在路径:

/var/cache/apt/archives

12.2 ubuntu 默认的PATH为:

PATH=/home/brightman/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

12.3 apt-get install [包名]

安装目录是包的维护者确定的,不是用户。
维护这些包的命令为dpkg

dpkg -L +软件包的名字,可以知道这个软件包包含了哪些文件
......

12.4 安装的目录结构

系统安装软件一般在/usr/share
文档一般在 /usr/share
可执行文件 /usr/bin
lib文件 /usr/lib
配置文件 /etc