Ping-tでOSS-DBの勉強をする
Linuc/LPICやCCNAなどの資格試験をサポートする学習サイト。
無料でも利用できるがOSS-DBのコンテンツは有料プランであったため、月額2,400円のプレミアムコンテンツに登録した。基本的には問題集だが、今のところ解説が充実している印象がある。
3割くらいは問いた。
『PostgreSQL 12.4文書』を読む
気が遠くなる。
今日はサーバの辺りを読んだ。
VMでPostgreSQLサーバを起動する
昨日用意したVMに、『PostgreSQL 12.4文書』の「III. サーバの管理」を参考にしながらPostgreSQLサーバを構築する。
環境
- macOS:10.15.7
- VirtualBox:6.1.4
- centos:7.9
- PostgreSQL:12.4
作業内容
仮想マシンのネットワーク設定変更
設定>ネットワークから「アダプター2」を「割り当て:ホストオンリーアダプタ」で設定。
仮想マシンにログインしnmtui
コマンドでネットワークマネージャーを立ち上げてアダプタの設定を変更。
- enp0s3
- IPv6 CONFIGURATION
- [×] Automatically Connect
- IPv6 CONFIGURATION
- ■■■■1
PostgreSQLのインストール
ソースからビルドではなくyumリポジトリを追加してインストールする。
上記サイトに各種情報を入力してコピーしたスクリプト。
# Install the repository RPM: sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm # Install PostgreSQL: sudo yum install -y postgresql12-server # Optionally initialize the database and enable automatic start: sudo /usr/pgsql-12/bin/postgresql-12-setup initdb sudo systemctl enable postgresql-12 sudo systemctl start postgresql-12
confファイルを編集(一旦全て許可)
- postgresql.conf
listen_addresses = '*'
- pg_hba.conf
host all all 0.0.0.0/0 md5
ファイアウォール設定
外部からsshで接続できるようにする。
ファイアウォールにサービスを登録して再起動。
# firewall-cmd --add-service=postgresql --zone=public --permanent success # systemctl restart firewalld
virtualboxのポートフォワーディングに「5432」を追加しておく。
以上