【showdoc】CentOS7安装showdoc

1. 配置阿里云yum源

禁用yum插件fastestmirror

修改插件的配置
[developer@node03 ~]$ sudo vi /etc/yum/pluginconf.d/fastestmirror.conf
enabled=0    // 把1改成0,禁用插件

修改yum的配置
[developer@node03 ~]$ sudo vi /etc/yum.conf 
plugins=0    //把1改成0,不适用插件

 获取阿里云repo

[developer@node03 ~]$ sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
[developer@node03 ~]$ sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[developer@node03 ~]$ sudo mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak
[developer@node03 ~]$ sudo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo


==============
wget使用代理(若需要)
//http代理
[developer@node03 ~]$ sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo -e use_proxy=yes -e http_proxy=http://username:[email protected]:port  
//https代理
就在http的基础上再加一个参数,--no-check-certificate,不检查服务器的证书

清理旧缓存,重新缓存

[developer@node03 ~]$ sudo yum clean all
[developer@node03 ~]$ sudo rm -rf /var/cache/yum
[developer@node03 ~]$ sudo yum makecache

阿里云yum源配置完成。 

2. 安装docker(官方文档)

卸载现有的docker包

[developer@node03 showdoc]$ sudo yum remove docker \
>                   docker-client \
>                   docker-client-latest \
>                   docker-common \
>                   docker-latest \
>                   docker-latest-logrotate \
>                   docker-logrotate \
>                   docker-engine

构建docker源

[developer@node03 showdoc]$ sudo yum install -y yum-utils
[developer@ac3-node03 showdoc]$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[developer@node03 showdoc]$ sudo yum-config-manager --enable docker-ce-nightly
[developer@node03 showdoc]$ sudo yum-config-manager --enable docker-ce-test

安装docker

[developer@node03 showdoc]$ sudo yum install docker-ce docker-ce-cli containerd.io

 启动docker

[developer@node03 showdoc]$ sudo systemctl start docker
[developer@node03 showdoc]$ systemctl is-active docker
active
[developer@node03 showdoc]$ 

//设为开机自启动
[developer@node03 showdoc]$ sudo systemctl enable docker

3.安装showdoc(官方文档)

为docker pull添加上网代理配置(若需要)

[developer@node03 showdoc]$ sudo vi /usr/lib/systemd/system/docker.service 
在[Service]底下添加一行
Environment="HTTP_PROXY=proxy.com:port" "HTTPS_PROXY=proxy.com:port"
[developer@node03 showdoc]$ sudo systemctl daemon-reload
[developer@node03 showdoc]$ sudo systemctl start docker

若代理服务器是需要账密的,书写方式为
Environment="username:password@HTTP_PROXY=proxy.com:port" "username:password@HTTPS_PROXY=proxy.com:port"

安装showdoc

[developer@node03 showdoc]$ sudo docker pull star7th/showdoc

创建存放showdoc数据的目录

[developer@node03 ~]$ sudo mkdir -p /data/showdoc_data/html
[developer@node03 ~]$ sudo chmod -R 777 /data/showdoc_data

启动showdoc容器

[developer@node03 ~]$ sudo docker run -d --name showdoc --user=root --privileged=true -p 4999:80 \
> -v /data/showdoc_data/html:/var/www/html/ star7th/showdoc
c2c00bd26367e95ecbc36e698a9fe2311bffdd63b8cb85b0a03cac68c8c3f1e4
[developer@node03 ~]$ 

//设置容器开机自启动
[developer@node03 ~]$ sudo docker update --restart=always showdoc


//或者直接在启动容器时设置--restart=always
sudo docker run -d --name showdoc --user=root --privileged=true -p 4999:80 --restart=always -v /data/showdoc_data/html:/var/www/html/ star7th/showdoc

至此,showdoc安装完成,showdoc的数据都会存放在/data/showdock_data/html目录下。

通过浏览器访问http://host_ip:4999可以访问showdoc,账号密码是showdoc/123456,登录后可以看到右上方的管理后台入口,修改密码。

【showdoc】CentOS7安装showdoc_第1张图片

【showdoc】CentOS7安装showdoc_第2张图片 至此,showdoc安装完成。

4.其他运维参考命令:参见showdoc官方文档

你可能感兴趣的:(docker,showdoc)