Linux环境部署(Deepin系统)

文章目录

  • Linux环境部署(Deepin系统)
    • 安装JDK
    • 应用添加菜单项
    • 修改Hosts文件
    • 安装maven
    • 安装Docker-Desktop
      • 1、安装Mysql
        • 1.1、创建MySQL容器
        • 1.2、进入MySQL容器
        • 1.3、设置docker容器自启
      • 2、tomcat部署
        • 2.1、拉取tomcat镜像
        • 2.2、创建tomcat容器
        • 2.3、测试tomcat
      • 3、Redis部署
        • 3.1、拉取Redis镜像
        • 3.2、 创建Redis容器
        • 3.3、客户端测试
      • 4、Nacos部署(单机)
        • 4.1、拉取Nacos镜像
        • 4.2、创建本地的映射文件,custom.properties,
        • 4.3、创建数据库 nacos_config
        • 4.4、nacos初始化sql
        • 4.5、创建配置文件application.properties
        • 4.6、创建Nacos容器
        • 4.7、设置安全验证
      • 5、ElasticSearch部署
        • 5.1、拉取ElasticSearch镜像
        • 5.2、创建ElasticSearch容器
        • 5.3、设置账户密码
        • 5.4、安装中文IK分词器
      • 6、Kibana部署
        • 6.1、拉取Kibana镜像
        • 6.2、创建Kibana容器
        • 6.3、设置中文
      • 启动docker服务时启动所有容器
    • 常见问题
      • 报Message from syslogd
      • 报Broadcast message from systemd-journald

安装JDK

  • 下载完毕后,为了应对以后需要使用多版本JDK,因此先从 /usr/local 目录下创建 /jdk 目录,然后将目录权限变更为当前普通用户的权限 ,使用的命令为
sudo mkdir /usr/local/jdk
sudo chown -R JiXin:JiXin /usr/local/jdk
  • 注:JiXin是当前用户名
sudo chown -R 当前的用户名:当前的用户名 /usr/local/jdk
  • 用户名就是登录的用户名称,如果不确认,可以使用 whoami命令进行查看

  • 创建完毕/usr/local/jdk目录后,将下载下来的压缩包解压出来,并把压缩包移入到创建的目录内

tar -zxvf jdk-8u261-linux-x64.tar.gz
mv jdk1.8.0_261 /usr/local/jdk/
  • 移动完毕后,可以进入到 /usr/local/jdk/jdk1.8.0_261 目录中 ls -al就可以看到相关文件了

  • 而后,进行环境变量的配置

sudo vim /etc/profile.d/java.sh
  • 在文件中加入
export JAVA_HOME=/usr/local/jdk/jdk1.8.0_261
CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
  • 点击esc,输入wq以后回车保存退出,而后给文件赋权
sudo chmod 755 /etc/profile.d/java.sh
sudo chown JiXin:JiXin /etc/profile.d/java.sh
  • 注:JiXin是当前用户名
sudo chown 登录使用用户名:登录使用用户名 /etc/profile.d/java.sh
  • 加载配置让其生效
source /etc/profile.d/java.sh
  • 在这里会发现重新打开终端后,发现找不到java命令,则还需要进行以下配置
sudo vim ~/.bashrc
  • 在最下方加上
source /etc/profile.d/java.sh
  • 经过以上配置,JDK就在Deepin系统中配置完成了,新打开一个终端,分别输入java -version和 javac -version命令,出现以下内容,则代表配置完成了。

应用添加菜单项

在Linux中,菜单项和桌面快捷方式使用.desktop后缀的文件,主要配置了应用的图标和启动脚本的位置,以及启动参数等,在配置文件中也可以加入分类信息和描述信息。

touch demo.desktop
vim demo.desktop#添加以下内容
[Desktop Entry]
Version=1.0
Type=Application
Name=软件名称
Icon=软件图标的路径
Exec="执行软件路径"
Comment=注释
Terminal=false

将文件添加到菜单项里面

xdg-desktop-menu install ./demo.desktop

如果没有用,打开终端进入/usr/share/applications目录

cd /usr/share/applications

将文件放在该目录内就可以了

修改Hosts文件

打开hosts文件

sudo vim /etc/hosts#将以下内容添加到末尾
#github访问
199.232.69.194 github.global.ssl.fastly.net
140.82.113.3 github.com
185.199.108.154 github.githubassets.com
#屏蔽广告
127.0.0.1 allyes.com
#访问谷歌搜索 --有时效性
203.208.40.66 translate.google.com
203.208.40.66 translate.googleapis.com

安装maven

下载Maven https://dlcdn.apache.org/maven/maven-3/3.6.3/binaries/

(注:版本太高IDEA无法支持)

mkdir -p ~/dev/Maven
tar -zxvf apache-maven-3.6.3-bin.tar.gz -C ~/dev/Maven/
vim ~/.profile  #在.profile文件最后追加如下内容
export M2_HOME=$HOME/dev/Maven/apache-maven-3.6.3
export MAVEN_OPTS="-Xms128m -Xmx1024m"
export PATH=$M2_HOME/bin:$PATH

重新加载文件

source ~/.profile

修改Maven配置文件

vim /home/JiXin/dev/Maven/apache-maven-3.6.3/conf/settings.xml

配置内容如下(仓库地址按真实位置修改)

<?xml version="1.0" encoding="UTF-8"?><!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
--><!--| This is the configuration file for Maven. It can be specified at two levels:||  1. User Level. This settings.xml file provides configuration for a single user,|                 and is normally provided in ${user.home}/.m2/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -s /path/to/user/settings.xml||  2. Global Level. This settings.xml file provides configuration for all Maven|                 users on a machine (assuming they're all using the same Maven|                 installation). It's normally provided in|                 ${maven.conf}/settings.xml.||                 NOTE: This location can be overridden with the CLI option:||                 -gs /path/to/global/settings.xml|| The sections in this sample file are intended to give you a running start at| getting the most out of your Maven installation. Where appropriate, the default| values (values used when the setting is not specified) are provided.||-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><!-- localRepository| The path to the local repository maven will use to store artifacts.|| Default: ${user.home}/.m2/repository<localRepository>/path/to/local/repo</localRepository>-->
<localRepository>/data/home/JiXin/dev/Maven/maven_repository</localRepository><!-- interactiveMode| This will determine whether maven prompts you when it needs input. If set to false,| maven will use a sensible default value, perhaps based on some other setting, for| the parameter in question.|| Default: true<interactiveMode>true</interactiveMode>--><!-- offline| Determines whether maven should attempt to connect to the network when executing a build.| This will have an effect on artifact downloads, artifact deployment, and others.|| Default: false<offline>false</offline>--><!-- pluginGroups| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.|--><pluginGroups><!-- pluginGroup| Specifies a further group identifier to use for plugin lookup.<pluginGroup>com.your.plugins</pluginGroup>--></pluginGroups><!-- proxies| This is a list of proxies which can be used on this machine to connect to the network.| Unless otherwise specified (by system property or command-line switch), the first proxy| specification in this list marked as active will be used.|--><proxies><!-- proxy| Specification for one proxy, to be used in connecting to the network.|<proxy><id>optional</id><active>true</active><protocol>http</protocol><username>proxyuser</username><password>proxypass</password><host>proxy.host.net</host><port>80</port><nonProxyHosts>local.net|some.host.com</nonProxyHosts></proxy>--></proxies><!-- servers| This is a list of authentication profiles, keyed by the server-id used within the system.| Authentication profiles can be used whenever maven must make a connection to a remote server.|--><servers><!-- server| Specifies the authentication information to use when connecting to a particular server, identified by| a unique name within the system (referred to by the 'id' attribute below).|| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are|       used together.|<server><id>deploymentRepo</id><username>repouser</username><password>repopwd</password></server>--><!-- Another sample, using keys to authenticate.<server><id>siteServer</id><privateKey>/path/to/private/key</privateKey><passphrase>optional; leave empty if not used.</passphrase></server>--></servers><!-- mirrors| This is a list of mirrors to be used in downloading artifacts from remote repositories.|| It works like this: a POM may declare a repository to use in resolving certain artifacts.| However, this repository may have problems with heavy traffic at times, so people have mirrored| it to several places.|| That repository definition will have a unique id, so we can create a mirror reference for that| repository, to be used as an alternate download site. The mirror site will be the preferred| server for that repository.|--><mirrors><!-- mirror| Specifies a repository mirror site to use instead of a given repository. The repository that| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.|<mirror><id>mirrorId</id><mirrorOf>repositoryId</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://my.repository.com/repo/path</url></mirror>--><mirror><id>alimaven</id><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/groups/public/</url><mirrorOf>central</mirrorOf>        </mirror></mirrors><!-- profiles| This is a list of profiles which can be activated in a variety of ways, and which can modify| the build process. Profiles provided in the settings.xml are intended to provide local machine-| specific paths and repository locations which allow the build to work in the local environment.|| For example, if you have an integration testing plugin - like cactus - that needs to know where| your Tomcat instance is installed, you can provide a variable here such that the variable is| dereferenced during the build process to configure the cactus plugin.|| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles| section of this document (settings.xml) - will be discussed later. Another way essentially| relies on the detection of a system property, either matching a particular value for the property,| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.| Finally, the list of active profiles can be specified directly from the command line.|| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact|       repositories, plugin repositories, and free-form properties to be used as configuration|       variables for plugins in the POM.||--><profiles><!-- profile| Specifies a set of introductions to the build process, to be activated using one or more of the| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>| or the command line, profiles have to have an ID that is unique.|| An encouraged best practice for profile identification is to use a consistent naming convention| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.| This will make it more intuitive to understand what the set of introduced profiles is attempting| to accomplish, particularly when you only have a list of profile id's for debug.|| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.<profile><id>jdk-1.4</id><activation><jdk>1.4</jdk></activation><repositories><repository><id>jdk14</id><name>Repository for JDK 1.4 builds</name><url>http://www.myhost.com/maven/jdk14</url><layout>default</layout><snapshotPolicy>always</snapshotPolicy></repository></repositories></profile>--><profile><id>jdk-1.8</id><activation><activeByDefault>true</activeByDefault><jdk>1.8</jdk></activation><properties><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target><maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion></properties></profile><!--| Here is another profile, activated by the system property 'target-env' with a value of 'dev',| which provides a specific path to the Tomcat instance. To use this, your plugin configuration| might hypothetically look like:|| ...| <plugin>|   <groupId>org.myco.myplugins</groupId>|   <artifactId>myplugin</artifactId>||   <configuration>|     <tomcatLocation>${tomcatPath}</tomcatLocation>|   </configuration>| </plugin>| ...|| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to|       anything, you could just leave off the <value/> inside the activation-property.|<profile><id>env-dev</id><activation><property><name>target-env</name><value>dev</value></property></activation><properties><tomcatPath>/path/to/tomcat/instance</tomcatPath></properties></profile>--></profiles><!-- activeProfiles| List of profiles that are active for all builds.|<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>-->
</settings>

安装Docker-Desktop

访问官网链接下载,在 Debian | 上安装 Docker 桌面泊坞窗文档

1、安装Mysql

  • 先从docker拉去mysql镜像
docker pull mysql:8.0
docker pull mysql:5.7

1.1、创建MySQL容器

建议安装mysql5.7版本。因为nacos经常连不上mysql8.0,不知道具体原因。

docker run -di --name=mysql -p 3307:3306 -e MYSQL_ROOT_PASSWORD=密码 mysql:8.0docker run -di --name=mysql -p 3307:3306 -e MYSQL_ROOT_PASSWORD=密码 mysql:5.7
  • -p 代表端口映射,格式为 宿主机映射端口:容器运行端口

  • 【注意】-e 代表添加环境变量 MYSQL_ROOT_PASSWORD是root用户的登陆密码,必须,严格区分大小写

1.2、进入MySQL容器

  • 进入容器中
docker exec -it mysql /bin/bash
  • 登录mysql
mysql -uroot -p密码
  • 授权允许远程登录
  1. 输入命令(mysql -uroot -p)登入mysql数据库
  2. 执行下面语句查看权限
use mysql;
select host, user, authentication_string, plugin from user;-- 查看user表的root用户Host字段是localhost,说明root用户只能本地登录,现在把他改成远程登录 Mysql 8.0版本
update user set host='%' where user='root';
--授权允许远程登录 Mysql 5.7版本
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Mysql961117' WITH GRANT OPTION;

'%'表示所有ip都可以连接,相当于0.0.0.0

  1. 刷新权限
flush privileges;

1.3、设置docker容器自启

  • 如果创建时未指定 --restart=always ,可通过update 命令设置
docker update --restart=always mysql

2、tomcat部署

2.1、拉取tomcat镜像

docker pull tomcat:7-jre8

2.2、创建tomcat容器

  • 创建时指定 --restart=always,可以使容器随docker服务启动时启动。
docker run -di --restart=always --name=tomcat -p 8888:8080 tomcat:7-jre8

2.3、测试tomcat

浏览器地址栏输入:http://192.168.6.143:8888

3、Redis部署

3.1、拉取Redis镜像

docker pull redis

3.2、 创建Redis容器

docker run -di --restart=always --name=redis -p 6380:6379 redis --requirepass "密码"

3.3、客户端测试

本地安装一个redis的客户端 连接即可

redis-cli.exe -h 192.168.6.143 -p 6380

4、Nacos部署(单机)

4.1、拉取Nacos镜像

docker pull nacos/nacos-server

4.2、创建本地的映射文件,custom.properties,

sudo mkdir -p /usr/nacos/init.d /usr/nacos/logs
sudo touch /usr/nacos/init.d/custom.properties
sudo vim /usr/nacos/init.d/custom.properties

在文件中写入以下配置

management.endpoints.web.exposure.include=*

4.3、创建数据库 nacos_config

4.4、nacos初始化sql

/** Copyright 1999-2018 Alibaba Group Holding Ltd.** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**      http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*//******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info   */
/******************************************/
CREATE TABLE `config_info` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',`data_id` varchar(255) NOT NULL COMMENT 'data_id',`group_id` varchar(255) DEFAULT NULL,`content` longtext NOT NULL COMMENT 'content',`md5` varchar(32) DEFAULT NULL COMMENT 'md5',`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',`src_user` text COMMENT 'source user',`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',`app_name` varchar(128) DEFAULT NULL,`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',`c_desc` varchar(256) DEFAULT NULL,`c_use` varchar(64) DEFAULT NULL,`effect` varchar(64) DEFAULT NULL,`type` varchar(64) DEFAULT NULL,`c_schema` text,`encrypted_data_key` text NOT NULL COMMENT '秘钥',PRIMARY KEY (`id`),UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info';/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info_aggr   */
/******************************************/
CREATE TABLE `config_info_aggr` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',`data_id` varchar(255) NOT NULL COMMENT 'data_id',`group_id` varchar(255) NOT NULL COMMENT 'group_id',`datum_id` varchar(255) NOT NULL COMMENT 'datum_id',`content` longtext NOT NULL COMMENT '内容',`gmt_modified` datetime NOT NULL COMMENT '修改时间',`app_name` varchar(128) DEFAULT NULL,`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',PRIMARY KEY (`id`),UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='增加租户字段';/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info_beta   */
/******************************************/
CREATE TABLE `config_info_beta` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',`data_id` varchar(255) NOT NULL COMMENT 'data_id',`group_id` varchar(128) NOT NULL COMMENT 'group_id',`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',`content` longtext NOT NULL COMMENT 'content',`beta_ips` varchar(1024) DEFAULT NULL COMMENT 'betaIps',`md5` varchar(32) DEFAULT NULL COMMENT 'md5',`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',`src_user` text COMMENT 'source user',`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',`encrypted_data_key` text NOT NULL COMMENT '秘钥',PRIMARY KEY (`id`),UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta';/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info_tag   */
/******************************************/
CREATE TABLE `config_info_tag` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',`data_id` varchar(255) NOT NULL COMMENT 'data_id',`group_id` varchar(128) NOT NULL COMMENT 'group_id',`tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',`tag_id` varchar(128) NOT NULL COMMENT 'tag_id',`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',`content` longtext NOT NULL COMMENT 'content',`md5` varchar(32) DEFAULT NULL COMMENT 'md5',`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',`src_user` text COMMENT 'source user',`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',PRIMARY KEY (`id`),UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_tag';/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_tags_relation   */
/******************************************/
CREATE TABLE `config_tags_relation` (`id` bigint(20) NOT NULL COMMENT 'id',`tag_name` varchar(128) NOT NULL COMMENT 'tag_name',`tag_type` varchar(64) DEFAULT NULL COMMENT 'tag_type',`data_id` varchar(255) NOT NULL COMMENT 'data_id',`group_id` varchar(128) NOT NULL COMMENT 'group_id',`tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',`nid` bigint(20) NOT NULL AUTO_INCREMENT,PRIMARY KEY (`nid`),UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`),KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_tag_relation';/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = group_capacity   */
/******************************************/
CREATE TABLE `group_capacity` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',`group_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群',`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数,,0表示使用默认值',`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',PRIMARY KEY (`id`),UNIQUE KEY `uk_group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='集群、各Group容量信息表';/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = his_config_info   */
/******************************************/
CREATE TABLE `his_config_info` (`id` bigint(20) unsigned NOT NULL,`nid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,`data_id` varchar(255) NOT NULL,`group_id` varchar(128) NOT NULL,`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',`content` longtext NOT NULL,`md5` varchar(32) DEFAULT NULL,`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,`src_user` text,`src_ip` varchar(50) DEFAULT NULL,`op_type` char(10) DEFAULT NULL,`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',`encrypted_data_key` text NOT NULL COMMENT '秘钥',PRIMARY KEY (`nid`),KEY `idx_gmt_create` (`gmt_create`),KEY `idx_gmt_modified` (`gmt_modified`),KEY `idx_did` (`data_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='多租户改造';/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = tenant_capacity   */
/******************************************/
CREATE TABLE `tenant_capacity` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',`tenant_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Tenant ID',`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数',`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',PRIMARY KEY (`id`),UNIQUE KEY `uk_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='租户容量信息表';CREATE TABLE `tenant_info` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',`kp` varchar(128) NOT NULL COMMENT 'kp',`tenant_id` varchar(128) default '' COMMENT 'tenant_id',`tenant_name` varchar(128) default '' COMMENT 'tenant_name',`tenant_desc` varchar(256) DEFAULT NULL COMMENT 'tenant_desc',`create_source` varchar(32) DEFAULT NULL COMMENT 'create_source',`gmt_create` bigint(20) NOT NULL COMMENT '创建时间',`gmt_modified` bigint(20) NOT NULL COMMENT '修改时间',PRIMARY KEY (`id`),UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`),KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';CREATE TABLE `users` (`username` varchar(50) NOT NULL PRIMARY KEY,`password` varchar(500) NOT NULL,`enabled` boolean NOT NULL
);CREATE TABLE `roles` (`username` varchar(50) NOT NULL,`role` varchar(50) NOT NULL,UNIQUE INDEX `idx_user_role` (`username` ASC, `role` ASC) USING BTREE
);CREATE TABLE `permissions` (`role` varchar(50) NOT NULL,`resource` varchar(255) NOT NULL,`action` varchar(8) NOT NULL,UNIQUE INDEX `uk_role_permission` (`role`,`resource`,`action`) USING BTREE
);INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');

4.5、创建配置文件application.properties

sudo mkdir -p /home/nacos/conf
sudo touch /home/nacos/conf/application.properties
sudo vim  /home/nacos/conf/application.properties

配置内容如下(Mysql 5.7)

# spring
server.servlet.contextPath=${SERVER_SERVLET_CONTEXTPATH:/nacos}
server.contextPath=/nacos
server.port=${NACOS_SERVER_PORT:8848}
spring.datasource.platform=${SPRING_DATASOURCE_PLATFORM:""}
nacos.cmdb.dumpTaskInterval=3600
nacos.cmdb.eventTaskInterval=10
nacos.cmdb.labelTaskInterval=300
nacos.cmdb.loadDataAtStart=false
db.num=${MYSQL_DATABASE_NUM:1}
db.url.0=jdbc:mysql://${MYSQL_SERVICE_HOST}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME}?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.url.1=jdbc:mysql://${MYSQL_SERVICE_HOST}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME}?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.user=${MYSQL_SERVICE_USER}
db.password=${MYSQL_SERVICE_PASSWORD}
### The auth system to use, currently only 'nacos' is supported:
nacos.core.auth.system.type=${NACOS_AUTH_SYSTEM_TYPE:nacos}### The token expiration in seconds:
nacos.core.auth.default.token.expire.seconds=${NACOS_AUTH_TOKEN_EXPIRE_SECONDS:18000}### The default token:
nacos.core.auth.default.token.secret.key=${NACOS_AUTH_TOKEN:SecretKey012345678901234567890123456789012345678901234567890123456789}### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.
nacos.core.auth.caching.enabled=${NACOS_AUTH_CACHE_ENABLE:false}server.tomcat.accesslog.enabled=${TOMCAT_ACCESSLOG_ENABLED:false}
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D
# default current work dir
server.tomcat.basedir=
## spring security config
### turn off security
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
# metrics for elastic search
management.metrics.export.elastic.enabled=false
management.metrics.export.influx.enabled=falsenacos.naming.distro.taskDispatchThreadCount=10
nacos.naming.distro.taskDispatchPeriod=200
nacos.naming.distro.batchSyncKeyCount=1000
nacos.naming.distro.initDataRatio=0.9
nacos.naming.distro.syncRetryDelay=5000
nacos.naming.data.warmup=true

4.6、创建Nacos容器

docker run -d -p 8848:8848  -p 9848:9848  \
-e MODE=standalone \
-e PREFER_HOST_MODE=hostname \
-e SPRING_DATASOURCE_PLATFORM=mysql \
-e MYSQL_SERVICE_HOST=192.168.6.143 \
-e MYSQL_SERVICE_PORT=3306 \
-e MYSQL_SERVICE_DB_NAME=nacos_config \
-e MYSQL_SERVICE_USER=root \
-e MYSQL_SERVICE_PASSWORD=Mysql的密码 \
-e MYSQL_DATABASE_NUM=1 \
-v /usr/nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties \
-v /usr/nacos/logs:/home/nacos/logs \
--restart always --name nacos nacos/nacos-server

4.7、设置安全验证

进入nacos容器,修改配置文件

docker exec -it nacos /bin/bash
cd conf/
vim application.properties #修改数据库配置为自己配置
#然后在文件添加下面这行
nacos.core.auth.enabled=true

重启容器

5、ElasticSearch部署

5.1、拉取ElasticSearch镜像

(注:8.X版本,安装Kibana太复杂)

docker pull elasticsearch:7.4.0

5.2、创建ElasticSearch容器

docker run --name elasticsearch -d --restart=always -e "discovery.type=single-node" -p 9200:9200 -p 9300:9300 elasticsearch:7.4.0

5.3、设置账户密码

进入ElasticSearch容器,修改配置文件

docker exec -it elasticsearch /bin/bash
cd config/
vi elasticsearch.yml#添加以下内容
#xpack 插件的授权类型,basic是免费的,还有其他收费版本
xpack.license.self_generated.type: basic
#是否开启安全验证
xpack.security.enabled: true
#是否开启远程访问安全验证
xpack.security.transport.ssl.enabled: true

重启ElasticSearch容器,重新进入ElasticSearch容器

docker exec -it elasticsearch /bin/bash
cd bin/
elasticsearch-setup-passwords interactive
#输入Y ,开始设置各账号初始密码

5.4、安装中文IK分词器

下载对应版本的IK分词器 Release v7.4.0 · medcl/elasticsearch-analysis-ik · GitHub

解压压缩文件到IK文件夹里面

unzip elasticsearch-analysis-ik-7.4.0.zip -d ik

执行docker cp命令,将 ik 文件夹复制到ElasticSearch容器中的 plugins 文件夹中

docker cp /home/JiXin/Downloads/ik elasticsearch:/usr/share/elasticsearch/plugins

重启容器

6、Kibana部署

6.1、拉取Kibana镜像

docker pull kibana:7.4.0

6.2、创建Kibana容器

docker run --name kibana --restart=always -e ELASTICSEARCH_HOSTS=http://192.168.6.143:9200 -p 5601:5601 -d kibana:7.4.0

6.3、设置中文

进入容器修改配置文件

docker exec -it kibana /bin/bash
cd config/
vi kibana.yml#将如下内容覆盖到kibana.yml中
server.name: kibana
server.host: "0"
#elasticsearch.hosts: [ "http://elasticsearch:9200" ]
elasticsearch.hosts: [ "http://192.168.6.143:9200" ]
xpack.monitoring.ui.container.elasticsearch.enabled: true
#设置kibana中文显示
i18n.locale: zh-CN
elasticsearch.username: "elastic"
elasticsearch.password: "elastic的密码"

重启容器

启动docker服务时启动所有容器

方法一:
创建时指定 --restart=always,可以使容器随docker服务启动时启动。

sudo docker run --restart=always 容器id

如果创建时未指定 --restart=always ,可通过update 命令设置

docker update --restart=always 容器id

执行 systemctl restart docker 其他服务也会随之启动。

常见问题

报Message from syslogd

  • 使用xshell连接一台服务器后,一直报Message from syslogd@xxx at xxx 。影响终端的输入

解决办法

  1. sudo vim /etc/rsyslog.conf
    
  2. 注释掉:*.emerg

  3. 重启:

    sudo service rsyslog restart
    

报Broadcast message from systemd-journald

解决方法:

需要禁用ForwardToWall

sudo vim  /etc/systemd/journald.conf

在#ForwardToWall=yes下面加上

ForwardToWall=no

重启systemd-journald服务

sudo systemctl restart systemd-journald.service

Linux环境部署(Deepin系统)相关推荐

  1. 【原创】企业级Linux环境部署(很全、很细)

       [原创不易,转载请注明] <Linux环境部署手册> 企业级Linux环境部署过程,笔者独家整理提供!细到没朋友... 学废了要记得点赞.关注.收藏奥! 关于本文 本文着重详细说明在 ...

  2. Linux 环境部署|Anaconda及Tensorflow

    Linux 环境部署|Anaconda及Tensorflow Linux系统python虚拟环境及HanLP部署(https://duanzhihua.blog.csdn.net/article/de ...

  3. (六)Linux环境部署(Centos+Nginx+Tomcat+Mysql) - 常用命令总结

    因为在网上发现系统性.严谨(特别是在安全方面)的Linux部署方面的参考文章很少,于是整理以下六篇Linux环境部署的系列性文章,其为本人在实践中,完整的搭建一个基于Linux系统上Centos+Ng ...

  4. (三)Linux环境部署(Centos+Nginx+Tomcat+Mysql) - Nginx环境搭建

    因为在网上发现系统性.严谨(特别是在安全方面)的Linux部署方面的参考文章很少,于是整理以下六篇Linux环境部署的系列性文章,其为本人在实践中,完整的搭建一个基于Linux系统上Centos+Ng ...

  5. (四)Linux环境部署(Centos+Nginx+Tomcat+Mysql) - 安装Tomcat和JDK 以及 Nginx与Tomcat整合

    因为在网上发现系统性.严谨(特别是在安全方面)的Linux部署方面的参考文章很少,于是整理以下六篇Linux环境部署的系列性文章,其为本人在实践中,完整的搭建一个基于Linux系统上Centos+Ng ...

  6. Linux环境部署node服务并启动

    Linux环境部署node 一.node下载与安装 1.node下载 2.通过XFTP把下载下来的包传到服务器上 3.解压包 4.建立软链接 二.使用PM2启动node 1.为什么要使用PM2 2.安 ...

  7. linux环境下查看系统安装时间、启动时间、运行时间

    Linux环境下查看系统的安装时间.启动时间.运行时间 系统安装时间 查看root下系统安装记录的文件生成时间,可以约等于系统安装时间 系统启动时间 who -b查看系统最后一次系统启动开始的时间 w ...

  8. Linux环境部署国产数据库达梦

    DM数据库简介 达梦数据库管理系统是达梦公司推出的具有完全自主知识产权的高性能数据库管理系统,简称DM. 2020年6月,根据摩天轮最新排行榜显示,DM数据库在国产数据库中排名在前三. Linux环境 ...

  9. Oracle(21)—— Linux环境部署Oracle11g数据库

    1.环境准备,需要Oracle官网下载Linux版本的Oracle11g安装包,如下截图: 具体安装参照如下: http://werewolftj.blog.51cto.com/1606482/159 ...

最新文章

  1. spring boot中的日志入门
  2. SQLServer之ISO游标使用
  3. 所有接口添加plist文件的写法 swift
  4. NLP之WordCloud:基于jieba+matplotlib库对一段文本生成词云图~~情人节最好的礼物(给你一张过去的词云图,看看那时我们的爱情)
  5. IS-IS路由协议 总结
  6. Android菜鸟如何学习Android系统开发?
  7. rust雪山矿洞几个入口_梅里雪山内转全记录(雨崩徒步:神湖神瀑冰湖)
  8. 招一个写代码的女生:国外女程序员是什么样的
  9. [转]用行为树的方式思考
  10. python 读取文件到字典读取顺序_Python用list或dict字段模式读取文件的方法
  11. fine-tune 微调 Transfer learning 迁移学习 动手学深度学习v2
  12. 等概率随机产生0和1
  13. 商用密码产品认证-电子签章系统
  14. 2016年淘宝购买华硕FL5900UQ7500惨痛经历教训总结
  15. mysql获取去年同期_mysql 查询当天、昨天、本周、上周、本月、上月、今年、去年数据...
  16. 硼碳氮纳米管的制备(碳纳米管包裹磁性金属复合纳米结构/多孔氧化物掺杂的碳纳米管包裹的碳纳米球/碳氮纳米管包裹纳米金属粒子/碳纳米管包裹Ni纳米线复合材料)
  17. 深度学习(四):卷积神经网络(CNN)模型结构,前向传播算法和反向传播算法介绍。
  18. 华为自研系统鸿蒙很快就会搭载进手机吗?
  19. 【Java开发环境配置 for Windows】
  20. C4droid:安卓手机最强C/C++编译器

热门文章

  1. 2020年7月最新加速下载百度网盘文件方法
  2. 卷积核的理解和参数确定
  3. VUE+Canvas实现输入文字生成对应的字体图片小功能
  4. nyoj--7 街区最短路径问题(枚举 or math)
  5. Android S GTS 常见的 fail 项
  6. 网关介绍和作用,Spring Cloud Gateway介绍
  7. Ubuntu 18.04 安装 mdadm 搭建 raid0
  8. Genymotion模拟器个人版免费资源下载和安装(百度云)
  9. DB2 10.5 BLU列式存储技术初试
  10. 怎么更改wifi频段_TP-Link无线路由器怎么修改无线信道和频段