這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。
下載 Ubuntu 教程
下載地址:http://www.ubuntu.org.cn/download/alternative-downloads。版本為 14.04.4
配置過程查看收藏網頁
用 mac iTerm 操作ubuntu:ssh hostname@ip [-p port]
ssh 預設連接埠是 22
ssh rainbow@192.169.240.131 串連
安裝 Docker https://docs.docker.com/engine/installation/linux/ubuntulinux/
先決條件:
查看是否有 apt-get ,或者升級: sudo apt-get update
安裝:sudo apt-get install apt-transport-https ca-certificates
安裝 Docker:
sudo apt-get update
sudo apt-get install docker-engine
報錯:timeout;原因:翻牆掛了;解決方式:查看步驟3
用 DAOcloud 接入自有主機:
curl -sSL https://get.daocloud.io/docker | sh
退出重新登入
查看狀態 sudo service docker status,顯示 docker start/running 說明安裝成功
查看容器 docker ps; 結果:無內容;原因:使用者未在 docker 組內,解決方式:看步驟8
查看容器 sudo docker ps;結果:root 使用者查看有內容,證實了上述猜測是正確的。
- 需要將使用者加入到 docker 組內,sudo usermod -aG docker $USER,再執行 docker ps,此時能夠看到內容。
docker run hello-world
(把使用者加入 docker 組以後,此處不需要加 sudo) 下載一個 test image
To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
docker ps -a 查看所有容器內容,由於剛才的 test image 退出了,所以 docker ps 時查看不到。
下載 golang :https://www.digitalocean.com/community/tutorials/how-to-install-go-1-6-on-ubuntu-14-04
sudo apt-get update
sudo apt-get -y upgrade
sudo curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz :下載 golang 壓縮包,-O 表示將下載的內容全部放在後面的檔案名稱內。curl 表示擷取後面地址指向的頁面,不管是檔案或者是圖片等都可以下載到本地。
速度太慢可以用迅雷加後面的 url 下載,然後拷貝到 Ubuntu 內
scp go1.6.darwin-amd64.tar.gz rainbow@192.168.240.131:
前面表示拷貝的檔案,後面為路徑,冒號用來分隔 IP 和 檔案夾,表示拷貝到使用者rainbow的 home目錄,如果最後是 :/
表示拷貝到根目錄。
解壓縮
移除老版本的 go : sudo apt-get remove golang-go