# 开始

\[TOC]

## 准备

### 环境

参考[CENTOS：Docker安装centos容器](https://www.huaweicloud.com/articles/13636476.html)

1. docker pull centos
2. docker run --privileged --cap-add SYS\_ADMIN -e container=docker -it --name polaris\_centos -p 80:80 -p 8090:8090 -d --restart=always centos /usr/sbin/init
3. docker exec -it polaris\_centos /bin/bash
4. 安装go: `yum install golang`
5. 安装wget：`yum install wget`
6. ```
   # bash: service: command not found
   yum list | grep initscripts
   yum install initscripts
   ```
7. 安装crontab：`yum install cronie`
8. yum install which
9. yum install lsof

### 下载releases包

`wget https://github.com/polarismesh/polaris/releases/download/v1.0.1/polaris-standalone-release_v1.0.1.linux.amd64.tar.gz`

### 解压

`tar -xvf polaris-standalone-release_v1.0.1.linux.amd64.tar.gz`

### 安装MySQL

参考

[CentOS7安装最新版的MySQL（5.7）](https://www.huaweicloud.com/articles/0c192367ee485a4405c4b7f9ca4215cd.html)

[Linux 安装 Mysql 5.7.23](https://www.huaweicloud.com/articles/5283936baedadad84f33284a46fdd19c.html)

[Centos8 安装 mysql5.7 No match for argument: mysql-community-server](https://blog.csdn.net/zhaokuo719/article/details/105508321)

1. rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
2. yum module disable mysql
3. yum install mysql-community-server
4. service mysqld start

当然还可以调整账号及密码，这里就直接使用默认的了

### 一键安装

在安装之前可以确认下`polaris-server-release_v1.0.1.linux.amd64/polaris-server.yaml`中配置的MySQL信息是否正确。

`bash install.sh`

### 验证安装

端口号需要在`polaris-server-release_v1.0.1.linux.amd64/polaris-server.yaml`确认

`curl http://127.0.0.1:8090`，返回Polaris Server则说明部署成功。

## 程序管理

### 启动服务

`./polaris-server-release_v1.0.1.linux.amd64/tool/start.sh`

### 停止服务

`./polaris-server-release_v1.0.1.linux.amd64/tool/stop.sh`

### 服务运行查询

`./polaris-server-release_v1.0.1.linux.amd64/tool/p.sh`

## 访问

服务治理中心控制台： [http://127.0.0.1](http://127.0.0.1)

Polaris Server验证：[http://127.0.0.1:8090/](http://127.0.0.1:8090/)

## 体验

1. docker pull oyjx0525/polaris\_centos
2. docker run --privileged --cap-add SYS\_ADMIN -e container=docker -it --name my\_polaris\_centos -p 80:80 -p 8090:8090 -d --restart=always oyjx0525/polaris\_centos /usr/sbin/init

## 参考

[安装服务端](https://polarismesh.cn/zh/doc/%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8/%E5%AE%89%E8%A3%85%E6%9C%8D%E5%8A%A1%E7%AB%AF.html#%E5%AE%89%E8%A3%85%E6%9C%8D%E5%8A%A1%E7%AB%AF)

[北极星：服务发现和治理](https://github.com/polarismesh/polaris/blob/main/README-zh.md)

[CentOS7安装最新版的MySQL（5.7）](https://www.huaweicloud.com/articles/0c192367ee485a4405c4b7f9ca4215cd.html)

[Linux 安装 Mysql 5.7.23](https://www.huaweicloud.com/articles/5283936baedadad84f33284a46fdd19c.html)

[Centos8 安装 mysql5.7 No match for argument: mysql-community-server](https://www.huaweicloud.com/articles/5283936baedadad84f33284a46fdd19c.html)

[CENTOS：Docker安装centos容器](https://www.huaweicloud.com/articles/13636476.html)

[Linux下设置开机自动启动-shell的几种方法](http://www.szliwen.com/872.html)

[Docker系列-(2) 镜像制作与发布](https://juejin.cn/post/6844903970754789383)
