2019年8月16日金曜日

git

gitは、web上のプロトコルでなくても、ローカルのファイルシステムでも動作する。
動作確認は、ローカルのファイルシステムで行うのが簡単

$mkdir base.git
$cd base.git
$git init --bare --shared
$cd ..
$git clone --bare --shared base.git second.git

$ git clone base.git test0
Cloning into 'test0'...
warning: You appear to have cloned an empty repository.
done.

$cd test0
$ git remote set-url --push origin ../second.git
$ git remote -v
origin /home/ok/git_test/base.git (fetch)
origin ../second.git (push)

$ echo 'first commit' >  a
$ git add .
$ git commit -m 'first commit'
[master (root-commit) 8c08e8e] first commit
 1 file changed, 1 insertion(+)
 create mode 100644 a
$ git push
Counting objects: 3, done.
Writing objects: 100% (3/3), 212 bytes | 212.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../second.git
 * [new branch]      master -> master

2019年4月5日金曜日

ubuntu kernel build

apt でソースがダウンロードできるように
sudo sed -i 's/^# deb-src/deb-src/g' /etc/apt/source.list
source.listのdev-srcのコメントをはずす。
修正したら
sudo apt update

linuxビルドに必要なものをインストールする。
sudo apt install ccache fakeroot libncurses5-dev
sudo apt build-dep linux

sourceの取得
apt source linux
で取得できるが
NOTICE: 'linux' packaging is maintained in the 'Git' version control system at:
git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic
Please use:
git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic
上記の方法で取得したubuntu kernelは、下記の方法ではビルドできない
若干の修正が必要

git で取得しろとのこと
git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

cd linux
mkdir ../build
cp /boot/config-`uname -r` ../build/.config

make O=../build/ olddefconfig

カーネルビルド
make -j9 O=../build/ LOCALVERSION=-xxx

モジュールビルド
make modules -j9 O=../build/ LOCALVERSION=-xxx


パッケージ作成
make bindeb-pkg O=../build/ LOCALVERSION=-xxx
bindeb-pkg バイナリパッケージのみ
deb-pkg ソースパッケージも作成

インストール
sudo apt ../*.deb



build 時間
core2 duo

real    190m49.470s
user    310m50.655s

sys     36m25.217s

Intel(R) Core(TM) i3-6100U CPU @ 2.30GHz
real 115m21.085s
user 166m20.077s
sys 17m37.104s

Intel(R) Pentium(R) CPU G4620 @ 3.70GHz
real 51m28.830s
user 185m58.351s
sys 15m43.776s

Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
real 20m22.547s
user 113m49.728s
sys 11m31.246s

lxd環境
real 1087.78  18m7.78
user 7239.94    120m39.94
sys 874.63           14m34.63









2019年1月13日日曜日

php apache postgresql ubuntu18へのインストール

apache2 とphp のインストール
#apt install php
これだけ
/var/www/html/phpinfo.php
を作って 動作確認をしてみる
phpinfo.phpは
<?php phpinfo() ?>

postgresのインストール
#apt install postgresql
インストールしたらpostgresのパスワード設定をする
#su - postgres
$psql
postgres=# \password
Enter new password:
Enter it again:
postgres=# \q
$exit
#
phppgadminのインストール
#apt update
#apt install phppgadmin
そのままでは、外部からアクセスできないので
/etc/apache2/conf-available/phppgadmin.conf
を修正
Require local => Require all granted
/etc/phppgadmin/config.inc.php
を修正
$conf['extra_login_security'] = false;
apache2再起動
#systemctl restart apache2
http://xxx.xxx.xxx.xxx/phppgadmin
をアクセスして動作確認




2019年1月11日金曜日

lxd containerに関するメモ

container  ubuntu18

lxdはlxcを使いやすくしたもの

インストール
sudo apt instasll lxd
snap install lxd

初期化
lxd init
いろいろ設定項目があるが、すべてdefaultで大丈夫
 
下記のエラーが出力される場合は、
 Error: Failed to connect to local LXD: Get http://unix.socket/1.0: dial unix  /var/snap/lxd/common/lxd/unix.socket: connect: permission denied

idコマンドでlxdグループが追加されているか確認し、
ない場合は、
usermod -aG lxd USER名
でグループを追加しlogoff/loginする。(exec $SHELL -l)


コンテナの作成
lxc launch ubuntu:18.04 ub18  
 (lxc launch ubuntu:20.10 ub201)
  ub18は、任意のコンテナの名前

コンテナのリスト表示
lxc list
コンテナのイメージのリスト
lxc image list
コンテナの情報
lxc info コンテナの名前

コンテナの起動 lxc start ub18

コンテナの接続 lxc exec ub18 -- bash

コンテナの停止 lxc stop ub18
コンテナの削除 lxc delete ub18


lxc file pull
lxc file push

fedora28のイメージをダウンロードしてコンテナを作るのは
lxc launch images:fedora/28/amd64 fe28

snapshotの作成
lxc snapshot ub18 20190120

コンテナ内のウエブサイト等を外部に公開する。
host側のnicに公開用のaddressを追加
ip a add 192.168.0.88/24 dev enp0s10
公開用のアドレスとコンテナのアドレスを接続する。
sudo iptables -t nat -A PREROUTING -p tcp -d 192.168.0.88 -i enp0s10 --dport 80 -j DNAT --to-destination 240.82.0.47:80

リモートサーバ名
lxc remote list

イメージのリスト
lxc image list ubuntu:

LXD にはデフォルトでイメージを提供するリモートサーバが 3 つ登録されています:

ubuntu: (stable Ubuntu イメージ用 )
ubuntu-daily: (daily Ubuntu イメージ用 )
images: (その他の多数のディストリビューション用)

イメージの作り方
snapshotを作成してpublishする。


ホストとターゲットの共有フォルダの作成
lxc config device add container-name home disk source=/home/share path=/home/share
homeは適当な名前
/home/shareは適当なディレクトリ


sshを使う場合

/etc/ssh/sshd_config
を編集
PasswordAuthentication yes
とし
systemctl restart sshd


lxd -h
  activateifneeded   Check if LXD should be started
  help               Help about any command
  import             Import existing containers
  init               Configure the LXD daemon
  shutdown           Tell LXD to shutdown all containers and exit
  version            Show the server version
  waitready          Wait for LXD to be ready to process requests

lxc -h
  alias       Manage command aliases
  cluster     Manage cluster members
  config      Manage container and server configuration options
  console     Attach to container consoles
  copy        Copy containers within or in between LXD instances
  delete      Delete containers and snapshots
  exec        Execute commands in containers
  export      Export container backups
  file        Manage files in containers
  help        Help about any command
  image       Manage images
  import      Import container backups
  info        Show container or server information
  launch      Create and start containers from images
  list        List containers
  move        Move containers within or in between LXD instances
  network     Manage and attach containers to networks
  operation   List, show and delete background operations
  profile     Manage profiles
  project     Manage projects
  publish     Publish containers as images
  remote      Manage the list of remote servers
  rename      Rename containers and snapshots
  restart     Restart containers
  restore     Restore containers from snapshots
  snapshot    Create container snapshots
  start       Start containers
  stop        Stop containers
  storage     Manage storage pools and volumes
  version     Show local and remote versions

2018年12月9日日曜日

illumos SMFに関すること

https://wiki.smartos.org/display/DOC/Basic+SMF+Commands

Service Management Facility
Linuxのsystemdみたいなもの

下記の四つのコマンドがある
svcadm svccfg svcs svcprop

svcadm - manipulate service instances
svccfg - import, export, and modify service configurations
svcs - report service status
svcprop - retrieve values of service configuration properties

manifest サービスの起動方法等をxmlのマニュフェストに記述する。
置き場所
/var/svc/manifest/
/lib/svc/manifest/
登録されているマニュフェストの内容を見る
sudo svccfg export ssh

php-fpm-70の登録
sudo svccfg import /lib/svc/manifest/network/php-fpm-70.xml
sudo svcadm enable php-fpm-70






2018年9月26日水曜日

ubunto core とsnap memo

ubuntu core をKVM上で動かす
手順はここにかかれている。
https://developer.ubuntu.com/core/get-started/kvm

まず Ubuntu SSO(Single Sign On)の登録
  1. Start by creating an Ubuntu SSO account
  2. Import an SSH Key into your Ubuntu SSO account on this page. Instructions to generate an SSH Key on your computer can be found here
を行う


mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa

$ cat id_rsa.pub
ssh-rsa ......

ssh-rsaから始まる文字列をコピーして
Ubuntu SSOに登録する。

KVMのインストール等は、ホームページにかかれているとおり。
ubuntu core16でまだ18でない
$ uname -r
4.4.0-135-generic

snapは、インストールされている。

$ sudo snap login
Email address: your@email.com <== Ubuntu SSOに登録したアドレス
Password of "your@email.com":
Login successful

ログインするとsnapのコマンドにsudoをつけなくても動くようになる。





2018年9月17日月曜日

openindian community


https://www.openindiana.org/community/code-of-conduct/
から

Code of Conduct
行動規範

行動規範については、現在議論中である。より良い提案があればぜひお願する。

OpenIndianaの行動規範

このドキュメントは、OpenIndianaコミュニティに貢献しようとする全ての人々に、安全で互いを尊重する、生産的で協力的な場所を提供するためのためのガイドラインを提供する。

Core principles and expectations:
基本原理と期待されること
●We are respectful and appreciative towards peoples work, time, and effort.
私たちは、人々の仕事・時間・努力に対してリスペクトし理解する。
●We are tolerant of the right to have opposing views.
私たちは、反対意見を持つ権利について寛容である。
私たちは、反対意見を持つ権利を認める。
●We recognize our public actions determine the public perception of the project.
私たちは、私たちの公での行動がプロジェクトの評価を決めることを自覚する。

●Participants must ensure their language and actions are free from personal attacks and disparaging personal remarks
参加者は、発言や行動が、個人攻撃、誹謗中傷でないことを確実にしないといけない。

●When interpreting the words and actions of others, participants should always assume good intentions.
他人の言葉、行動を、常に好意的に解釈しなくてはいけない。

What will not be tolerated:
認められないこと

●Open hostility, and or abusive language.
敵意と不適切な言動

●Repeated complaining (rehashing) of closed (decided) issues.
終了(決定)したことへの不満の繰り返し(蒸し返し)

●Participants who disrupt the collaborative space, or participate in a pattern of behavior which could be considered harassment.
共同スペースを混乱させる参加者、または、ハラスメントとみなされる行為に参加すること

●Filibustering – (replying with negative or opposing viewpoints to every post in a mailing list thread).
議事妨害行為 メーリングリストで否定的または反対の立場でリプライすること


Reporting violations:

違反の通報

    • Neither reporters nor reported persons will, or should be, made public.
Violations of the CoC should only be reported to the distribution maintainers via direct messages on IRC, twitter, or via E-mail and will be handled confidentially.
行動規範(code of conduct) の違反は、ディストリビューション管理者に、IRCかtwiiterのダイレクトメッセージまたはE-mailで内内に通知されるべきである。

  Neither reporters nor reported persons will, or should be, made public.
  通報者・通報されたものともに公にされることはない。

Sources

原本


興味深いので訳してみたが
chromの翻訳でかなりカバーできることが判明した。