标签:windows

以下是与标签 “windows” 相关联的文章

32 位 win7 下用 docker 搭建 gitlab 服务器

安装 vmware

  • 32 位 windows 没有 docker 安装版本,只能先安装 vmware,然后在 vmware 里安装 ubuntu 和 docker。
  • 安装 vmware 10.0.4 32 位版本
  • 新建虚拟机,安装 ubuntu-server-16.04,注意不要选择立即安装,否则会进入自动安装模式,最后卡死在 vmware-tools 安装界面。
  • 设置 vmware 网络为桥接模式,

安装 ubuntu 虚拟机

  • 修改 ubuntu 源为 http://mirrors.163.com/
  • 修改 root 密码

    sh
    passwd
    
  • 设置 vmware 网络为桥接模式
  • 设置静态 IP
    • ifconfig 查看网卡名称
    • 新建网卡配置 /etc/network/interfaces.d/ens33

      auto ens33
      iface ens33 inet static
      address 192.168.1.108
      netmask 255.255.255.0
      gateway 192.168.1.1
      dns-nameservers 192.168.1.1
      
    • 重启网卡 /etc/init.d/network restar
  • 安装 open-sshd ,修改 /etc/ssh/sshd_config

    Port 2222
    PermitRootLogin yes
    
  • 安装 docker,新建 /etc/docker/deamon.json

    {
      "registry-mirrors": [
        "https://changeme.mirror.aliyuncs.com"
      ],
      "insecure-registries": [],
      "debug": false
    }   
    

docker 配置

  • 新建目录 /home/share/gitlab/volume/ config log data
  • 新建文件 /home/share/gitlab/docker-compose.yml

    version: '2'
    services:
        gitlab:
          # image: 'twang2218/gitlab-ce-zh:10.0'
          image: 'gitlab/gitlab-ce:latest'
          restart: unless-stopped
          hostname: 'gitlab'
          environment:
            TZ: 'Asia/Shanghai'
            GITLAB_OMNIBUS_CONFIG: |
              external_url 'http://192.168.1.108'
              gitlab_rails['time_zone'] = 'Asia/Shanghai'
              gitlab_rails['smtp_enable'] = true
              gitlab_rails['smtp_address'] = "smtp.163.com"
              gitlab_rails['smtp_port'] = 25
              gitlab_rails['smtp_user_name'] = "MyEmail@163.com"
              gitlab_rails['smtp_password'] = "MyPassword"
              gitlab_rails['smtp_domain'] = "163.com"
              gitlab_rails['smtp_authentication'] = "login"
              gitlab_rails['smtp_enable_starttls_auto'] = true
              gitlab_rails['gitlab_email_from'] = 'MyEmail@163.com'
              user["git_user_email"] = "MyEmail@163.com"
          ports:
            - '80:80'
            - '443:443'
            - '22:22'
          volumes:
            - /home/share/gitlab/volume/config:/etc/gitlab
            - /home/share/gitlab/volume/log:/var/log/gitlab
            - /home/share/gitlab/volume/data:/var/opt/gitlab
          privileged: true
    

    注意上面的 smtp 密码为 163 授权码,不是登陆密码

  • docker 命令

    docker-compose up -d #创建
    docker-compose down #删除
    docker-compose pull #升级
    
    docker-compose start
    docker-compose stop
    

软件备份

gitlab 备份

  • 新建文件 /home/share/gitlab/backup.sh

    #!/bin/sh
    docker exec -t gitlab_gitlab_1 gitlab-rake gitlab:backup:create
    mv /home/share/gitlab/volume/data/backups/* /home/share/gitlab/backup
    chmod -R 777 /home/share/gitlab/backup/*
    
  • crontab -e

    0 3 * * * /home/share/gitlab/backup.sh
    

将备份复制到 windows

  • 在 windows 下新建网络映射目录 V: -> /home/share/
  • 新建批处理文件 gitlab-backup.bat注意网络路径不能写成盘符

    move \\192.168.1.108\share\gitlab\backup\* E:\gitlab-repo-bak\
    
  • 新建 windows 定时任务,4 点钟执行 gitlab-backup.bat

vscode 编译调试 java 单文件代码

安装

  • Language Support for Java(TM) by Red Hat
  • Java Debug Extension for Visual Studio Code

设置

  • 需要先打开一个目录,以下配置文件生成于该目录的 .vscode 目录下
  • 编译设置

    C-S-p Tasks: Configure Task Runner

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "taskName": "java build",
                "type": "shell",
                "command": "javac",
                "args": ["-d","${workspaceRoot}","${file}"],
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "problemMatcher": {
                    "owner": "java",
                    "fileLocation": ["absolute"],
                    "pattern": {
                        "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error|fatal error):\\s+(.*)$",
                        "file": 1,
                        "line": 2,
                        "column": 3,
                        "severity": 4,
                        "message": 5
                    }
                }
            }
        ]
    }
    
  • 调试设置

    Debug -> Start Debugging

    {
        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "type": "java",
                "name": "Debug (Launch)",
                "request": "launch",
                "sourcePaths": [
                    "$(workspaceRoot)"
                ],
                "classPaths": [
                    "",            
                    "$(workspaceRoot)"
                ],
                "mainClass": "${fileBasenameNoExtension}",
                "args": ""
            },
            {
                "type": "java",
                "name": "Debug (Attach)",
                "request": "attach",
                "hostName": "localhost",
                "port": 0
            }
        ]
    }
    

快捷键

  • 编译 C-S-b
  • 调试 F5

vscode 编译调试 C++ 单文件代码

安装

  • 安装 vscode
  • 安装插件 c/c++ c/c++ snippets

设置

  • 需要先打开一个目录,以下配置文件生成于该目录的 .vscode 目录下
  • IntelliSense 设置

    C-S-p c/cpp: Edit Configurations..

    {
        "configurations": [
            {
                "name": "Win32",
                "includePath": [
                    "D:/mingw540-x64/x86_64-w64-mingw32/include/c++",
                    "${workspaceRoot}"
                ],
                "defines": [
                    "_DEBUG",
                    "UNICODE"
                ],
                "intelliSenseMode": "msvc-x64",
                "browse": {
                    "path": [
                        "D:/mingw540-x64/x86_64-w64-mingw32/include/c++",
                        "${workspaceRoot}"
                    ],
                    "limitSymbolsToIncludedHeaders": true,
                    "databaseFilename": ""
                }
            }
        ],
        "version": 3
    }
    
  • 编译设置

    C-S-p Tasks: Configure Task Runner

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "taskName": "g++ build",
                "type": "shell",
                "command": "g++.exe",
                "args": ["-g","${file}","-o","${file}.exe", "-std=c++1y"], 
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "problemMatcher": {
                    "owner": "cpp",
                    "fileLocation": ["absolute"],
                    "pattern": {
                        "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error|fatal error):\\s+(.*)$",
                        "file": 1,
                        "line": 2,
                        "column": 3,
                        "severity": 4,
                        "message": 5
                    }
                }
            },
            {
                "taskName": "clang++ build",
                "type": "shell",
                "command": "clang++.exe",
                "args": ["-target", "x86_64-pc-windows-gnu", "-g","${file}","-o","${file}.exe", "-std=c++1y"], 
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "problemMatcher": {
                    "owner": "cpp",
                    "fileLocation": ["absolute"],
                    "pattern": {
                        "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error|fatal error):\\s+(.*)$",
                        "file": 1,
                        "line": 2,
                        "column": 3,
                        "severity": 4,
                        "message": 5
                    }
                }
            }
        ]
    }
    
  • 调试设置

    Debug -> Start Debugging

    {
            "version": "0.2.0",
            "configurations": [
                {
                    "name": "(gdb) Launch",
                    "type": "cppdbg",
                    "request": "launch",
                    "program": "${file}.exe",
                    "args": [],
                    "stopAtEntry": false,
                    "cwd": "${workspaceRoot}",
                    "environment": [],
                    "externalConsole": true,
                    "MIMode": "gdb",
                    "miDebuggerPath": "gdb.exe",
                    "setupCommands": [
                        {
                            "description": "Enable pretty-printing for gdb",
                            "text": "-enable-pretty-printing",
                            "ignoreFailures": true
                        }
                    ]
                }
            ]
        }
    

快捷键

  • 编译 C-S-b
  • 调试 F5

win10 安装 vs2010 vs2015 BuildTools 方法

Qt 开发需要 VC 编译器,又不想安装 VC 全家桶,可以只安装 BuildTools。