備忘禄(メモ代わりのようなモノ)

Welcome to my blog !


Windows作業記録

Published at April 7, 2024 ·  1 min read

wsl2で起動したsshサーバを外部から接続可能にするスクリプト(windows側で設定する) IP=`ip -4 address show eth0 |grep inet|sed 's/^ *inet //' | cut -d/ -f1` netsh.exe interface portproxy delete v4tov4 listenport=22 netsh.exe interface portproxy add v4tov4 listenport=22 connectaddress=$IP 固定IPで起動したsshサーバを外部から接続可能にするスクリプト(windows側で設定する) wsl -d Ubuntu-20.04 -u root ip addr add 192.168.127.16/24 broadcast 192.168.127.255 dev eth0 label eth0:1 netsh.exe interface ip add address "vEthernet (WSL)" 192.168.127.1 255.255.255.0 netsh.exe interface portproxy delete v4tov4 listenport=22 netsh.exe interface portproxy add v4tov4 listenport=22 listenaddress=0.0.0.0 connectport=22 connectaddress=192.168.127.16 sc.exe config iphlpsvc start=auto sc....

Ceph

Published at July 19, 2023 ·  1 min read

cephの状態を確認したコマンドの記録 pvscan pvdisplay vgscan vgdisplay lvscan lvdisplay mount -t ceph 10.220.1.102,10.220.1.104,10.220.1.106:/ /mnt/pve/cephfs -o name=admin ceph osd tree ceph osd status rbd pool stats rbd ls rbd --image vm-100-disk-0 info ceph-volume lvm list grep VmSwap /proc/*/status | sort -nr -k 2 | head -10 ps -eo lstart,pid,args|less ceph df ceph node ls ceph config dump ceph config get osd.0 osd_memory_target ceph config show osd.0 ceph config show-with-defaults osd.0 ...

systemctl

Published at July 12, 2023 ·  1 min read

サービスを調べる(例) systemctl list-units sshd* systemctl list-units named* ログを調べる(例) journalctl -f -u named.service journalctl -f -u sshd.service ページャでログを調べる(例) journalctl -ex -u sshd.service 稼働しているサービスの一覧を表示する systemctl list-units 全てのサービスの一覧を表示する systemctl list-unit-files サービスを起動する(例) systemctl start docker サービスを停止する(例) systemctl stop docker サービスを自動起動できるように設定する(例) systemctl enable docker サービスを再起動する(例) sudo service ssh restart サービスの状態を調べる sudo systemctl status ssh ...

IP

Published at February 2, 2022 ·  1 min read

ネットワークデバイスの確認 sudo lshw -short -class network ネットワークインターフェイスを追加 sudo ip addr add 192.168.127.16/24 broadcast 192.168.127.255 dev eth0 label eth0:1 ネットワークインターフェイスを追加 sudo vi /etc/network/interfaces auto eth0:1 iface eth0:1 inet static address 192.168.127.16 network 192.168.127.0 netmask 255.255.255.0 broadcast 192.168.127.255 vxlanで疎通の確認を行う(host A) ip link add vxlan0 type vxlan id 10 dstport 4789 dev enX0 ip -d link show vxlan0 ip link set up vxlan0 ip addr add 172.24.77.191/24 dev vxlan0 ip addr show vxlan0 bridge fdb append 00:00:00:00:00:00 dev vxlan0 dst 10....

Ansible

Published at August 19, 2021 ·  1 min read

sudo vi /etc/ansible/hosts [dev] localhost sudo vi /etc/ansible/ansible.cfg [defaults] interpreter_python = /usr/bin/python pipelining = True [ssh_connection] ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null テスト用コマンド ansible dev -m ping -o -u hidekuno ansible dev -m setup -o -u hidekuno ansible -i inventories/dev ohap -m ping -o -u hideki ansible -i inventories/dev ohap -m setup -o -u hideki Playbookの実行 ansible-playbook -i inventories -u hideki playbook.yml モジュールの一覧を取得 ansible-doc -l ...

Djangoの使い方

Published at May 4, 2021 ·  1 min read

djangoのインストール(ubuntu) sudo apt install python3-pip echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc source ~/.bashrc pip3 install Django pip3 install django-bootstrap4 プロジェクトの作成例 django-admin startproject ${PRJ} migrateのやり方 python3 manage.py makemigrations python3 manage.py migrate 管理者の作成 python3 manage.py createsuperuser アプリの作成 python3 manage.py startapp ${APP} migrateのやり方(アプリ単位) python3 manage.py makemigrations ${APP} python3 manage.py migrate ${APP} modelの操作 python3 manage.py shell ...

Emacs

Published at January 13, 2021 ·  1 min read

よく忘れる操作 カーソル移動 操作 キーバインド コマンド 指定行へ移動 M-g M-g, M-g g goto-line 指定列へ移動 M-g TAB move-to-column ウィンドウの最上部に M-r M-r move-to-window-line ウィンドウの中央に M-r move-to-window-line ウィンドウの最下部に M-r M-r M-r move-to-window-line 入力・編集 操作 キーバインド コマンド 直前のコマンドを繰り返す C-x z repeat すべてを選択 C-x h 直前のコマンドを繰り返す C-x z repeat 特殊文字の入力 C-q {char} quoted-insert 行末の空白を削除する delete-trailing-whitespace マクロ 操作 キーバインド コマンド 記録開始 C-x ( start-kbd-macro 記録終了 C-x ) end-kbd-macro 実行 C-x e call-last-kbd-macro 編集 C-x C-k edit-kbd-macro キーバインドの一覧を表示 describe-bindings 指定したディレクトリ以下のファイルに対して、一括置換を行う M-x find-name-dired Find-name (directory): ~/path/ Find-name (filename wildcard): * t Q Query replace regexp in marked files: foo Query replace regexp in marked files foo with: bar C-x s !...

WSLについて記録

Published at April 7, 2020 ·  5 min read

https://docs.microsoft.com/ja-jp/sysinternals/downloads/ctrl2capよりctrlとcapsを入れ替える WSL(Windows Subsystem for Linux) を有効にする Windows Storeよりubuntuをインストールする dockerをインストールする 現場がproxyを利用しているのでdockerのconfigで設定する VcXsrvをインストールする emacsをインストールする 現場がproxyを利用しているのでaptの下記内容の設定を行う cat /etc/apt/apt.conf Acquire::http::Proxy "http://192.168.127.1:8080"; Acquire::https::Proxy "http://192.168.127.1:8080"; sudoの設定 sudo apt-get remove nano visudo hideki ALL=NOPASSWD: ALL pythonの設定(python3を優先とする) sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 wslでの記録 sudo apt-get install apt-transport-https ca-certificates curl software-properties-common curl -x http://192.168.33.4:8080 -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download....

Xauth

Published at March 16, 2020 ·  1 min read

Xアプリケーションを実行すると、下記現象が発生する場合がある。(原因は調べてるところ) Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: 172.16.43.12:0 その対処(暫定措置)を記す。 xauth list $DISPLAY xauth remove $DISPLAY ...

Macで Happy Hacking Keyboardを使う

Published at December 30, 2019 ·  1 min read

バックスラッシュを設定する Caps Lockキーで英字・日本語入力切替を行う。 https://www.pfu.fujitsu.com/hhkeyboard/leaflet/hairetu.html...


Recent posts

Windows作業記録

Ceph

systemctl

IP

Ansible


Archives

2024 (1)
2023 (2)
2022 (1)
2021 (3)
2020 (2)
2019 (6)
2018 (20)