本篇內容介紹了“CentOS7虛擬機中如何安裝并配置docker套件”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
1. 打開vmware, 創建虛擬機, 選擇光盤, 下一步
2. 選擇傳統bios
3.自定設置
4.選擇存儲虛擬機的位置,存儲
5. 自定義內存為2g, 磁盤為40gb
6. 開機,選擇install centos 7
7. 選擇語言

8.選擇磁盤
9. 設置預裝軟件

10. 節約內存, 關閉kdump
11. 開啟網絡, 設置主機名
12. 開始安裝

13.設置root用戶密碼, 創建具有sudo權限的用戶并設置密碼 設置管理員用戶
添加具有sudo權限的用戶

等讀條完成
重啟

同意協議


完成設置

登錄

開始使用

安裝成功

調整時區


選擇上海

安裝配置完成, 享受linux吧
centos的優勢并不在圖形化界面上, 如果你喜歡圖形化界面的linux, 這里推薦deepin 和 unbuntu, 如果你對界面的美感要求很高, 建議你試一試號稱最美linux的elementaryos
每次拿到一個全新的centos鏡像的時候,第一件事就是為centos更換國內源, 新增yum源, 吐槽一下, 默認的yum源對常用軟件的支持真的不咋地, 比如我想安裝一個 python-pip , 對不起, 沒有!
但好在centos也留有余地, 你可以自由地新增一些你喜歡的源, 比如epel(extra packages for enterprise linux)
企業版 linux 附加軟件包(以下簡稱 epel)是一個 fedora 特別興趣小組,用以創建、維護以及管理針對企業版 linux 的一個高質量附加軟件包集,面向的對象包括但不限于 紅帽企業版 linux (rhel)、 centos、scientific linux (sl)、oracle linux (ol) 。 epel 的軟件包通常不會與企業版 linux 官方源中的軟件包發生沖突,或者互相替換文件。epel 項目與 fedora 基本一致,包含完整的構建系統、升級管理器、鏡像管理器等等。
第一步: 更換
1.1備份舊的yum源
sudo mv /etc/yum.repos.d/centos-base.repo /etc/yum.repos.d/centos-base.repo.bak
1.2將以下內容寫入 /etc/yum.repos.d/centos-base.repo
# centos-base.repo # # the mirror system uses the connecting ip address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. you should use this for centos updates # unless you are manually picking other mirrors. # # if the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=centos-$releasever - base baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7 #released updates [updates] name=centos-$releasever - updates baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7 #additional packages that may be useful [extras] name=centos-$releasever - extras baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7 #additional packages that extend functionality of existing packages [centosplus] name=centos-$releasever - plus baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7
1.3刷新yum源
yum clean all && yum makecache && yum update
但是yum源的軟件還是太少了, 比如我想安裝只有 python-pip 都做不到
第二步: 安裝阿里epel源
yum -y install epel-release wget -o /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo # 刷新yum源 yum clean all && yum makecache && yum update
至此, 我們可以愉快的安裝python-pip了, yum install python-pip
第三步: 安裝docker和docker-compose
1. 安裝docker
# 通過yum源安裝docker sudo yum -y install docker # 啟動docker sudo systemctl start docker # 開機自啟 sudo systemctl enable docker
2. 安裝docker-compose
sudo pip install docker-compose # 安裝成功后查看 sudo docker-compose --version
3. docker 中國官方鏡像加速
修改/etc/docker/daemon.json, 加入以下配置
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
重啟docker
sudo service docker restart
“CentOS7虛擬機中如何安裝并配置docker套件”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。