# 服务器安装配置说明

```shell
#服务器地址：139.199.108.62
ssh root@139.199.108.62
ssh root@172.21.0.5
password:qicheren#2018
```



####一、docker 安装

```shell
#安装方法  
https://docs.docker.com/install/linux/docker-ce/centos/
步骤
yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2
  
yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
    
#yum-config-manager --enable docker-ce-test

yum install docker-ce
systemctl start docker

```



#### 二、安装mysql数据库

```shell
sudo docker run --name mysql5.7 \
-e MYSQL_ROOT_PASSWORD=1qaz2wsx, \
-p 3306:3306 \
-v /home/root/docker-var/mysql/config:/etc/mysql/conf.d \
-v /home/root/docker-var/mysql/data:/var/lib/mysql \
-d mysql:5.7

#设置dymj可远程登录
CREATE USER 'automan-dev'@'%' IDENTIFIED BY 'automan@2018';

=============================================
数据连接 automan-dev
=============================================
host    : 139.199.108.62
username: automan-dev
password: automan@2018
port    : 3306
=============================================

=============================================
数据连接 automan
=============================================
host    : 139.199.108.62   172.21.0.5(内网)
username: automan
password: ~(/q[0zr
port    : 3306
=============================================
```

#### 三、CICD

```dockerfile
##Dockerfile
FROM ubuntu:18.04
MAINTAINER rxg <xg1943@gmail.com>
RUN apt-get update
RUN apt-get -y install git
RUN git config --global user.name fivefire
RUN git config --global user.name fivefire@gmail.com
RUN apt-get -y install wget
RUN apt-get -y install vim
RUN apt-get update
RUN apt-get -y install curl
RUN curl -sL https://rpm.nodesource.com/setup_8.x
RUN apt-get -y  install nodejs
RUN wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz
RUN tar -zxvf jdk-8u171-linux-x64.tar.gz -C /usr/local/
ENV JAVA_HOME /usr/local/jdk1.8.0_171
RUN wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz
RUN tar -zxvf apache-maven-3.5.3-bin.tar.gz  -C /usr/local
ENV M2_HOME /usr/local/apache-maven-3.5.3
ENV PATH $PATH:$JAVA_HOME/bin:$M2_HOME/bin
RUN wget  https://mirrors.tuna.tsinghua.edu.cn/jenkins/war-stable/2.107.3/jenkins.war
CMD setsid java -jar jenkins.war
EXPOSE 8080
```

```shell
#创建镜像(在Dockerfile文件同级目录执行)
docker build -t fivefire/cicd:v1 .
#运行容器
sudo docker run  -p 8080:8080 \
-v /home/root/docker-var/jenkins:/root/.jenkins/ \
-v /home/root/docker-var/m2:/root/.m2 \
-it fivefire/cicd:v1
```

```shell
#访问地址
url：http://139.199.108.62:8080
username:fivefire
password:fivefire#2018


```

