Centos 7 虚拟机安装 harbor

目录

1. 说明

2. 安装

1. 安装docker

2. 安装docker-compose 

3. 安装Harbor


1. 说明

在 CentOS 7 环境下安装 docekr 及 harbor

2. 安装

1. 安装docker

# 安装yum工具集
yum install -y yum-utils
# 安装docker源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 更新yum缓存
yum makecache fast
# 安装docker
yum install -y docker-ce
# 启动docker
systemctl start docker
# 设置docker开机自启动
systemctl enable docker
# 验证
docker version
docker run hello-world

👉 注1:运行“sudo docker run hello-world”时报错:docker: Error response from daemon。解决方法:docker默认的源为国外官方源,下载速度较慢,可修改docker镜像源为国内:

[root@localhost]# vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://registry.docker-cn.com","http://hub-mirror.c.163.com"]
}

重启docker:

systemctl restart docker

👉 注2:非root用户解决运行docker命令时Get Permission Denied问题:

  1. 方法1: 使用sudo获取管理员权限,运行docker命令
  2. 方法2: 创建docker用户组,并将当前用户加入到docker用户组中,那么当前用户就有权限访问Unix socket了,进而也就可以执行docker相关命令
sudo groupadd docker     #添加docker用户组
sudo gpasswd -a $USER docker     #将登陆用户加入到docker用户组中
newgrp docker     #更新用户组
docker ps    #测试docker命令是否可以使用sudo正常使用

2. 安装docker-compose 

使用pip安装:

# 安装 EPEL 软件包
sudo yum install epel-release
# 安装pip
sudo yum install -y python-pip
# 升级pip
sudo pip install --upgrade pip
# 安装docker-compose
sudo pip install docker-compose

👉 注:安装docker-compose时报错(sudo pip install docker-compose时) 

  • 错误1:
ERROR: Cannot uninstall 'subprocess32'. It is a distutils installed project and thus we cannot accurately determine which >files belong to it which would lead to only a partial uninstall.

解决办法:

# 搜索subprocess32-3.2.6-py2.7.egg-info文件
sudo find / -name *subpro*.egg-info
# 删除
rm -rf /usr/lib64/python2.7/site-packages/subprocess32-3.2.6-py2.7.egg-info
  • 错误2 
ERROR: Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

 解决办法:

# 搜索requests-2.6.0-py2.7.egg-info文件
sudo find / -name *requests*.egg-info
# 删除
rm -rf /usr/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg-inf

 然后重新安装:

sudo pip install docker-compose

3. 安装Harbor

下载并解压harbor安装包:

wget https://storage.googleapis.com/harbor-releases/harbor-offline-installer-v1.5.3.tgz
tar -zxvf harbor-offline-installer-v1.5.3.tgz #解压离线安装包
mv harbor /opt/ #移到/opt目录下
cd /opt/harbor #进入到/opt/harbor目录
ll #查看目录内容

编辑配置文件:

vim harbor.cfg #编辑配置文件

修改以下内容:

hostname = localhost     #修改harbor的启动ip,这里需要依据系统ip设置
harbor_admin_password = admin    #修改harbor的admin用户的密码

 安装Harbor:

./prepare     #配置Harbor
./install.sh    #安装Harbor

访问harbor,浏览器中输入 localhost,如下: 

 登录harbor,以 admin 用户,密码 admin 登录系统,如下:

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值