Centos 7 搭建Nginx , Docker (装rabbitMq,postgresql , gitlab镜像)
来源:互联网 发布:php商城框架 编辑:程序博客网 时间:2024/06/05 03:29
前言:
连接工具xshell
Nginx部署
//说明如果你是裸机的话,通过下面这个博文部署ngxin 的时候,会出现一些基本环境问题(1)linux下安装安装pcre-8.32./configure --prefix=/usr/local/pcre 出现以下错误configure: error: You need a C++ compiler for C++ support正解yum install -y gcc gcc-c++(2) make出错make: *** No rule to make target `build', needed by `default'. Stop../configure: error: SSL modules require the OpenSSL library.You can either do not enable the modules, or install the OpenSSL libraryinto the system, or build the OpenSSL library statically from the sourcewith nginx by using --with-openssl=<path> option.ubuntu下解决办法:apt-get install opensslapt-get install libssl-devcentos下解决办法:yum -y install openssl openssl-devel
http://www.runoob.com/linux/nginx-install-setup.html
Docker部署
安装docker,运行[root@localhost ~]# yum install docker安装完成,查看docker版本信息,运行 [root@localhost ~]# docker version,看到以下信息表示安装成功
启动docker,运行[root@localhost ~]# systemctl start docker.service设置为开机启动,运行[root@localhost ~]# systemctl enable docker.service
修改docker加速镜像为阿里云, 使用docker pull,命令下载镜像太慢了,默认是从国外的,下如何配置国内阿里云竞相加速方式。方法1、编辑/etc/systemd/system/multi-user.target.wants/docker.service文件,找到 ExecStart= 这一行,在这行最后添加加速器地址 –registry-mirror=<加速器地址>,如:ExecStart=/usr/bin/dockerd --registry-mirror=https://xxxxx.mirror.aliyuncs.com方法2/** *说明: 运行此命令要回到 根目录 **/[root@localhost ~]# sed -i "s|ExecStart=/usr/bin/dockerd|ExecStart=/usr/bin/dockerd --registry-mirror=https://ihzk22je.mirror.aliyuncs.com|g" /etc/systemd/system/multi-user.target.wants/docker.service修改后重新加载配置,运行[root@localhost ~]#systemctl daemon-reload;重新启动服务,运行[root@localhost ~]#systemctl restart docker即可。
安装rabbitmq :
[root@localhost ~]# docker search rabbitmq
[root@localhost ~]# docker pull rabbitmq:management[root@localhost ~]# docker pull rabbitmq:3-management
查看镜像[root@localhost ~]# docker images
运行rabbitmq[root@localhost ~]# docker run -d --name myrabbitmq -p 5673:5672 -p 15673:15672 docker.io/rabbitmq:3-managementmyrabbitmq (该名字随意起)docker.io/rabbitmq:3-management (此为:docker images 结果下的: REPOSITORY:TAG)如果启动失败,查看原因,可能是端口被占用说明: docker run .....为创建一个容器
Docker 容器管理命令:
查看所有容器[root@localhost ~]# docker ps -a查看正在运行的容器(显示所有信息)[root@localhost ~]# docker ps查看正在运行的容器(只显示CONTAINER ID)[root@localhost ~]# docker ps -q停止所有正在运行的容器[root@localhost ~]# docker stop $( docker ps -q)删除容器[root@localhost ~]# docker rm 容器名字停止一个容器[root@localhost ~]# docker stop 容器名字开启一个容器[root@localhost ~]# docker start 容器名字删除镜像停止所有的container,这样才能够删除其中的images:[root@localhost ~]# docker stop $(docker ps -a -q)删除images,通过image的id来指定删除谁[root@localhost ~]# docker rmi <image id>要删除全部image的话[root@localhost ~]# docker rmi $(docker images -q)
查看[root@localhost ~]# docker ps
浏览器中访问 http://http://123.206.66.232:15673 默认用户名guest密码guest
安装Postgresql镜像 :
安装postgres[root@localhost ~]# docker pull postgres:9.4
安装容器[root@localhost ~]# docker run --name postgres1 -e POSTGRES_PASSWORD=password -p 54321:5432 -d postgres:9.4 说明:run,创建并运行一个容器; --name,指定创建的容器的名字; -e POSTGRES_PASSWORD=password,设置环境变量,指定数据库的登录口令为password; -p 54321:5432,端口映射将容器的5432端口映射到外部机器的54321端口; -d postgres:9.4,指定使用postgres:9.4作为镜像。
验证结果[root@localhost ~]# docker ps -a
注意:
连接postgresql 的时候,postgres镜像默认的用户名为postgres,端口为54321 (它会映射到5432)。
安装Gitlab镜像 :
[root@localhost ~]# docker search gitlab,查看镜像
[root@localhost ~]# docker pull sameersbn/gitlab:latest,pull镜像文件,运行完成后,运行
[root@localhost ~]# docker images如下图所示:
添加gitlab容器提示:gitlab 启动需要2G内存如果服务器内存不足,gitlab将无法启动[root@localhost ~]# docker run -d --publish 1443:443 --publish 18080:80 --publish 10022:22 --name mygitlab --restart always gitlab/gitlab-ce:latest
[root@localhost ~]# docker ps查看是否启动成功
在浏览器输入http://192.168.1.129:18080/ 即可访问,修改初始密码
阅读全文
0 0
- Centos 7 搭建Nginx , Docker (装rabbitMq,postgresql , gitlab镜像)
- GitLab搭建与维护(基于docker镜像sameersbn/docker-gitlab)
- docker+centos镜像+redis集群搭建
- CentOS7安装Docker,运行Nginx镜像、Centos镜像
- CentOS7安装Docker,运行Nginx镜像、Centos镜像
- CentOS7安装Docker,运行Nginx镜像、Centos镜像
- CentOS7安装Docker,运行Nginx镜像、Centos镜像
- CentOS 7+GitLab搭建
- 创建带Nginx服务的Centos Docker镜像
- Docker chenyufeng/nginx-centos镜像实现负载均衡
- docker安装gitlab,redis,postgresql搭建代码托管环境
- 【Docker构建】- Nginx创建带Nginx服务的Centos Docker镜像
- 在CentOS 7.2上搭建Docker私有镜像仓库
- Docker实战:使用Dockerfile创建带nginx服务并支持ssh的Centos Docker镜像
- CentOS+nginx+Django+Postgresql web环境搭建
- 使用docker搭建gitlab
- Docker 搭建gitlab
- docker搭建gitlab流程
- 浅谈如何使用ADO.NET操作数据库
- 微信小程序 短信验证 功能的实现(附案例代码/前后端/直接用)
- Android性能优化之使用线程池处理异步任务
- 在QT中使用FFmpeg库
- 并发 并行 同步 异步 多线程的区别
- Centos 7 搭建Nginx , Docker (装rabbitMq,postgresql , gitlab镜像)
- 【安全牛学习笔记】基本工具-NETCAT(telnet/banner、传输文本信息)
- js对浏览器返回事件的捕获及禁用功能
- php jquery实现即点即改
- laravel中打印sql语句到日志中
- Hadoop入门之Hive的安装和连接
- oracle性能优化
- 51nod 1021 石子归并(区间dp 详细解释)
- 学单片机,到底在学什么?