rocky_linux_9インストール手順

新しいネットワーク構想

311-405: 192.168.192.1-207.254 (192.168.192.0/20 255.255.240.0)

共有Win: 192.168.192.210-220

プリンター: 192.168.193.101-110
311固定Win: 192.168.193.151-200 (m30v311n1:192.168.201.151->v311n1:192.168.193.151)
405固定Win: 192.168.193.201-250

DHCP範囲: 192.168.196-199.X (/22)
NFS共有範囲: 192.168.200-203.X (/22)
             192.168.253.160-175 /28 (一般的には160, 175がネットワークアドレスとブロードキャストアドレス)

ルーターなど: 192.168.200.X
GW: 192.168.200.2 (Buffalo)
GW: 192.168.200.1 (YAMAHA)
GW: 192.168.200.3 (NTT)
GW: 192.168.200.4 (WiMAX)
内部用ルーター: 192.168.21-30
解析サーバ管理コンソール: 解析サーバと最後が同じ192.168.200.X(101-150)に
インフラ用仮想PC: 192.168.200.201-210
Linuxルーター: 192.168.200.211-220

解析サーバ: 192.168.201.X

NAS: 192.168.202.180-190

Hyper-V内部ネットワーク構築

https://infra-memorandum.com/hyperv-napt/

#コントロールパネルのネットワークアダプタの設定でIP v4に192.168.200.1, 255.255.240.0を振った後、
New-NetNat -Name 'vEthernet (内部仮想スイッチ)' -InternalIPInterfaceAddressPrefix 192.168.200.0/20

内部DNS登録手順

ssh -l root 192.168.200.201
#pass: suikou

下記のファイルを更新

nano /var/named/chroot/var/named/kakky.fs.a.u-tokyo.ac.jp.db
nano /var/named/chroot/var/named/168.192.in-addr.arpa.db
#更新時にどちらのファイルもSerial値を日付+2桁の連番に更新すること

systemctl restart named-chroot

rootパスワードなど

初期ユーザ名パスワード
rootSuikou123$
yoshitakeSuikou123$

インストールUSB作成

普通にRocky9.2のISOをUSBに書き込んだものを使うと、

invalid image 
failed to read header unsupported

などと出る。 https://www.reddit.com/r/RockyLinux/comments/r49er0/comment/hs6mll2/?utm_source=share&utm_medium=web2x&context=3 https://discussion.fedoraproject.org/t/f37-invalid-image-error-while-booting/75921/9

/<USB_Stick>/EFI フォルダーにアクセスするには、ISO モード(dd モードではない) でインストーラー ISO を USB スティックに書き込むツール (Rufus など) が必要です。EFI パーティションにアクセスできる場合は、dd モードも使用できると思います。
/<USB_Stick>/EFI/BOOT に移動し、元の BOOTX64.EFI をリネーム
shim-x64-15.4-5.x86_64.rpm
の中のBOOTX64.EFIを上書き
\\m32b.s\yoshitake.kazutoshi\Downloads
にも保存している。

インストール時

日本語を選択する(LANG=ja_JP.UTF-8にするためで、英語にすると、LANG=en_US.UTF-8となり、sortなどのプログラムの挙動が変わってしまうので日本語に揃える)

  • インストール先→カスタム→完了→ここをクリックすると自動的に作成します→「/home」を消すために「-」をクリック→「/」の容量を適当に大きな数に変更しておく(後で最大値に自動で調整される)→完了→「変更を許可する」
  • KDUMP→kdumpを有効にするのチェックを外す→完了
  • ソフトウェアの選択→ワークステーション→完了
  • ネットワークとホスト名→ホスト名を適切につける→設定→IPv4 設定→メソッドを手動に→追加→IP: 192.168.201.1XX, ネットマスク: 20, GW: 192.168.200.1→DNSサーバ: 192.168.200.201, ドメインを検索: s→保存→Ethernet(eth0)を有効化→完了
  • 時刻と日付→アジア, 東京を選択→完了
  • rootパスワード→Suikou123$→パスワードによるroot SSHログインを許可にチェック→完了
  • ユーザ→フルネーム, ユーザ名: yoshitake→このユーザを管理者にするにチェック→パスワード: yoshitake
  • DVDからインストールするファイルを取得出来ていないようならURLにhttps://ftp.jaist.ac.jp/pub/Linux/rocky/9/BaseOS/x86_64/os/などを指定。 - インストール元→ネットワーク上→urlタイプ: mirrorlist→https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=BaseOS-9

を行ってから「インストールの開始」→システムの再起動

SATAドライバ(共有フォルダ設定を行った後で)

SATA/SASドライバが変なので

http://elrepo.org/tiki/DeviceIDs

を見て、

sudo lspci |grep -i sas
sudo lspci -n |grep 03:00

などとやって8086:1d68がkmod-isciであることを突き止める。

#sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y
#wget https://elrepo.reloumirrors.net/elrepo/el9/x86_64/RPMS/kmod-isci-1.2.0-3.el9_2.elrepo.x86_64.rpm
#sudo dnf install ./kmod-isci-1.2.0-3.el9_2.elrepo.x86_64.rpm
sudo dnf install /suikou/download9/kmod-isci-1.2.0-3.el9_2.elrepo.x86_64.rpm
sudo reboot

でインストール完了。 Rocky 9.3では上の手順ではkernelが合わないのでELREPOを使ってインストールする。

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
dnf install -y https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm
dnf install -y kmod-isci

minimalでインストールした場合

下記をインストールする。

dnf groupinstall workstation

管理者ユーザ追加

sudo su -

uid=600
id=suikou
pass="Suikou123$"
groupadd -g $uid $id
sudo useradd -u $uid -g $id -d /home/$id -s /bin/bash $id
echo -e "$pass\n$pass"|passwd $id
gpasswd -a $id wheel
sed -i 's/^%wheel\tALL=(ALL)\tALL/%wheel\tALL=(ALL)\tNOPASSWD: ALL/' /etc/sudoers

#/homeが使えない場合でもログインできるアカウント
groupadd -g 602 suikou2
useradd -u 602 -g 602 suikou2
mkdir -p /em-home/suikou2
chown -R suikou2:suikou2 /em-home/suikou2
usermod -d /em-home/suikou2 suikou2
echo -e "$pass\n$pass"|passwd suikou2
gpasswd -a suikou2 wheel

共有フォルダをマウント

#sudo yum -y install nfs-utils #まだNFSをインストールしていない場合

mkdir -p /suikou/home /suikou/tool /suikou/tool-all /suikou/download /suikou/home9 /suikou/tool9 /suikou/tool9-all /suikou/download9 /suikou/db /suikou/files /root/files

echo '
m32s:/m2/home       /suikou/home      nfs exec,dev,suid,rw,bg,hard,intr
m32s:/m2/tool       /suikou/tool      nfs exec,dev,suid,rw,bg,hard,intr
m32s:/m2/tool-all   /suikou/tool-all  nfs exec,dev,suid,rw,bg,hard,intr
m32s:/m2/download   /suikou/download  nfs exec,dev,suid,rw,bg,hard,intr
m32s:/m2/tool9      /suikou/tool9     nfs exec,dev,suid,rw,bg,hard,intr
m32s:/m2/tool9-all  /suikou/tool9-all nfs exec,dev,suid,rw,bg,hard,intr
m32s:/m2/download9  /suikou/download9 nfs exec,dev,suid,rw,bg,hard,intr
m32s:/m2/home9      /home             nfs exec,dev,suid,rw,bg,hard,intr
m32s:/m2/home9      /suikou/home9     nfs exec,dev,suid,rw,bg,hard,intr
m32s:/m2/db         /suikou/db        nfs exec,dev,suid,rw,bg,hard,intr
m32s:/m2/root-files /root/files       nfs exec,dev,suid,rw,bg,hard,intr
' >> /etc/fstab
mount -a

mkdir /root/.ssh
chmod 700 /root/.ssh
cp -p /root/files/ssh/* /root/.ssh #authorized_keys  config  id_rsa
echo "source /opt/sge/default/common/settings.sh" >> /root/.bashrc

SE Linux無効化設定

setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

Firewall無効化設定

systemctl disable --now firewalld.service

CUIで起動

xvncで接続するために必要

systemctl set-default multi-user.target

ファイルオープン数上限緩和

ulimit -Sn 65536
ulimit -Hn 65536
echo '* soft nofile 65536
* hard nofile 65536' >> /etc/security/limits.conf

Rなど

dnf install -y epel-release
dnf config-manager --set-enabled crb
dnf install -y R cairo-devel curl-devel fribidi-devel libtiff-devel
#wget https://download2.rstudio.org/server/rhel9/x86_64/rstudio-server-rhel-2023.03.1-446-x86_64.rpm
dnf install -y /suikou/download9/rstudio-server-rhel-2023.03.1-446-x86_64.rpm
#http://localhost:8787/でアクセス

gcc install等

yum -y groupinstall "Development Tools"
dnf install -y ruby nodejs golang-bin screen
yum install -y lm_sensors iperf3 python3-pip perl-App-cpanminus iftop
yum install -y libunwind libgdiplus #for Mono
yum -y install ntfs-3g exfatprogs
dnf install -y ncdu nethogs iotop-c

zabbix

yum install -y sysstat 
cp -r /suikou/download9/zabbix-3.2.11 /usr/local/
groupadd -g 603 zabbix
useradd -u 603 -g 603 zabbix
mkdir /run/zabbix
chown zabbix:zabbix /run/zabbix
cp /usr/local/zabbix-3.2.11/zabbix-agent.service /usr/lib/systemd/system/
#systemctl daemon-reload
systemctl enable --now zabbix-agent.service
cp /usr/local/zabbix-3.2.11/zabbix-iostat.service /usr/lib/systemd/system/
systemctl enable --now zabbix-iostat.service
#確認方法
ssh suikouvm.s
zabbix_get -s m64 -k agent.version
#3.2.11と表示されたら成功

podman

yum -y install podman
sed -i 's%# rootless_storage_path = "$HOME/.local/share/containers/storage"%rootless_storage_path = "$HOME/work/podman/storage"%' /etc/containers/storage.conf
#ユーザごとには/home/yoshitake.kazutoshi/.config/containers/registries.conf
#nano /etc/containers/registries.conf #下記の行を最後に追加
#[[registry]]
#prefix = "docker.io"
#location = "docker.io"
#
#[[registry.mirror]]
#location = "m32s:5000"
#insecure = true
#
#さらに下記の行を変更
##unqualified-search-registries = ["registry.access.redhat.com", "registry.redhat.io", "docker.io"]
#unqualified-search-registries = ["docker.io"]

sed -i 's/unqualified-search-registries = \["registry.access.redhat.com", "registry.redhat.io", "docker.io"]/unqualified-search-registries = ["docker.io"]/' /etc/containers/registries.conf

grep -zPo "\[\[registry]]\nprefix = \"docker.io\"\nlocation = \"docker.io\"\n\n\[\[registry.mirror]]\nlocation = \"m32s:5000\"\ninsecure = true" /etc/containers/registries.conf || echo -e "[[registry]]\nprefix = \"docker.io\"\nlocation = \"docker.io\"\n\n[[registry.mirror]]\nlocation = \"m32s:5000\"\ninsecure = true" >> /etc/containers/registries.conf 

grep -zPo "\[\[registry]]\nprefix = \"quay.io\"\nlocation = \"quay.io\"\n\n\[\[registry.mirror]]\nlocation = \"m32s:5001\"\ninsecure = true" /etc/containers/registries.conf || echo -e "\n[[registry]]\nprefix = \"quay.io\"\nlocation = \"quay.io\"\n\n[[registry.mirror]]\nlocation = \"m32s:5001\"\ninsecure = true" >> /etc/containers/registries.conf 
#たくさんのディレクトリをバインドしようとするとエラーになるので、下記のパラメーターを増加させておく
echo 500000 > /proc/sys/kernel/keys/maxkeys
echo 1000000 > /proc/sys/kernel/keys/maxbytes

if [ `cat /etc/sysctl.conf|grep kernel.keys.maxkeys=500000|wc -l` = 1 ];then
echo 'kernel.keys.maxkeys=500000
kernel.keys.maxbytes=1000000' >> /etc/sysctl.conf
fi

#cat /proc/key-users #で確認

GNOME-XRDP

/usr/share/gnome-shell/extensions/にインストールされるフォルダ名を見て、拡張機能の記述の仕方を見ておく

dnf install -y gnome-extensions-app-40.0-3.el9.x86_64
echo "[org/gnome/shell]
enabled-extensions=['desktop-icons@gnome-shell-extensions.gcampax.github.com', 'window-list@gnome-shell-extensions.gcampax.github.com']
" > /etc/dconf/db/local.d/00-desktop-icons
dconf update

dnf install -y xrdp
sed -i 's/^#xserverbpp=24$/xserverbpp=24/' /etc/xrdp/xrdp.ini #CLCが真っ白になるのを防止
systemctl enable --now xrdp
#reboot

SGE

dnf install -y cmake hwloc-devel libdb-devel motif-devel ncurses-devel openssl-devel pam-devel rsync systemd-devel wget m4
#m32sにqmasterインストール
#git clone https://github.com/daimh/sge.git sge_v2023-06-17
#cd sge_v2023-06-17
#cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/opt/sge
#cmake --build build -j
#cmake --install build
#useradd -u 604 -r -d /opt/sge sge
#chown -R sge /opt/sge
#cd /opt/sge
#./install_qmaster (基本Enterを押すだけ。メールアドレスをsuikou-admin@googlegroups.comに設定。)
#yes "" | ./install_execd

#suikousgeにqmasterをインストールしてm32sから移設する
#m32s上のsge master execdを停止させておく
#rsync -av --progress m32s:/opt/sge /opt
#chown -R sge /opt/sge/default
#./install_qmaster (基本Enterを押すだけ。途中ディレクトリを上書きするという選択を2か所選択。メールアドレスをsuikou-admin@googlegroups.comに設定。)
#m32s上で行ったqueの設定変更などは維持されていた

#各ノードで実行
mkdir -p /opt/sge/default
useradd -u 604 -r -d /opt/sge sge
rsync -av --progress --exclude spool suikousge:/opt/sge /opt
chown -R sge /opt/sge/default
ssh suikousge "source /opt/sge/default/common/settings.sh; qconf -as $HOSTNAME; qconf -ah $HOSTNAME"
cd /opt/sge
yes "" | ./install_execd
source /opt/sge/default/common/settings.sh
qconf -rattr exechost complex_values mem_req=`free -g|grep "^Mem:"|awk '{print $2}'`G `hostname`
#Hyper-V仮想マシンで動的メモリを使用中はfree -gが0になるため手動で設定したほうが良さそう

RAID用

dnf -y install sendmail s-nail
systemctl enable --now sendmail

NFSホスト設定

#sudo yum -y install nfs-utils #まだNFSをインストールしていない場合

mkdir /data
echo '/data 192.168.200.0/22(rw,insecure,no_subtree_check,async,no_root_squash) 192.168.253.160/28(rw,insecure,no_subtree_check,async,no_root_squash)' >> /etc/exports
exportfs -ra
#exportfsで現在共有中のディレクトリを確認

systemctl restart rpcbind
systemctl enable --now nfs-server
#echo "$HOSTNAME  -fstype=nfs,rw,noac   $HOSTNAME:/data" >> /root/files/auto.suikou.files #大容量HDDサーバのみ

SAMBAホスト設定

yum -y install samba
mv /etc/samba/smb.conf /etc/samba/smb.conf.back
echo "[global]
        workgroup = SAMBA
        security = user

        passdb backend = tdbsam

        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw
        unix extensions = no
        wide links = yes

[homes]
        comment = Home Directories
        valid users = %S
        browseable = no
        writable = yes
        create mask = 0644
        directory mask = 0755
        path=/home/%S
[data]
        path = /data/
        guest ok = no
        writable = yes
        browsable = yes
        create mask = 0644
        directory mask = 0755
" > /etc/samba/smb.conf

#ユーザをOSに追加
/root/files/run-setup-user-linux.sh
#ユーザをSAMBAに追加
/root/files/run-setup-user-samba.sh

systemctl enable --now smb nmb

autofs設定

yum -y install autofs
sed -i 's/^+auto.master$/#+auto.master/' /etc/auto.master
echo "/suikou/files   /etc/auto.suikou.files   --timeout=0" >> /etc/auto.master
cp /root/files/auto.suikou.files /etc/auto.suikou.files
systemctl enable --now autofs

LibreOffice, VLC, Visual Studio Code, Chrome, cockpitインストール

dnf install -y snapd
systemctl enable --now snapd
sleep 10
snap install libreoffice
snap install vlc
snap install btop

#wget https://az764295.vo.msecnd.net/stable/695af097c7bd098fbf017ce3ac85e09bbc5dda06/code-1.79.2-1686734266.el7.x86_64.rpm
dnf -y install /suikou/download9/code-1.79.2-1686734266.el7.x86_64.rpm

#chrome ver: 114.0.5735.198
dnf -y install /suikou/download9/google-chrome-stable_current_x86_64.rpm

systemctl enable --now cockpit.socket
dnf install -y cockpit-pcp
systemctl enable --now pmlogger

MAMBA

##一度インストールすればあとは共有すれば良いのでパス
#wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
#bash Mambaforge-Linux-x86_64.sh
#
##/suikou/tool9/mambaforgeをprefixに指定
#
#conda config --set auto_activate_base false

JupyterHub

#conda install -c conda-forge jupyterhub
#conda install jupyterlab notebook 

npm install -g configurable-http-proxy yarn
pip install jupyterhub jupyterlab notebook jupyterhub-systemdspawner

#jupyterhub --generate-config
#nano jupyterhub_config.py
#c.JupyterHub.spawner_class = 'systemdspawner.SystemdSpawner'
#c.Spawner.default_url = '/lab'  # JupyterLabを立ち上げる
#c.Spawner.notebook_dir = '~/jupyter_projects'  # ログイン時のデフォルトディレクトリをホームディレクトリにする
#jupyterhub -f "PATH to jupyterhub_config.py"
#http://localhost:8000/でアクセス

#/etc/systemd/system/jupyterhub.service
#[Unit]
#Description=Jupyterhub
#After=syslog.target network.target
#
#[Service]
#User=root
#ExecStart=/usr/local/bin/jupyterhub -f /etc/jupyterhub/jupyterhub_config.py
#
#[Install]
#WantedBy=multi-user.target

#jupyterhubを起動

mkdir /etc/jupyterhub
cp /root/files/jupyterhub_config.py /etc/jupyterhub/
sed -i  's%^[# ]*c.JupyterHub.bind_url =.*%c.JupyterHub.bind_url = '"'http://:8000/jupyter-$HOSTNAME/'"'%'  /etc/jupyterhub/jupyterhub_config.py
cp /root/files/jupyterhub.service /etc/systemd/system/

# service jupyterhub start
systemctl enable --now jupyterhub.service

postfix

dnf -y install postfix
systemctl enable --now postfix.service

#echo '[smtp.gmail.com]:587 c299792108@gmail.com:XXXXpasswordXXXX' > /etc/postfix/gmail
#postmap /etc/postfix/gmail
#rm -f /etc/postfix/gmail
cp /root/files/gmail.db /etc/postfix/

echo '
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/gmail
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
smtp_use_tls = yes
' >> /etc/postfix/main.cf

systemctl reload postfix

# mdadm --monitor --scan --oneshot --test で確認

# postfixはすぐに止まるので、毎日再起動させる

if [ `cat /etc/crontab|grep postfix|wc -l` = 0 ]; then echo '30 5 * * * root systemctl restart postfix.service' >> /etc/crontab; fi

追加パッケージインストール

初回セットアップ以降に必要があり追加したパッケージの一覧。

bash /root/files/run-setup-additional-package.sh

簡略化インストール

sudo su -
scp m32s:/root/files/run-setup-package.sh . #Suikou123$
bash run-setup-package.sh
#echo -e "Suikou123$\nSuikou123$"|passwd
#echo -e "Suikou123$\nSuikou123$"|passwd yoshitake
##大容量HDDサーバのみ
#echo "$HOSTNAME  -fstype=nfs,rw,noac   $HOSTNAME:/data" >> /root/files/auto.suikou.files

#bash /root/files/run-setup-additional-package.sh

reboot
#/dataフォルダを後でマウントする場合、マウント後に再度下記を行って、.mozillaフォルダなどを作る
/root/files/run-setup-user-linux.sh

簡略化インストール (251用)

sudo su -
scp m128m:/data/suikou-m2/root-files-v251/run-setup-package.sh . #Suikou123$
bash run-setup-package.sh

qconf -mq all.q #自動でslotsのところに新しいサーバが追加されているから、そのサーバのslot数を0にしておく。
qconf -mq v251.q #新しいサーバはまだ251専用キューに追加されていないから追加しておく。

podman

WARNを消す (run-setup-user-linux.shのほうで実行)

$ podman run -it --rm centos:7
WARN[0000] The cgroupv2 manager is set to systemd but there is no systemd user session available
WARN[0000] For using systemd, you may need to login using an user session
WARN[0000] Alternatively, you can enable lingering with: `loginctl enable-linger 2007` (possibly as root)
WARN[0000] Falling back to --cgroup-manager=cgroupfs
WARN[0000] The cgroupv2 manager is set to systemd but there is no systemd user session available
WARN[0000] For using systemd, you may need to login using an user session
WARN[0000] Alternatively, you can enable lingering with: `loginctl enable-linger 2007` (possibly as root)
WARN[0000] Falling back to --cgroup-manager=cgroupfs

と出るので、

$ systemctl --user start dbus
Failed to connect to bus: メディアが見つかりません

とやると良いとあるけど、エラー。

loginctl enable-linger $USER #/run/user/$UIDが出来る
XDG_RUNTIME_DIR=/run/user/$UID systemctl --user start dbus

とするとWARNが消える。(loginctl enable-lingerのほうだけで消えるみたい)

podman repositry

user権限で実行するなら

@m32s
mkdir /data/yoshitake.kazutoshi/work/podman-registry
podman run -d -p 5000:5000  -v /data/yoshitake.kazutoshi/work/podman-registry:/var/lib/registry --name registry -e REGISTRY_PROXY_REMOTEURL="https://registry-1.docker.io" registry:2.8.2
podman run -d -p 5050:80 --name registryfront -e ENV_DOCKER_REGISTRY_HOST=m32s -e ENV_DOCKER_REGISTRY_PORT=5000 konradkleine/docker-registry-frontend:v2
#http://m32s.s:5050/でレポジトリが見える。
podman generate systemd --files --name registry
podman generate systemd --files --name registryfront
mkdir -p ~/.config/systemd/user
cp container-registry* ~/.config/systemd/user/
systemctl --user enable container-registry.service #まだ起動していない状態で一緒に起動させるならsystemctl --user enable --now container-registry.service
systemctl --user enable container-registryfront.service #まだ起動していない状態で一緒に起動させるならsystemctl --user enable --now container-registryfront.service
systemctl --user list-dependencies

mkdir /data/yoshitake.kazutoshi/work/podman-registry-quay
podman run -d -p 5001:5000  -v /data/yoshitake.kazutoshi/work/podman-registry-quay:/var/lib/registry --name registry-quay -e REGISTRY_PROXY_REMOTEURL="https://quay.io" registry:2.8.2
podman run -d -p 5051:80 --name registryfront-quay -e ENV_DOCKER_REGISTRY_HOST=m32s -e ENV_DOCKER_REGISTRY_PORT=5001 konradkleine/docker-registry-frontend:v2
podman generate systemd --files --name registry-quay
podman generate systemd --files --name registryfront-quay
cp container-registry*quay* ~/.config/systemd/user/
systemctl --user enable container-registry-quay.service
systemctl --user enable container-registryfront-quay.service
systemctl --user list-dependencies


#nano /home/yoshitake.kazutoshi/.config/containers/registries.conf
[[registry]]
prefix = "docker.io"
location = "docker.io"

[[registry.mirror]]
location = "m32s:5000"
insecure = true

[[registry]]
prefix = "quay.io"
location = "quay.io"

[[registry.mirror]]
location = "m32s:5001"
insecure = true

#podman pull docker.io/centos:7
#curl http://m32s:5000/v2/_catalog
#podman pull quay.io/biocontainers/mafft:7.505--hec16e2b_0
#curl http://m32s:5001/v2/_catalog
#などでm32sのプライベートレジストリーをキャッシュとして使っているか確認

rootでやるなら

podman run -d -p 5000:5000 --name registry -v /data/backup/docker/:/var/lib/registry registry:2
podman run -d -p 8080:80 --name registryfront -e ENV_DOCKER_REGISTRY_HOST=m32s -e ENV_DOCKER_REGISTRY_PORT=5000 konradkleine/docker-registry-frontend:v2
podman generate systemd --files --name registry
podman generate systemd --files --name registryfront
cp container-registry.service container-registryfront.service /usr/lib/systemd/system/
systemctl enable --now container-registry.service
systemctl enable --now container-registryfront.service

podmanでdocker.ioにログイン

下記をノードごとに実行しておけば、dockerhubにpushできるようになる

#podman login --get-login docker.io
#各ノードで実行する必要有
podman login -v docker.io #dockerhubにログインしておく。ユーザ名はメールアドレスではない。

CentOS7環境再現

podman run -it --rm --user $USER -w $PWD -v /data:/data -v /suikou/home/$USER:/home/$USER -v /suikou/files:/suikou/files -v /suikou/db:/suikou/db -v /suikou/download:/suikou/download -v /suikou/tool:/suikou/tool -v /suikou/tool-all:/suikou/tool-all -v /suikou/home/linuxbrew:/home/linuxbrew docker.io/c2997108/centos7:suikoubase2 bash --rcfile $HOME/.bashrc

podman run -it --rm -w $PWD -v /data:/data -v /suikou/home/$USER:/home/$USER -v /suikou/files:/suikou/files -v /suikou/db:/suikou/db -v /suikou/download:/suikou/download -v /suikou/tool:/suikou/tool -v /suikou/tool-all:/suikou/tool-all -v /suikou/home/linuxbrew:/home/linuxbrew m32s:5000/suikoubase:centos7 bash --rcfile $HOME/.bashrc
#--userを付けると、/homeなどのNFS共有フォルダがすべてnfsnobodyとなるためアクセスできなくなる

suikougw設定

最小でインストール
ID: yoshitake
Pass: Suikou123$

rootのssh パスワードログインを禁止

nfsのファイルを提供する機能は設定する

共有フォルダを全サーバに反映させるには

cp /root/files/auto.suikou.files /etc/auto.suikou.files

systemctl restart autofs

/root/files/run-setup-user-linux.sh #ユーザ追加と各ユーザの共有フォルダのシンボリックリンクを作成する

for i in `qhost|tail -n+4|grep -v " - "|cut -f 1 -d " "`; do echo $i; ssh $i "cp /root/files/auto.suikou.files /etc/auto.suikou.files; systemctl restart autofs"; done

##suikouvm
#ssh -l root suikouvm.s #password: suikou
#cp /root/files/auto.suikou.files /etc/auto.suikou.files
#systemctl restart autofs
#ls /home/user1/files/
##samba共有へ追加(例としてm64gを追加する場合)
#ln -s /suikou/files/m64g /samba/share
#exit

#suikougw
ssh suikougw
scp m32s.s:/root/files/auto.suikou.files /etc/auto.suikou.files
systemctl restart autofs
/root/files/run-setup-user-gw.sh
exit

#suikouhttp
ssh suikouhttp
scp m32s.s:/root/files/auto.suikou.files /etc/auto.suikou.files
systemctl restart autofs
rm -f /var/www/html/private/files/*
for i in `cat /etc/auto.suikou.files |grep -v ^#|cut -f 1 -d ' '`; do ln -s /suikou/files/$i /var/www/html/private/files/; done
exit

JupyterHubとRstudio serverをapacheの下で動かす方法

nano /etc/jupyterhub/jupyterhub_config.py

c.JupyterHub.bind_url = '/jupyter-m128g/'
#に変更
systemctl daemon-reload
systemctl restart jupyterhub.service
nano /etc/httpd/conf.d/jupyter.conf

<VirtualHost *:18000>
 RewriteEngine on
 ProxyRequests Off

 #Rstudio
 <Location /rstudio-m128g>
  AuthType Basic
  AuthName "Restricted Content"
  AuthUserFile /etc/httpd/.htpasswd
  Require valid-user
 </Location>

 RewriteCond %{HTTP:Upgrade} =websocket
 RewriteRule /rstudio-m128g/(.*)     ws://m128g:8787/$1  [P,L]
 RewriteCond %{HTTP:Upgrade} !=websocket
 RewriteRule /rstudio-m128g/(.*)     http://m128g:8787/$1 [P,L]
 ProxyPass /rstudio-m128g/ http://m128g:8787/
 ProxyPassReverse /rstudio-m128g/ http://m128g:8787/

 #JupyterHub
 <Location /jupyter-m128g/hub/>
  AuthType Basic
  AuthName "Restricted Content"
  AuthUserFile /etc/httpd/.htpasswd
  Require valid-user
 </Location>

 RewriteCond %{HTTP:Connection} Upgrade [NC]
 RewriteCond %{HTTP:Upgrade} websocket [NC]
 RewriteRule /jupyter-m128g/(.*) ws://m128g:8000/jupyter-m128g/$1 [P,L]
 RewriteRule /jupyter-m128g/(.*) http://m128g:8000/jupyter-m128g/$1 [P,L]

 <Location /jupyter-m128g/>
  ProxyPreserveHost On
  ProxyPass http://m128g:8000/jupyter-m128g/
  ProxyPassReverse http://m128g:8000/jupyter-m128g/
 </Location>

</VirtualHost>
bash /root/files/http-conf-make.sh

出てきた結果を https://www.suikou.fs.a.u-tokyo.ac.jp/dokuwiki/doku.php?id=web に張り付ける。

Geneiousのインストール

RHEL9系は2023年のバージョンではサポートされていないようで、redhat_lsb_coreのライブラリをインストールが必要
https://bugzilla.redhat.com/show_bug.cgi?id=2088203
を参考に
cd /root/files/for-geneious
dnf install redhat-lsb-core-4.1-56.el9.x86_64.rpm spax-1.6-6.el9.x86_64.rpm redhat-lsb-submod-security-4.1-56.el9.x86_64.rpm

をしてから、rootでGeniousのインストールプログラムを実行しておく

cockpitをapacheのサブディレクトリで動かす

https://github.com/cockpit-project/cockpit/wiki/Proxying-Cockpit-over-Apache-with-LetsEncrypt を参考

#各ノードで
#nano /etc/cockpit/cockpit.conf
[WebService]
Origins = https://suikou.fs.a.u-tokyo.ac.jp http://127.0.0.1:9090
ProtocolHeader = X-Forwarded-Proto
AllowUnencrypted = true
UrlRoot = /cp/

#suikouhttpで下記に追加
#nano /etc/httpd/conf/httpd.conf
<VirtualHost *:443>
  ServerName suikou.fs.a.u-tokyo.ac.jp
                SSLProxyEngine          On
                RewriteEngine           On
                ProxyPreserveHost       On
                ProxyRequests           Off
                ProxyErrorOverride      Off
                SSLProxyVerify optional_no_ca
                SSLProxyCheckPeerCN Off
                SSLProxyCheckPeerName Off
                SSLProxyCheckPeerExpire Off
                RequestHeader set "X-Forwarded-Proto" "https"
                RewriteCond %{HTTP:Upgrade} websocket [NC]
                RewriteCond %{HTTP:Connection} upgrade [NC]
                RewriteRule "^/cp/(.*)" "wss://192.168.201.129:9090/cp/$1" [P,L]
                RewriteCond ${HTTP:Upgrade} !=websocket [NC]
                RewriteRule "^/cp/(.*)" "https://192.168.201.129:9090/cp/$1" [P,L]
</VirtualHost>

ただし、直接各サーバにはアクセスできなくなるみたい。

m768 SSH設定

nano /etc/ssh/sshd_config
Port 22
Port 8022

#一番最後に下記を追加
Match LocalPort 8022
  PermitRootLogin no
  PasswordAuthentication no
systemctl restart sshd
  • rocky_linux_9インストール手順.1715140809.txt.gz
  • 最終更新: 2024/05/08 04:00
  • by 210.146.70.5