当前位置: 首页 > news >正文

网站建设都是用什么软件数字媒体艺术网站建设

网站建设都是用什么软件,数字媒体艺术网站建设,女孩学网站开发和动漫设计,ps做的网页怎么导入网站大家好#xff0c;今天我要和大家分享一个关于搭建centos环境的新方法。 以前我们经常会看到一些文章介绍如何搭建centos环境#xff0c;但很多时候都会出现一些问题。不过现在有了一种新的方法#xff0c;就是使用ansible脚本来实现。 虽然这种方法仅适用于centos7#…大家好今天我要和大家分享一个关于搭建centos环境的新方法。 以前我们经常会看到一些文章介绍如何搭建centos环境但很多时候都会出现一些问题。不过现在有了一种新的方法就是使用ansible脚本来实现。 虽然这种方法仅适用于centos7但只要稍作修改就可以应用到其他的环境中。使用ansible脚本可以让搭建环境更加简单、快速、稳定。 GIT 项目访问地址 https://gitee.com/haofeng82/basic-host-machine--init.git 目录 介绍 软件架构 安装教程 使用说明 初始化操作用户。 2. 主机基本功能初始化。 3.为机器设置host映射。 可能存在的问题 脚本摘要 1 初始化操作账户 2 初始化centos系统 3 安装docker 4 设置hosts映射 GIT 项目访问地址 介绍 这是一套ansbile脚本实现了始化基于centos7系统的服务器主机基础环境的功能。 目前仅用于测试和教学环境使用并仅保证centos77版本有效。 软件架构 软件基于ansible脚本对服务器进行初初始化工作主要工作如下 1 增加ops做操作账户并为其增加ssh证书登录此用户可以切换至root。 2 并且禁用了root登录。所有需要root的行为都会通过ops 进行become 3 禁用了防火墙等功能。统一使用外部防火墙。 4 安装了必要的系统包并进行了系统优化。 5 安装了docker因为后续的一些其他项目的安装会用到docker。 6 提供了统一设置主机host的功能 安装教程 1需要找一台服务器安装ansible环境然后把当前项目复制到相应的目录下。 2依据后面的使用步骤执行脚本即可。 PS:主机目录文件需要自行进行修改。 证书使用了预先生成好的证书也可以自行生成配置。 使用说明 初始化操作用户。 当拿到一台新机器时首先需要对其进行用户限制。 前提将主机设置为可以使用root登录。密码统一初始化为XXX. 主要操作如下 1 禁用root的远程登录。 2 禁用密码登录。 3 创建operator操作用户及operator组。并为其设置登录密码、上传登录共公钥。 上面的所有操作均在init-user角色中并通过下面的脚本调用 上传整个目录到ansible主机的/ansible/basic-host-machine目录下并对host文件中的to-init-user-host分组中的主机ip进行设置。指定为要操作的机器。 cd /ansible/basic-host-machine cp -rf /ansible/basic-host-machine/.ssh /root ansible-playbook -vvv --check -i hosts/nat/host-basic init-basic-host-user.yml ansible-playbook -vvv -i hosts/nat/host-basic init-basic-host-user.yml 2. 主机基本功能初始化。 此步骤必须依赖第一步 在执行完初始化用户之后。会以operator用户进行登录。 此时的root用户已经被禁用掉了。 上传整个目录到ansible主机的/ansible/basic-host-machine目录下并对host文件中的to-init-env-host分组中的主机ip进行设置。指定为要操作的机器。 主要工作包括 安装必要的工具包 开启或者关闭防火墙以及selinux 安装docker环境 cd /ansible/basic-host-machine ansible-playbook -vvv --check -i hosts/nat/host-basic init-basic-host-env.yml ansible-playbook -vvv -i hosts/nat/host-basic init-basic-host-env.yml 3.为机器设置host映射。 此步骤必须依赖第一步 统一对主机的hosts进行配置 上传整个目录到ansible主机的/ansible/basic-host-machine目录下并对host文件中的to-init-user-host分组中的主机ip进行设置。指定为要操作的机器。 cd /ansible/basic-host-machine ansible-playbook -vvv --check -i hosts/nat/host-basic set-host-mapping ansible-playbook -vvv -i hosts/nat/host-basic set-host-mapping.yml 可能存在的问题 变量的配置还是有一些不合适的地方。需要再进行修改。目前仅是提交了初始版本。 代码放到了git上需要的小伙伴直接拿来用就好。如果有不严谨的地方也希望能够指正出来。 脚本摘要 1 初始化操作账户 --- #关闭防火墙 - name: close fire wall shell: {{ item}} with_items: - systemctl stop firewalld.service - systemctl disable firewalld.service #关闭selinux - name: Disabled SELinux selinux: statedisabled #下次启动也不会再起selinux - name: set selinux disabled replace: path: /etc/selinux/config regexp: ^SELINUXenforcing replace: SELINUXdisabled ##创建用户分组 - name: Create group group:  name{{group}} statepresent when: add_user #当add_user变量为true创建用户。此用户用于运行项目。 - name: Add sudo user user: name: {{ user }} password: {{ operation_user_password }} state: present when: add_user #将证书拷贝至远程机器,用户为root这一步是为了能够通过证书ssh访问远程主机 - name: install ssh key authorized_key: user{{user}} key{{ lookup(file,/root/.ssh/id_rsa.pub)}} statepresent #将用户临时切换到为sudo root用户时,设置为不需要密码。 - name: Add configured user accounts to passwordless sudoers. lineinfile: dest/etc/sudoers regexp^{{ user }} line{{ user }} ALL(ALL) NOPASSWD: ALL statepresent validatevisudo -cf %s 2 初始化centos系统 --- #配置主机名 - name: Configure hostname hostname: name: {{ host_name }} - name: install basic tools1 yum: name: {{ item }} state: present with_items: - wget #更换yum阿里数据源     - name: change yum source to ali shell: {{ item}} with_items: - mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup - wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo - yum clean all - yum makecache #安装基础工具 #- name: update yum #  shell: yum -y update - name: install basic tools2 yum: name: {{ item }} state: present with_items: - wget - curl - unzip - vim - net-tools - nfs-utils - pcre-devel - openssl-devel - gcc - perl - perl-devel #复制cronolog rpm安装文件到服务器 - name: copy cronolog rpm install file copy: src:  {{ playbook_dir }}/data/archive/cronolog-1.6.2-14.el7.x86_64.rpm dest: /tools/cronolog/ # 安装 cronolog - name: install cronolog shell: {{ item }} with_items: - rpm -ivh /tools/cronolog//cronolog-1.6.2-14.el7.x86_64.rpm ignore_errors: True     #临时修改linux文件句柄数用户级别 - name: modify linux user ulimit temp shell: {{ item}} with_items: - ulimit -SHn 65535 # 永久修改 linux user soft limit - name: modify linux root user soft  ulimit per lineinfile: dest/etc/security/limits.conf regexp^root soft nofile lineroot soft nofile 65535 statepresent # 永久修改 linux user hard limit - name: modify linux user ulimit per lineinfile: dest/etc/security/limits.conf regexp^root hard nofile lineroot hard nofile 65535 statepresent # 永久修改 linux user soft limit - name: modify linux ops user soft  ulimit per lineinfile: dest/etc/security/limits.conf regexp^ops soft nofile lineops soft nofile 65535 statepresent # 永久修改 linux user hard limit - name: modify linux ops user ulimit per lineinfile: dest/etc/security/limits.conf regexp^ops hard nofile lineops hard nofile 65535 statepresent # 上传 linux system 配置文件优化系统性能参数 - name: upload linux system   ulimit temp shell: echo  655350 /proc/sys/fs/file-max - name: Copy sysctl.conf to server template: src: sysctl.conf.j2 dest: /etc/sysctl.conf mode: 0740 # 重启sysctl - name: restart sysctl shell: sysctl -p #将证书复制到用户的.ssh目录下并更改权限。 - name: copy auth public  key to host file copy: src:  /root/.ssh/id_rsa.pub dest: /home/{{ user }}/.ssh/ owner: {{ user }} group: {{ group }} #私钥的权限一定不要别的用户和组能够读取到 - name: copy auth private key to host file copy: src:  /root/.ssh/id_rsa dest: /home/{{ user }}/.ssh/ owner: {{ user }} group: {{ group }} mode: 0600 #更新sshd文件配置,更改sshd端口是否开启sshd_use_dns是否开启sshd_gssapi_authentication是否开启, #设置sshd协议 2禁止root登录先不设置是否开启密码登录先不禁止密码登录 - name: Update SSH configuration to be standard setting. lineinfile: dest{{ sshd_config_path }} regexp{{ item.regexp }} line{{ item.line }} statepresent with_items: - { regexp: ^#?Port, line: Port {{ sshd_port }} } - { regexp: ^#?UseDNS, line: UseDNS {{ sshd_use_dns }} } - { regexp: ^GSSAPIAuthentication, line: GSSAPIAuthentication {{ sshd_gssapi_authentication}} } - { regexp: ^#?Protocol, line: Protocol {{ sshd_protocol }} } - { regexp: ^#?PermitRootLogin, line: PermitRootLogin {{ sshd_permit_root_login }} } - { regexp: ^PasswordAuthentication, line: PasswordAuthentication {{ sshd_password_authentication }} } - { regexp: ^#?RSAAuthentication, line: RSAAuthentication yes } - { regexp: ^#?PubkeyAuthentication, line: PubkeyAuthentication yes } - { regexp: ^#?RhostsRSAAuthentication, line: RhostsRSAAuthentication yes } notify: restart sshd #更新sshd文件配置,更改sshd端口是否开启sshd_use_dns是否开启sshd_gssapi_authentication是否开启, #设置sshd协议 2禁止root登录先不设置是否开启密码登录先不禁止密码登录 - name: Update SSH configuration to be standard setting. lineinfile: dest{{ ssh_config_path }} regexp{{ item.regexp }} line{{ item.line }} statepresent with_items: - { regexp: ^#?StrictHostKeyChecking, line: StrictHostKeyChecking no } notify: restart sshd 3 安装docker --- #配置主机名 #https://www.jianshu.com/p/b4a6239712bf #还需要更新docker镜像源 - name: Configure hostname hostname: name: {{ host_name }} - name: install yum-utils yum: nameyum-utils statepresent ignore_errors: True - name: add docker repo shell: yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo ignore_errors: True - name: install docer-ce yum: name: docker-ce state: present ignore_errors: True - name: install docker-ce-cli yum: name: docker-ce-cli state: present ignore_errors: True - name: install containerd.io yum: name: containerd.io state: present ignore_errors: True - name: 创建docker目录 shell: mkdir -p /etc/docker/ - name: config mirro copy: src~/docker-daemon.json dest/etc/docker/daemon.json tags: configmirro - name: start enable docker service: namedocker statestarted enabledtrue - name: restrat shell: sudo systemctl daemon-reload sudo systemctl restart docker tags: restart #必须在ansible主机之上的/data/archive下存在docker-compose文件 - name: Copy docker compose file copy: src:  {{ playbook_dir }}/data/archive/docker-compose dest: /usr/local/bin/docker-compose - name: install docker compose shell: {{ item }} with_items: - sudo chmod x /usr/local/bin/docker-compose - sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose - sudo docker-compose --version ignore_errors: True 4 设置hosts映射 #更新ip-host映射   - name: update-ip-host-mapping template: src: host-file.j2 dest: /etc/hosts mode: 0644 GIT 项目访问地址 https://gitee.com/haofeng82/basic-host-machine--init.git 大家可以在评论区留言分享自己使用ansible脚本搭建环境的经验和技巧让我们一起交流吧记得点赞和分享哦
http://www.hkea.cn/news/14485446/

相关文章:

  • 仿韩国网站源码搭建网站的流程
  • 做平面有什么好的网站信阳企业网站开发
  • 免费创建论坛网站网络科技公司起名大全参考
  • 公司网站建设费用明细表线上宣传方案
  • 中国建设银行网站网上银行网站a记录吗
  • 网站建设什么是开发实施实施网站的设计开发
  • asp网站开发技术wordpress版权破解
  • 网站开发公司多少钱织梦网站源文件没有style文件夹怎么修改网站背景
  • 贵州住房和城乡建设厅旧网站优质做网站费用
  • 网站收录了被人为删了怎么办沈阳网站制作公司
  • 广东省建设网站多种昆明网站建设
  • 网站建设教程视频百度云修文县抖音seo推广收费
  • 苏州网站推广电话一个阿里云怎么做两个网站吗
  • 质量好网站建设费用自媒体平台怎么赚钱
  • 唐山网站关键词优化网站 不稳定
  • 网站界面类型seo关键字排名优化
  • 做网站要多长时间电商主图一键生成免费
  • 镇江做网站要多少钱百度一下马上知道
  • 成都网站优化平台网站分析 工具
  • 做黑彩网站赚钱吗win2008 建立网站
  • 邢台做wap网站价格广州正规的免费建站
  • 便宜做网站8818网站排名突然下降
  • 产品展示类网站源码阳春市住房规划建设局网站
  • 在东莞做网站wordpress 自定义注册页面
  • 如何建设自己网站做网站seo优化总结
  • 上海外贸建站商城佛山网站建设方案服务
  • 用html5做京东网站代码上海网站建设到诺然
  • 网站建设套模板下载做视频网站要准备哪些资料
  • 电子商务网站建设课设怎样做微商网站
  • 平昌县建设局网站手机可以做软件开发吗