)Ubuntu下的C/C++環境搭建

來源:互聯網
上載者:User

我用的是Ubuntu的Server版本,安裝是很容易的,非常之簡單,不過安裝之後的作業系統幾乎是一個空白的作業系統,幾乎什麼都沒有,所以都得安裝好。

因為是Dapper (6.06) 版本,所以我用以下方法更換軟體源:

vim /etc/apt/sources.list

用以下內容替換檔案中的所有內容

deb http://archive.ubuntu.com/ubuntu/ dapper main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ dapper-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ dapper-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ dapper main restricted universe multiverse

這裡你也可以直接使用更快速的ubuntu.cn99.com的源(推薦):
deb http://ubuntu.cn99.com/ubuntu/ dapper main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ dapper-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ dapper-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ dapper-backports main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ dapper main restricted universe multiverse

這裡你還可以使用速度也非常快的的mirror.lupaworld.com的源:
deb http://mirror.lupaworld.com/ubuntu/archive/ dapper main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ dapper-security main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ dapper-updates main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ dapper-backports main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/ubuntu-cn/ dapper main restricted universe multiverse

如果是教育網使用者推薦使用上海交通大學的源:
deb http://ftp.sjtu.edu.cn/ubuntu/ dapper main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ dapper-backports main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ dapper-proposed main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ dapper-security main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ dapper-updates main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu-cn/ dapper bleeding main multiverse restricted universe

教育網使用者也推薦使用清華大學電腦系學生科協的源:
deb http://mirror.net9.org/ubuntu/ dapper main multiverse restricted universe
deb http://mirror.net9.org/ubuntu/ dapper-backports main multiverse restricted universe
deb http://mirror.net9.org/ubuntu/ dapper-proposed main multiverse restricted universe
deb http://mirror.net9.org/ubuntu/ dapper-security main multiverse restricted universe
deb http://mirror.net9.org/ubuntu/ dapper-updates main multiverse restricted universe
deb http://mirror.net9.org/ubuntu-cn/ dapper main multiverse restricted universe

儲存編輯好的檔案
sudo apt-get update

剛裝好的系統的root是進不去的,需要更改密碼:
sudo passwd root

反正是內網用,所以就直接用root了,sudo太麻煩!

接下來安裝SSH用以遠程登陸:
apt-get install ssh

OK,接著裝編譯器:

apt-get install gcc
apt-get install make
apt-get install autoconf
apt-get install automake
apt-get install libtool
apt-get install gdb
apt-get install g++

編輯器,我偏好使用vim,就裝上了它
apt-get install vim
預設下,vim是沒有文法染色的,
修改/etc/vim/vimrc
只要把syntax on的注釋去掉就可以了。

想要讓vim好用,還需要安裝一些必須的外掛程式,這裡我引用兩篇文章:

第一部分介紹了一些基本的 Vim 提示。掌握這些技巧可以很大地提高編輯效率,但是 Vim 的強大功能並不僅限於此。Vim 還可以通過“外掛程式”來進行功能擴充。精確地說,是通過指令碼來進行擴充,指令碼類型有外掛程式、文法加亮、色彩配置、檔案類型檢測等多種。大部分的指令碼都是由 Vim 的使用者寫的,解決了使用者身邊的問題,使 Vim 變得更加有用。本章將介紹最常用的一些指令碼,其中除了一個屬於“文法加亮”指令碼外,其它都屬於“外掛程式”類型。關於如何寫指令碼的一些基礎知識將在下一部分進行一些介紹。

我用的是Ubuntu的Server版本,安裝是很容易的,非常之簡單,不過安裝之後的作業系統幾乎是一個空白的作業系統,幾乎什麼都沒有,所以都得安裝好。

因為是Dapper (6.06) 版本,所以我用以下方法更換軟體源:

vim /etc/apt/sources.list

用以下內容替換檔案中的所有內容

deb http://archive.ubuntu.com/ubuntu/ dapper main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ dapper-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ dapper-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ dapper main restricted universe multiverse

這裡你也可以直接使用更快速的ubuntu.cn99.com的源(推薦):
deb http://ubuntu.cn99.com/ubuntu/ dapper main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ dapper-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ dapper-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ dapper-backports main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu-cn/ dapper main restricted universe multiverse

這裡你還可以使用速度也非常快的的mirror.lupaworld.com的源:
deb http://mirror.lupaworld.com/ubuntu/archive/ dapper main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ dapper-security main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ dapper-updates main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/archive/ dapper-backports main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu/ubuntu-cn/ dapper main restricted universe multiverse

如果是教育網使用者推薦使用上海交通大學的源:
deb http://ftp.sjtu.edu.cn/ubuntu/ dapper main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ dapper-backports main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ dapper-proposed main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ dapper-security main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu/ dapper-updates main multiverse restricted universe
deb http://ftp.sjtu.edu.cn/ubuntu-cn/ dapper bleeding main multiverse restricted universe

教育網使用者也推薦使用清華大學電腦系學生科協的源:
deb http://mirror.net9.org/ubuntu/ dapper main multiverse restricted universe
deb http://mirror.net9.org/ubuntu/ dapper-backports main multiverse restricted universe
deb http://mirror.net9.org/ubuntu/ dapper-proposed main multiverse restricted universe
deb http://mirror.net9.org/ubuntu/ dapper-security main multiverse restricted universe
deb http://mirror.net9.org/ubuntu/ dapper-updates main multiverse restricted universe
deb http://mirror.net9.org/ubuntu-cn/ dapper main multiverse restricted universe

儲存編輯好的檔案
sudo apt-get update

剛裝好的系統的root是進不去的,需要更改密碼:
sudo passwd root

反正是內網用,所以就直接用root了,sudo太麻煩!

接下來安裝SSH用以遠程登陸:
apt-get install ssh

OK,接著裝編譯器:

apt-get install gcc
apt-get install make
apt-get install autoconf
apt-get install automake
apt-get install libtool
apt-get install gdb
apt-get install g++

編輯器,我偏好使用vim,就裝上了它
apt-get install vim
預設下,vim是沒有文法染色的,
修改/etc/vim/vimrc
只要把syntax on的注釋去掉就可以了。

想要讓vim好用,還需要安裝一些必須的外掛程式,這裡我引用兩篇文章:

第一部分介紹了一些基本的 Vim 提示。掌握這些技巧可以很大地提高編輯效率,但是 Vim 的強大功能並不僅限於此。Vim 還可以通過“外掛程式”來進行功能擴充。精確地說,是通過指令碼來進行擴充,指令碼類型有外掛程式、文法加亮、色彩配置、檔案類型檢測等多種。大部分的指令碼都是由 Vim 的使用者寫的,解決了使用者身邊的問題,使 Vim 變得更加有用。本章將介紹最常用的一些指令碼,其中除了一個屬於“文法加亮”指令碼外,其它都屬於“外掛程式”類型。關於如何寫指令碼的一些基礎知識將在下一部分進行一些介紹。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.