ansible常用命令

1. -v,  –verbose                    详细模式,如果命令执行成功,输出详细的结果(-vv –vvv -vvvv)
2. -i, –inventory=PATH 指定host文件的路径,默认是在/etc/ansible/hosts(生产环境经常用到)
3. -f NUM, –forks=NUNUM 接一个整数,默认是5,指定fork开启同步进程的个数。
4. -m NAME, –module-name=NAME 指定使用的module名称,默认是command
5. -a, MODULE_ARGS 指定module模块的参数
6. -k, -ask-pass 提示输入ssh的密码,而不是使用基于ssh的密钥认证
7. -sudo 指定使用sudo获得root权限(生产环境经常用到)
8. -K, -ask-sudo-pass 提示输入sudo密码,与sudo一起使用 (生产环境经常用到)
9. -u USERNAME,-user=USERNAME 指定移动端的执行用户
10. -C, -check 测试此命令执行不会改变什么内容,不会真正的去执行

Ansible-playbook 基本命令

1. ansible-playbook   // 查看帮助
2. ansible-playbook a.yml --syntax-check //检查yaml文件的语法是否正确
3. ansible-playbook a.yml --list-task //检查tasks任务
4. ansible-playbook a.yml --list-hosts //检查生效的主机
5. ansible-playbook a.yml --start-at-task='Copy Nginx.conf' //指定从某个task开始运行
6. ansible-playbook --syntax-check -e "hosts=c7" xx.yml -s -k // 语法检查
7. ansible-playbook -i hostslist ***.yml --limit 192.168.0.1 // 排除单个主机
8. ansible-playbook -i hostslist ***.yml --limit @failed.txt // 排除多个主机
9. ansible-playbook update-stg.yml -f 10 -s -k // 启用10个并行进程数执行

ansible-doc常用命令

1. ansible-doc -l   #列出所有ansible支持的模块,重要,请自行记住
2. ansible-doc -s copy # 获取模块简要使用说明(如需详细去掉-s)
src= #源文件
force= #是否覆盖
dest= #目标文件

ansible-galaxy init /roles/tomcat-install 创建roles目录结构

Ansible 基本概念

inventory 主机源

  • playbooks 一组运行任务的命令集合
  • roles 角色
  • tasks 运行任务列表
  • handlers 运行任务后的触发动作
  • variables 定义的变量

inventor 目录结构

    • inventories/
      ├── group_vars
      │ └── all
      │ └── kubeadm.yml
      └── k8s-hosts

roles目录结构

tomcat-install/
├── defaults
│   └── main.yml
├── files
│   └── jdk-8u241-linux-x64.tar.gz
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── README.md
├── tasks
│   ├── basics.yml
│   ├── copy.yml
│   ├── main.yml
│   └── tomcat.yml
├── templates
│   ├── jdk_path
│   ├── server.xml.j2
│   └── tomcat
├── tests
│   ├── inventory
│   └── test.yml
└── vars
└── main.yml tomcat-install角色名称
files文件及软件目录
vars定义变量
templates模板文件 配置文件替换以.j2结尾
task剧本任务
README.md 说明文档
handlers执行触发动作(类似puppet消息通知)
tests文本
meta 目录表示 role角色的属性

ansible剧本常用参数:

registe:name (命令传参,或字集传参)

tags使用标记执行的模块的,可以选择单独执行某一个模块

template 和copy的模块的功能一样 ,都是向远程主机上传送文件的,可以copy是送的是原封不动的文件,template 可以将文件中的变量渲染出来 示例template: src=/etc/redis.conf dest=/etc/redis.conf

handlers执行操作 类似于puppet消息通知当触发时 执行操作 比如重启等  notify:handlersname 调用handlers操作

whene判断 可以判断数值 可以判断命令是否失败或成功 true或fales failed

item 循环 写法:user: name={{item}}  with_items: - 111

vars: 定义变量写法:- var1:111

facts:获取回传文件

ignore_errors:True忽略命令返回结果 

tomcat-install剧本roles编写

创建执行文件

installtomcat.yml

创建rosle说明文件

用于批量安装jdk及tomcat服务并启动
自定义jdk版本号 例如jdk_version: 241
由于jdk1.8版本以后 下载需要验证信息等 需手动下载安装包并放置tomcat-install rosel下files
定义tomcat启动参数如tomcat_free: JAVA_OPTS="-server -Xms512m -Xmx2048m -XX:MaxNewSize=512m -XX:PermSize=128M -XX:MaxPermSize=256M"
定义tomcat下载版本例如tomcat_ver: 7.0.106
执行tomcat-install.yml即可全自动安装

README.md

创建vars目录下main.yml 变量

#定义tomcat变量
jdk_version: 241 #定义jdk的版本号于files文件中的软件名称相对应
jdk_PATH: /usr/local/jdk/ #定义安装jdk路径
softdir: /softdir1 #创建临时软件放置目录
tomcat_path: /soft/tomcat #定义tomcat目录
tomcat_port: 8088 #定义tomcat端口号
tomcat_free: JAVA_OPTS="-server -Xms512m -Xmx2048m -XX:MaxNewSize=512m -XX:PermSize=128M -XX:MaxPermSize=256M" #定义tomcat启动参数
tomcat_ver: 7.0.106 #定义tomcat下载版本
tomcat_ver_main: "{{ tomcat_ver.split('.')[0] }}" #截取定义tomcat版本路径的首数字 用于下载tomcat url确定
down_url: https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-{{ tomcat_ver_main }}/v{{ tomcat_ver }}/bin/apache-tomcat-{{ tomcat_ver }}.tar.gz #tomcat下载地址 # vars file for tomcat-install

main.yml

创建templates目录下模板文件 jdk环境变量 tomcat的sever文件 tomcat的启停脚本

JAVA_HOME={{ jdk_PATH }}
JAVA_BIN={{ jdk_PATH }}bin
JRE_HOME={{ jdk_PATH }}jre
PATH=$PATH:{{ jdk_PATH }}bin:{{ jdk_PATH }}jre/bin
CLASSPATH={{ jdk_PATH }}jre/lib:{{ jdk_PATH }}lib:{{ jdk_PATH }}jre/lib/charsets.jar

jdk_path

<?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 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.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8085" shutdown="SHUTDOWN">
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
--> <!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="{{ tomcat_port }}"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxThreads="500"
minSpareThreads="20"
acceptCount="300"
disableUploadTimeout="true"
enableLookups="false"
URIEncoding="UTF-8"
keepAliveTimeout="10000"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
--> <!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8089" protocol="AJP/1.3" redirectPort="8443" /> <!-- An Engine represents the entry point (within Catalina) that processes
<?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 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.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8085" shutdown="SHUTDOWN">
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
--> <!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="{{ tomcat_port }}"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxThreads="500"
minSpareThreads="20"
acceptCount="300"
disableUploadTimeout="true"
enableLookups="false"
URIEncoding="UTF-8"
keepAliveTimeout="10000"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
--> <!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8089" protocol="AJP/1.3" redirectPort="8443" /> <!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost"> <!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
--> <!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm> <Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"> <!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
--> <!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
</Host>
</Engine>
</Service>
</Server>

server.xml.j2

#!/bin/sh
# chkconfig: 345 99 10
# description: Auto-starts tomcat
# /etc/init.d/tomcatd
# Tomcat auto-start
# Source function library.
#. /etc/init.d/functions
# source networking configuration.
#. /etc/sysconfig/network
prog="tomcat"
RETVAL=0 CATALINA_HOME={{ tomcat_path }} start()
{
if [ -f $CATALINA_HOME/bin/startup.sh ];
then
echo $"Starting $prog"
$CATALINA_HOME/bin/startup.sh
RETVAL=$?
echo " OK"
return $RETVAL
fi
}
stop()
{
if [ -f $CATALINA_HOME/bin/shutdown.sh ];
then
echo $"Stopping $prog"
$CATALINA_HOME/bin/shutdown.sh
RETVAL=$?
#sleep 1
ps -ef |grep $CATALINA_HOME |grep -v grep |grep -v PID | awk '{print $2}'|xargs kill -9
echo " OK"
# [ $RETVAL -eq 0 ] && rm -f /var/lock/...
return $RETVAL
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
echo $"Restaring $prog"
$0 stop && sleep 1 && $0 start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL

tomcat

创建tasks下main.yml主文件(定义剧本执行顺序) basics.yml(基本环境配置) copy.yml(jdk安装) tomcat.yml(tomcat安装部署)

---
# tasks file for tomcat-install
- include: basics.yml
- include: copy.yml
- include: tomcat.yml

main.yml

- name: 关闭firewalld
service: name=firewalld state=stopped enabled=no - name: 临时关闭 selinux
shell: "setenforce 0"
failed_when: false - name: 永久关闭 selinux
lineinfile:
dest: /etc/selinux/config
regexp: "^SELINUX="
line: "SELINUX=disabled" - name: 添加EPEL仓库
yum: name=epel-release state=latest - name: 安装常用软件包
yum:
name:
- vim
- lrzsz
- net-tools
- wget
- curl
- bash-completion
- rsync
- gcc
- unzip
- git
state: latest

basics.yml

- name: crate soft dir #创建软件目录
file: path={{ softdir }} state=directory
- name: jdk package
unarchive: src={{ softdir }}/jdk-8u{{ jdk_version }}-linux-x64.tar.gz dest={{ softdir }} copy=yes mode=755
#解压软件包到softdir目录
- name: jdk dir rename
shell: "if [ ! -d {{ jdk_PATH }} ]; then mv {{ softdir }}/jdk1.8.0_{{ jdk_version }}/ {{ jdk_PATH }}; fi"
#判断目录下有无jdk目录 将jdk移动至指定目录
- name: copy jdk_patg
template: src=jdk_path dest={{ softdir }} owner=root group=root
#将jdk模板环境变量文件放置指定目录
- name: wirte profile
shell: "if [ `grep {{ jdk_PATH }}/bin /etc/profile |wc -l` -eq 0 ]; then cat {{ softdir }}/jdk_path >> /etc/profile ; fi"
#将环境变量模板文件写入环境变量中
- name: source profile
shell: "source /etc/profile"
#重新加载环境变量

copy.yml

- name: tomcat pag
unarchive: src={{ softdir }}/apache-tomcat-{{ tomcat_ver }}.tar.gz dest={{ softdir }} copy=no owner=root group=root
- name: dir rename
shell: "if [ ! -d {{ tomcat_path }} ]; then mv {{ softdir }}/apache-tomcat-{{ tomcat_ver }}/ {{ tomcat_path }}; fi"
- name: modify tomcat start parameter
lineinfile:
dest: "{{ tomcat_path }}/bin/catalina.sh"
insertbefore: "cygwin=false"
line: "{{ tomcat_free }}"
- name: join variable_1
lineinfile:
dest: "{{ tomcat_path }}/bin/catalina.sh"
insertbefore: "cygwin=false"
line: "CATALINA_HOME={{ tomcat_path }}" - name: join variable_2
lineinfile:
dest: "{{ tomcat_path }}/bin/catalina.sh"
insertbefore: "cygwin=false"
line: "JAVA_HOME={{ jdk_PATH }}" - name: join variable_3
lineinfile:
dest: "{{ tomcat_path }}/bin/catalina.sh"
insertbefore: "cygwin=false"
line: "JRE_BIN={{ jdk_PATH }}bin" - name: join variable_4
lineinfile:
dest: "{{ tomcat_path }}/bin/catalina.sh"
insertbefore: "cygwin=false"
line: "JRE_HOME={{ jdk_PATH }}jre" - name: join variable_5
lineinfile:
dest: "{{ tomcat_path }}/bin/catalina.sh"
insertbefore: "cygwin=false"
line: "CLASSPATH={{ jdk_PATH }}jre/lib:{{ jdk_PATH }}lib:{{ jdk_PATH }}jre/lib/charsets.jar"
- name: modifly tomcat file
template: src=server.xml.j2 dest={{ tomcat_path }}/conf/server.xml owner=root group=root mode=0755
- name: copy tomcat start
template: src=tomcat dest=/usr/bin/ owner=root group=root mode=0755
- name: copy tomcat system
template: src=tomcat dest=/etc/init.d/ owner=root group=root mode=0755
- name: start tomcat
service: name=tomcat state=restarted enabled=yes

tomcat.yml

ansible基本命令及剧本的更多相关文章

  1. ansible基础-playbook剧本的使用

    ansible基础-playbook剧本的使用 作者:尹正杰  版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.YAML概述 1>.YAML的诞生 YAML是一个可读性高,用来表达数据序 ...

  2. Ansible之playbook剧本

    Ansible之playbook剧本 目录 Ansible之playbook剧本 1. playbook的组成 2. 剧本示例test1 2.1 剧本制作 2.2 准备http.conf 2.3 运行 ...

  3. ansible服务及剧本编写

    第1章 ansible软件概念说明 python语言是运维人员必会的语言,而ansible是一个基于Python开发的自动化运维工具 (saltstack).其功能实现基于SSH远程连接服务:ansi ...

  4. ansible的playbook剧本

    一.playbook剧本介绍 1)playbook介绍 Playbooks是Ansible的配置,部署和编排语言.它们可以描述您希望远程系统执行的策略,或一般IT流程中的一组步骤. 如果说ansibl ...

  5. ansible 五 playbooks剧本使用

    一.Playbook 简介 Playbooks与Ad-Hoc相比,是一种完全不同的运用Ansible的方式,而且是非常之强大的:也是系统ansible命令的集合,其利用yaml语言编写,运行过程,an ...

  6. Ansible基本命令

    Ansible安装完成之后就自带很多命令,其中较常用的有7个: ansible ansible-doc ansible-galaxy ansible-init ansible-playbook ans ...

  7. ansible 基本命令学习与踩坑

    1. 命令行参数 -v,–verbose 详细模式,如果命令执行成功,输出详细的结果(-vv –vvv -vvvv) -i PATH,–inventory=PATH 指定host文件的路径,默认是在/ ...

  8. linux系统ansible一键完成三大服务器基础配置(剧本)

    ansible自动化管理剧本方式一键完成三大服务器基础配置 环境准备:五台服务器:管理机m01:172.16.1.61,两台web服务器172.16.1.7,172.16.1.8,nfs存储服务器17 ...

  9. Ansible - 简介和应用自动化基础实践

    installAnsible简介和应用自动化基础实践 一.引入: 1.1  如官方定义,Ansible is The simplest way to automate apps and IT infr ...

随机推荐

  1. Centos7 搭建sonarQube

       可以支持包括java,C#,C/C++,PL/SQL,Cobol,JavaScrip,Groovy等等二十几种编程语言的代码质量管理与检测: SonarQube官网:https://www.so ...

  2. bzoj4589-Hard Nim【FWT】

    正题 题目链接:https://darkbzoj.tk/problem/4589 题目大意 求有多少个长度为\(n\)的数列满足它们都是不大于\(m\)的质数且异或和为\(0\). 解题思路 两个初始 ...

  3. sonar入门

    一.Sonar是什么? 根据我的了解,可以说Sonar包含三个部分: SonarQube是一种自动代码审查工具,用于检测代码中的错误,漏洞和代码味道.它可以与您现有的工作流程集成,以实现跨项目分支和提 ...

  4. 学会了这些英文单词,妈妈再也不用担心我学不会Python

    前言   很多转行或刚入行做测试的小伙伴学习Python时,经常会问一句话:我英语不好能不能学会代码. 答案是:肯定的!你如果英语好学开发语言肯定要比不会英语的小伙伴学起来.当代码报错时全是英文,毕竟 ...

  5. 小白自制Linux开发板 三. Linux内核与文件系统移植

    上一篇完成了uboot的移植,但是想要愉快的在开发板上玩耍还需要移植Linux内核和文件系统. 1.Linux内核 事实上对于F1C100S/F1C200S,Linux官方源码已经对licheepi ...

  6. java/ kotlin下的单例模式

    单例模式属于创建型模式, 顾名思义,就是说整个系统中只有一个该对象的实例. 为什么要使用单例模式? 1, 对于一些需要频繁创建,销毁的对象, 使用单例模式可以节省系统资源 2, 对于全局持有的对象,单 ...

  7. Linux7安装redis6

    首先下载软件包并解压 cd /opt wget https://download.redis.io/releases/redis-6.2.5.tar.gz tar -zxvf redis-6.2.5. ...

  8. typora博客笔记上传图片时不能显示

    前言 markdown具有轻量化.易读易写等特性,并且对于图片.超链接.图片.数学公式都有支持. 但是最近在使用Typora的过程中我发现,在写文章笔记的时候导入的图片,因为图片保存在我们电脑本地,当 ...

  9. k8s调度器介绍(调度框架版本)

    从一个pod的创建开始 由kubectl解析创建pod的yaml,发送创建pod请求到APIServer. APIServer首先做权限认证,然后检查信息并把数据存储到ETCD里,创建deployme ...

  10. 模拟赛T2 交换 解题报告

    模拟赛T2 交换 解题报告 题目大意: 给定一个序列和若干个区间,每次从区间中选择两个数修改使字典序最小. \(n,m\) 同阶 \(10^6\) 2.1 算法 1 按照题意模拟,枚举交换位置并比较. ...