(メモ)PCにいろいろインストールする

【PCにいろいろインストールする】

■圧縮・解答ツール
https://www.cube-soft.jp/cubeice/

サクラエディタ
https://www602.math.ryukoku.ac.jp/Prog1/sakura.html
https://sakura-editor.github.io/

■Git
改行コードをコミット時LFにする
https://sukkiri.jp/technologies/devtools/git/git_win.html
https://www.curict.com/item/60/60bfe0e.html

■SourceTree
https://itsakura.com/sourcetree-install#s1

VScode
https://miya-system-works.com/blog/detail/vscode-install/

■ブラウザに必要
FireShot
ColorZilla
Talend API 

【Gitのコマンド】仕事でよく使うやつ

Gitは、sourceTreeで使用しているため、コマンドをほぼ覚えていません。

とりあえず、よく使いそうなものをメモ。

 

◆状態確認
$ git status

    Your branch is up-to-date with 'origin/develop'.
    あなたのブランチは「origin/develop」で最新です。
    
    Changes to be committed:
    コミットする変更:(ステージングされているもの)
         modified:   test3.txt

    
    Changes not staged for commit:
    コミットのためにステージングされていない変更:


    Untracked files:
    追跡されていないファイル:

 

◆状態確認(簡素)
$ git status -s

 

◆ステージに追加
$ git add test4.txt
$ git add *.txt

・管理されているファイルをステージング
$ git add -u

・すべてのファイル(追跡されていないもの、新規のものを含め)をステージング
$ git add -A

 

◆ステージから全て除く
$ git reset HEAD

 

◆コミットする
git commit -m 'test3を変更。test4, 5を追加'

 

◆プッシュする
・ローカルブランチ「develop」を、リモートレポジトリ「origin」上の同名のブランチに反映する
git push origin develop

 

◆fetchする
すべてのリモートブランチに対するリモート追跡ブランチを一括で作成および更新(フェッチ)
$ git fetch

 

◆ブランチを確認
・すべての(リモート含め)ブランチを確認
$ git branch -a

・リモートブランチの一覧を表示
git branch -r

・ローカルのブランチを確認
$ git branch --list
$ git branch -l

 

◆リモートブランチをローカルリポジトリにチェックアウトする
・ブランチ名を変えて、チェックアウトする
$ git checkout -b ローカルリポジトリでの表示ブランチ名 origin/リモートブランチ名
(ブランチ名に#などが含まれる場合、""でくくって文字列として扱わせる必要がある。)
$ git checkout -b feature/dev02 origin/develop

・(リモートの)ブランチ名と同じとき(レビューの時など)
$ git checkout feature/any

 

◆git pushでリモートリポジトリに反映する
$ git push origin feature/dev02:feature/dev02

 

◆上流ブランチの確認
$ git branch -vv

 

◆上流ブランチを変更する
$ git branch <ローカルブランチ名> -u <リモートブランチ名>
$ git branch feature/dev03 -u origin/feature/dev03

 

// ローカルブランチ名を省略すると、自動的に現在のブランチを設定
$ git branch -u <リモートブランチ名>

 

◆追跡ブランチにpushする
$ git push origin
$ git push origin feature/dev02

--------------------------------------------
□演習
・develop を feature/dev03にチェックアウト
・ファイルを1つ作り、コミット
・develop を origin/feature/dev03にpush

$ git checkout -b feature/dev03 origin/develop

$ git add -A
$ git commit -m 'test1_1を追加'

$ git branch -vv

$ git push origin feature/dev03:feature/dev03 
※要注意、上流ブランチが変わっていない

上流ブランチを変更する
$ git branch feature/dev03 -u origin/feature/dev03
$ git branch -u origin/feature/dev03

Push 時に同時に上流ブランチとして設定
$ git push -u origin feature/dev04

--------------------------------------------
□演習
・他人のブランチをチェックアウトするとき

git checkout にリモートブランチ名を指定する
(該当のリモートブランチを追跡するリモート追跡ブランチが作成され、かつ、まだ同名のローカルブランチが存在しない状態)
$ git checkout cool-feature

--------------------------------------------
◆名前つきスタッシュ
$ git stash save "20220813_1940_test5_kei"


◆スタッシュのリストを見る
$ git stash list
stash@{0}: On feature/dev04: 20220813_1940_test5_kei


◆ブランチ(既存)を切り替える
$ git checkout feature/dev01

◆スタッシュを戻す
applyであれば退避一覧から該当の作業を削除しませんが、popであれば戻した作業が退避一覧から削除される
$ git stash apply stash@{0}
・ステージングの状態を維持する
$ git stash apply stash@{0} --index

◆スタッシュのファイル一覧を見る
$ git stash show stash@{N}

◆スタッシュの中身を見る
$ git stash show -p stash@{N}

◆スタッシュを削除
$ git stash drop stash@{0}

 

 

 

 

 

Docker勉強(個人用メモ2)

centos docker イメージ ダウンロード


centos docker イメージ ダウンロード  ローカル 開発 環境 ≫
さくらのナレッジ
https://knowledge.sakura.ad.jp/?s=docker

以下を勉強する
--------------------------
【Docker入門 】① dockerイメージ取得とコンテナの基本操作
https://pointsandlines.jp/server-infra/docker/docker-beginner-1

【Docker入門 】② Webサーバ構築 & ホストのディレクトリ共有(ボリュームマウント)
https://pointsandlines.jp/server-infra/docker/docker-beginner-2
--------------------------

【Docker入門 】① dockerイメージ取得とコンテナの基本操作
https://pointsandlines.jp/server-infra/docker/docker-beginner-1


dockerバージョン確認
$ docker -v


■dockerイメージを取得してコンテナを作成・起動する

CentOSのdockerイメージを取得する
https://hub.docker.com/_/centos?tab=tags&page=1&ordering=last_updated
CentOS 7を選択した
docker pull centos:centos7

◇コンテナの作成
docker run -p 80:80 -d --privileged --name mycentos7 centos:centos7 /sbin/init

◇起動確認
$ docker ps

エラーで起動は出来なかったが、作成されている場合は、以下
$ docker ps -a
$ docker start mycentos7

◇コンテナへログイン
docker exec -it mycentos7 /bin/bash


【Docker入門 】② Webサーバ構築 & ホストのディレクトリ共有(ボリュームマウント)
https://pointsandlines.jp/server-infra/docker/docker-beginner-2

(windows10proの場合)
Docker for WindowsWindowsの任意のフォルダをコンテナにマウントする
https://roundwide.com/ja/mount-windows-folder-to-docker-container/

(toolboxの場合)
★【Windows10】Docker toolboxでコンテナとホストPCでファイル共有する方法
https://se-lifework.com/docker-toolbox-file/

Docker toolbox on windows マウント:Dockerコンテナの中でホストのフォルダを見たい
https://qiita.com/hnishi/items/db10505e36c95587851d

Dockerコンテナの作成、起動-停止まで
https://qiita.com/kooohei/items/0e788a2ce8c30f9dba53
exit


◇ログアウト
exit

◇コンテナの停止
$ docker stop mycentos7


①Vertual Boxの共有フォルダ-の設定
C:\Users\xxxxxx\source
source

②仮想サーバに共有フォルダマウントディレクトリ作成
docker-machine ssh default 'sudo mkdir -p /source'

③仮想サーバに共有フォルダマウント
docker-machine ssh default 'sudo mount -t vboxsf -o uid=0,gid=0 source /source'

≪docker yml 書き方≫
https://qiita.com/yuta-ushijima/items/d3d98177e1b28f736f04

≪docker yml 場所≫
Docker compose ことはじめハンズオン
https://qiita.com/TsutomuNakamura/items/7e90e5efb36601c5bc8a

連載】世界一わかりみが深いコンテナ & Docker入門  その4:docker-composeってなに?
https://tech-lab.sios.jp/archives/20051#docker-compose

Docker勉強(個人用メモ1)

≪docker 使い方≫

初心者による初心者のためのDocker入門 その1 dockerコマンド編
https://qiita.com/k5n/items/2212b87feac5ebc33ecb

    64bit
    Windows 7以降
    仮想化支援技術(IntelならVT-x, AMDならAMD-v)がCPUでサポートされている
    BIOSで上記仮想化支援機能(Virtualization)を有効にしている
    の条件が満たされていれば Docker Toolbox が利用できます。"docker toolbox インストール" でググれば情報が色々出てくるかと思います。

    ★後で見ておく
    Windows の場合も Windows 10 以上かつ Home でなければ Docker for Windows をインストールするだけ

【触って理解!】Docker入門 - 初心者に向けて使い方や基本コマンドを解説
https://www.pasonatech.co.jp/workstyle/column/detail.html?p=2675

 

aws-cliコマンドが使えるコンテナを作る
https://qiita.com/reflet/items/d322466baf9935ee2230


-----
≪docker desktop windows8

Windows 8.1でDocker ToolboxをインストールしてDockerを動かす
https://qiita.com/FukuharaYohei/items/a913f5ef5a5aa550f46a

Windows/MacでDockerを使う3つの方法
https://www.codelab.jp/blog/?p=2845

    Docker Desktop    
        他の仮想化技術(VirtualBoxなど)と共存できない
        2020年5月以降のバージョンで使える
    Docker Toolbox
        
    仮想化環境で適当なLinuxを入れてDockerをインストール


【公式】
https://docs.docker.jp/desktop/toc.html
WSL2バックエンド
Windows 10 64ビット:HomeまたはPro 2004(ビルド19041)以降
…要件を満たしていない
よって、toolboxの方法を選択する

-----
VirtualBoxとDockerを共存させる方法
https://www.whizz-tech.co.jp/6297/
…toolboxのインストールの場所があった

-----

済:【Docker】初心者はdocker-composeから始めた方がいいかもしれない説【チャーハン例えをお借りして】
https://coinbaby8.com/docker-beginner.html

≪docker-compose サンプル≫

≪docker toolbox windows8≫

■Docker for Windows のインストール
https://docs.docker.jp/windows/step_one.html
    Toolboxを使いインストール

ステップ1:バージョンの確認
    win8.1
    64ビット
Windows 8 または 8.1
    CPU 「仮想化」が「有効」

ステップ2:Docker Toolbox のインストール
VirtualBox 6.1

Docker Toolboxは非推奨になっていた。

ダウンロード
https://github.com/docker-archive/toolbox/releases
DockerToolbox-19.03.1.exe

ステップ3:インストールの確認
インストール後、「Docker Quickstart」アイコンをダブルクリック

■イメージとコンテナを学ぶ
https://docs.docker.jp/windows/step_two.html

$ docker run hello-world
    run:コンテナ作成・実行
    hello-world:コンテナに読み込むイメージの情報

whalesay イメージの検索と実行
https://docs.docker.jp/windows/step_three.html

Docker Hub
https://hub.docker.com/

ステップ2:whaysay イメージの実行

$ docker run docker/whalesay cowsay boo
    コンテナ内の whalesay イメージにあるコマンドを実行
    イメージが手元になければ、 docker は Docker Hub から取得

$ docker images
    手元のシステム上にある全イメージを表示

$ docker run docker/whalesay cowsay boo-boo

自分でイメージを構築
https://docs.docker.jp/windows/step_four.html

ステップ2:Dockerfile を書く

$ cd 
$ cd Desktop

$ mkdir testdocker
$ cd testdocker
$ touch Dockerfile
$ notepad Dockerfile&

(Dockerfile)
FROM docker/whalesay:latest
            FROM:Docker に対してイメージの元となるイメージを伝えます
RUN apt-get -y update && apt-get install -y fortune
            fortunes:プログラムは賢そうな言葉を表示するプログラム
            apt-getプログラムを使い fourtune プログラムをインストール
CMD /usr/games/fortune -a | cowsay


◇ステップ3:Dockerfile を使ってイメージ構築
docker build -t docker-whale .
    現在のディレクトリ内にある Dockerfile を使う
    自分のマシン上に 『docker-whale』 という名称のイメージを構築
    
ステップ5:新しい docker-whale を実行
$ docker run docker-whale

Docker Hub アカウントとリポジトリの作成
https://docs.docker.jp/windows/step_five.html

イメージのタグ付け、送信、取得
https://docs.docker.jp/windows/step_six.html

 

 

 

 


centos docker イメージ ダウンロード≫
https://se-tomo.com/2018/10/20/docker%E3%81%A7%E3%82%A4%E3%83%A1%E3%83%BC%E3%82%B8%E3%81%AE%E3%83%80%E3%82%A6%E3%83%B3%E3%83%AD%E3%83%BC%E3%83%89%E3%81%8B%E3%82%89%E3%82%B3%E3%83%B3%E3%83%86%E3%83%8A%E3%81%B8%E3%81%AE%E6%8E%A5/

 

 

Gitコマンド(メモ)

普段、sourceTreeを使っているため、Gitはコマンドで使用することがありません。

そのため、ほぼ覚えていません。

思い出すために、メモを残しました。

 

git branch
ブランチの一覧を見る。

 

git branch --list
ブランチの一覧を見る。

 

git branch <mybranch>
<mybranch>を作成する。
チェックアウトはされない。

 

git branch -a
全てのブランチを、リモートブランチも含めて表示

 

git branch -r
リモートブランチを表示

 

git branch -v

詳細情報をつけて、ブランチを表示

次ページ

q

中止

 

参考:git branch コマンド - Qiita

 

git checkout -b <mybranch>
<mybranch>を作成し、チェックアウトをする。

 

git status
現在の状態の確認

 

git status -s
現在の状態を簡潔に確認

 

参考:git status -s でちょっと幸せになれる - Qiita

 

git add -u
git add --update
gitで管理されているファイルがaddされる。

 

git add -A
git add --all
変更のあったファイルが全てaddされる。

 

git add .
カレントディレクトリ以下の変更のあったファイルが全てaddされる。

 

参考:git add -u と git add -A と git add . の違い | note.nkmk.me

 

git commit -a -m "メッセージ"
-a 変更済みのファイルをaddしてコミット
-m メッセージを追加

 

git commit -a -m "メッセージ"

 

git commit --amend -m 'メッセージを変えました'
直前のcommitを書き換える。

 

参考:gitコマンドの使い方 ~ git commit ~ | Snow System

 

git push origin sub2
origin=リモートリポジトリ
sub2=ローカルとリモートの同名ブランチ

 

git push origin master:master
ローカルブランチ「master」をリモートにある「master」に push

 

 

 

 

 

 

 

vagrant+virtualboxでCentOS 7構築(windows)

vagrantvirtualboxのインストール

qiita.com

ここを参考にしました。

ただし、以下は、vagrant-vbguestとvagrant-hostmanagerのみ実施。

> vagrant plugin install vagrant-omnibus 

  →エラーが出たため、アンインストールした。

  vagrant plugin uninstall vagrant-omnibus
> vagrant plugin install vagrant-vbguest
> vagrant plugin install vagrant-hostmanager

 

ここも分かりやすいので、両方参考にしました。

taustation.com

あと、アンインストールに関しては、以下を参考にしました。

pentan.info

■Vagrantfileの修正

追加した内容は以下です。

  if Vagrant.has_plugin?("vagrant-vbguest")
    config.vbguest.auto_update = false
  end
  
  config.vm.box_check_update = false
  
  config.vm.network "forwarded_port", guest: 80, host: 8080
  
  config.vm.synced_folder "C:/vagrant/centos77/share", "/vagrant_data"

  config.vm.box_url = "https://app.vagrantup.com/bento/boxes/centos-7.7

vm.box_urlについて)

>vagrant up

したときに、以下のエラーが出たため、追記しました。

    Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Box 'bento/cenos-7.7' could not be found. Attempting to find and in
    stall...
        default: Box Provider: virtualbox
        default: Box Version: >= 0
    The box 'bento/cenos-7.7' could not be found or
    could not be accessed in the remote catalog. If this is a private
    box on HashiCorp's Vagrant Cloud, please verify you're logged in via
    `vagrant login`. Also, please double-check the name. The expanded
    URL and error message are shown below:

    URL: ["https://vagrantcloud.com/bento/cenos-7.7"]
    Error: The requested URL returned error: 404 Not Found

エラーについては、以下を参考にしました。

qiita.com

 

 

githubでプルリクを出す、コードレビューをする(参考サイトまとめ)

githubでプルリクを出す

公式がやっぱり分かりやすいです◎。

docs.github.com

こちらも、参考になります。

atmarkit.itmedia.co.jp

githubでコードレビューをする

やはり、公式が一番わかりやすかったです◎。

docs.github.com